|
44 | 44 | " \u003ca target=\"_blank\" href=\"https://www.tensorflow.org/decision_forests/tutorials/advanced_colab\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/tf_logo_32px.png\" /\u003eView on TensorFlow.org\u003c/a\u003e\n", |
45 | 45 | " \u003c/td\u003e\n", |
46 | 46 | " \u003ctd\u003e\n", |
47 | | - " \u003ca target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/decision_forests/blob/master/documentation/tutorials/advanced_colab.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" /\u003eRun in Google Colab\u003c/a\u003e\n", |
| 47 | + " \u003ca target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/decision-forests/blob/main/documentation/tutorials/advanced_colab.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" /\u003eRun in Google Colab\u003c/a\u003e\n", |
48 | 48 | " \u003c/td\u003e\n", |
49 | 49 | " \u003ctd\u003e\n", |
50 | | - " \u003ca target=\"_blank\" href=\"https://github.com/tensorflow/decision_forests/blob/master/documentation/tutorials/advanced_colab.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" /\u003eView on GitHub\u003c/a\u003e\n", |
| 50 | + " \u003ca target=\"_blank\" href=\"https://github.com/tensorflow/decision-forests/blob/main/documentation/tutorials/advanced_colab.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" /\u003eView on GitHub\u003c/a\u003e\n", |
51 | 51 | " \u003c/td\u003e\n", |
52 | 52 | " \u003ctd\u003e\n", |
53 | | - " \u003ca href=\"https://storage.googleapis.com/tensorflow_docs/decision_forests/documentation/tutorials/advanced_colab.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/download_logo_32px.png\" /\u003eDownload notebook\u003c/a\u003e\n", |
| 53 | + " \u003ca href=\"https://storage.googleapis.com/tensorflow_docs/decision-forests/documentation/tutorials/advanced_colab.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/download_logo_32px.png\" /\u003eDownload notebook\u003c/a\u003e\n", |
54 | 54 | " \u003c/td\u003e\n", |
55 | 55 | "\u003c/table\u003e\n" |
56 | 56 | ] |
|
80 | 80 | }, |
81 | 81 | "outputs": [], |
82 | 82 | "source": [ |
83 | | - "# Install TensorFlow Dececision Forests\n", |
84 | | - "!pip install tensorflow_decision_forests" |
| 83 | + "# Install TensorFlow Dececision Forests.\n", |
| 84 | + "!pip install tensorflow_decision_forests\n", |
| 85 | + "\n", |
| 86 | + "# Use wurlitzer to capture training logs.\n", |
| 87 | + "!pip install wurlitzer" |
85 | 88 | ] |
86 | 89 | }, |
87 | 90 | { |
|
176 | 179 | }, |
177 | 180 | "outputs": [], |
178 | 181 | "source": [ |
179 | | - "%output_height 300px\n", |
180 | 182 | "model.summary()" |
181 | 183 | ] |
182 | 184 | }, |
|
189 | 191 | "Remark the multiple variable importances with name `MEAN_DECREASE_IN_*`." |
190 | 192 | ] |
191 | 193 | }, |
192 | | - { |
193 | | - "cell_type": "markdown", |
194 | | - "metadata": { |
195 | | - "id": "xTwmx8A0c4TU" |
196 | | - }, |
197 | | - "source": [ |
198 | | - "## Plotting the model\n", |
199 | | - "\n", |
200 | | - "Next, we plot our model.\n", |
201 | | - "\n", |
202 | | - "A Random Forest is a large model (this model has 300 trees and ~5k nodes; see the summary above). Therefore, we will only plot the first tree, and limit the nodes to depth 3." |
203 | | - ] |
204 | | - }, |
205 | | - { |
206 | | - "cell_type": "code", |
207 | | - "execution_count": null, |
208 | | - "metadata": { |
209 | | - "id": "ZRTrXDz_dIAQ" |
210 | | - }, |
211 | | - "outputs": [], |
212 | | - "source": [ |
213 | | - "tfdf.model_plotter.plot_model_in_colab(model, tree_idx=0, max_depth=3)" |
214 | | - ] |
215 | | - }, |
216 | 194 | { |
217 | 195 | "cell_type": "markdown", |
218 | 196 | "metadata": { |
|
612 | 590 | "inspector = tfdf.inspector.make_inspector(yggdrasil_model_path)\n", |
613 | 591 | "print(\"Input features:\", inspector.features())" |
614 | 592 | ] |
615 | | - }, |
616 | | - { |
617 | | - "cell_type": "markdown", |
618 | | - "metadata": { |
619 | | - "id": "muW1hgmotx8J" |
620 | | - }, |
621 | | - "source": [ |
622 | | - "And of course, you can plot the model :)" |
623 | | - ] |
624 | | - }, |
625 | | - { |
626 | | - "cell_type": "code", |
627 | | - "execution_count": null, |
628 | | - "metadata": { |
629 | | - "id": "bqahDVg3t1xM" |
630 | | - }, |
631 | | - "outputs": [], |
632 | | - "source": [ |
633 | | - "tfdf.model_plotter.plot_model_in_colab(manual_model)" |
634 | | - ] |
635 | 593 | } |
636 | 594 | ], |
637 | 595 | "metadata": { |
|
0 commit comments