-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Deep-learning section in documentation and create "with Tensorflo…
…w" tutorial. PiperOrigin-RevId: 624253185
- Loading branch information
1 parent
536b92f
commit 61b00fb
Showing
5 changed files
with
3,944 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+19.7 KB
documentation/public/docs/image/tutorial/compose_with_tf_ensemble.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3,670 changes: 3,670 additions & 0 deletions
3,670
documentation/public/docs/tutorial/compose_with_tf.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
272 changes: 272 additions & 0 deletions
272
documentation/public/docs/tutorial/compose_with_tf_plots.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,272 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "49b01ceb-a541-4c89-99e9-f6ac22d224ea", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"!pip install graphviz -U --quiet" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "2202b2cb-0ef9-4a13-8082-3a02136e862b", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from graphviz import Source" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 12, | ||
"id": "848320ca-84bf-47f6-9ee4-4dccbccf4ff3", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"image/svg+xml": [ | ||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n", | ||
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n", | ||
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n", | ||
"<!-- Generated by graphviz version 2.43.0 (0)\n", | ||
" -->\n", | ||
"<!-- Title: G Pages: 1 -->\n", | ||
"<svg width=\"591pt\" height=\"56pt\"\n", | ||
" viewBox=\"0.00 0.00 591.00 56.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n", | ||
"<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 52)\">\n", | ||
"<title>G</title>\n", | ||
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-52 587,-52 587,4 -4,4\"/>\n", | ||
"<!-- a -->\n", | ||
"<g id=\"node1\" class=\"node\">\n", | ||
"<title>a</title>\n", | ||
"<text text-anchor=\"middle\" x=\"41.5\" y=\"-14.3\" font-family=\"Times,serif\" font-size=\"14.00\">raw features</text>\n", | ||
"</g>\n", | ||
"<!-- b -->\n", | ||
"<g id=\"node2\" class=\"node\">\n", | ||
"<title>b</title>\n", | ||
"<polygon fill=\"none\" stroke=\"black\" points=\"218,-36 120,-36 120,0 218,0 218,-36\"/>\n", | ||
"<text text-anchor=\"middle\" x=\"169\" y=\"-14.3\" font-family=\"Times,serif\" font-size=\"14.00\">neural network</text>\n", | ||
"</g>\n", | ||
"<!-- a->b -->\n", | ||
"<g id=\"edge1\" class=\"edge\">\n", | ||
"<title>a->b</title>\n", | ||
"<path fill=\"none\" stroke=\"black\" d=\"M83.25,-18C91.58,-18 100.51,-18 109.33,-18\"/>\n", | ||
"<polygon fill=\"black\" stroke=\"black\" points=\"109.59,-21.5 119.59,-18 109.59,-14.5 109.59,-21.5\"/>\n", | ||
"</g>\n", | ||
"<!-- d -->\n", | ||
"<g id=\"node3\" class=\"node\">\n", | ||
"<title>d</title>\n", | ||
"<polygon fill=\"none\" stroke=\"black\" points=\"469,-36 373,-36 373,0 469,0 469,-36\"/>\n", | ||
"<text text-anchor=\"middle\" x=\"421\" y=\"-14.3\" font-family=\"Times,serif\" font-size=\"14.00\">decision forest</text>\n", | ||
"</g>\n", | ||
"<!-- b->d -->\n", | ||
"<g id=\"edge3\" class=\"edge\">\n", | ||
"<title>b->d</title>\n", | ||
"<path fill=\"none\" stroke=\"black\" d=\"M218.2,-18C259.45,-18 318.91,-18 362.61,-18\"/>\n", | ||
"<polygon fill=\"black\" stroke=\"black\" points=\"362.79,-21.5 372.79,-18 362.79,-14.5 362.79,-21.5\"/>\n", | ||
"<text text-anchor=\"middle\" x=\"295.5\" y=\"-36.8\" font-family=\"Times,serif\" font-size=\"14.00\">embedding</text>\n", | ||
"<text text-anchor=\"middle\" x=\"295.5\" y=\"-21.8\" font-family=\"Times,serif\" font-size=\"14.00\"> or processed features</text>\n", | ||
"</g>\n", | ||
"<!-- e -->\n", | ||
"<g id=\"node4\" class=\"node\">\n", | ||
"<title>e</title>\n", | ||
"<text text-anchor=\"middle\" x=\"544.5\" y=\"-14.3\" font-family=\"Times,serif\" font-size=\"14.00\">predictions</text>\n", | ||
"</g>\n", | ||
"<!-- d->e -->\n", | ||
"<g id=\"edge2\" class=\"edge\">\n", | ||
"<title>d->e</title>\n", | ||
"<path fill=\"none\" stroke=\"black\" d=\"M469.32,-18C478.04,-18 487.14,-18 495.87,-18\"/>\n", | ||
"<polygon fill=\"black\" stroke=\"black\" points=\"495.89,-21.5 505.89,-18 495.89,-14.5 495.89,-21.5\"/>\n", | ||
"</g>\n", | ||
"</g>\n", | ||
"</svg>\n" | ||
], | ||
"text/plain": [ | ||
"<graphviz.sources.Source at 0x7fe5cc3f2d10>" | ||
] | ||
}, | ||
"execution_count": 12, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"s = Source(\"\"\"\n", | ||
"digraph G {\n", | ||
" graph [rankdir=LR];\n", | ||
" node [shape=plaintext];\n", | ||
" a[label=\"raw features\"];\n", | ||
" b[label=\"neural network\", shape=rect];\n", | ||
" d[label=\"decision forest\", shape=rect];\n", | ||
" e[label=\"predictions\"];\n", | ||
" a -> b;\n", | ||
" d -> e;\n", | ||
" b -> d [label=\"embedding\\n or processed features\"];\n", | ||
"}\"\"\")\n", | ||
"s.render(\"../image/tutorial/compose_with_tf_stack\",format=\"png\")\n", | ||
"s" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 12, | ||
"id": "1b6faf0a-dd7a-46d3-acb8-3026c4e61414", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"image/svg+xml": [ | ||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n", | ||
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n", | ||
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n", | ||
"<!-- Generated by graphviz version 2.43.0 (0)\n", | ||
" -->\n", | ||
"<!-- Title: G Pages: 1 -->\n", | ||
"<svg width=\"479pt\" height=\"207pt\"\n", | ||
" viewBox=\"0.00 0.00 479.00 207.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n", | ||
"<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 203)\">\n", | ||
"<title>G</title>\n", | ||
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-203 475,-203 475,4 -4,4\"/>\n", | ||
"<g id=\"clust1\" class=\"cluster\">\n", | ||
"<title>cluster_0</title>\n", | ||
"<polygon fill=\"none\" stroke=\"black\" points=\"119,-8 119,-191 366,-191 366,-8 119,-8\"/>\n", | ||
"<text text-anchor=\"middle\" x=\"242.5\" y=\"-175.8\" font-family=\"Times,serif\" font-size=\"14.00\">ensemble</text>\n", | ||
"</g>\n", | ||
"<!-- a -->\n", | ||
"<g id=\"node1\" class=\"node\">\n", | ||
"<title>a</title>\n", | ||
"<text text-anchor=\"middle\" x=\"45.5\" y=\"-84.3\" font-family=\"Times,serif\" font-size=\"14.00\">input features</text>\n", | ||
"</g>\n", | ||
"<!-- b -->\n", | ||
"<g id=\"node2\" class=\"node\">\n", | ||
"<title>b</title>\n", | ||
"<polygon fill=\"none\" stroke=\"black\" points=\"244,-160 146,-160 146,-124 244,-124 244,-160\"/>\n", | ||
"<text text-anchor=\"middle\" x=\"195\" y=\"-138.3\" font-family=\"Times,serif\" font-size=\"14.00\">neural network</text>\n", | ||
"</g>\n", | ||
"<!-- a->b -->\n", | ||
"<g id=\"edge1\" class=\"edge\">\n", | ||
"<title>a->b</title>\n", | ||
"<path fill=\"none\" stroke=\"black\" d=\"M91.33,-104.78C100.48,-108.18 110.05,-111.72 119,-115 124.58,-117.04 130.39,-119.16 136.21,-121.27\"/>\n", | ||
"<polygon fill=\"black\" stroke=\"black\" points=\"135.37,-124.68 145.96,-124.79 137.75,-118.1 135.37,-124.68\"/>\n", | ||
"</g>\n", | ||
"<!-- c -->\n", | ||
"<g id=\"node3\" class=\"node\">\n", | ||
"<title>c</title>\n", | ||
"<polygon fill=\"none\" stroke=\"black\" points=\"241.5,-106 148.5,-106 148.5,-70 241.5,-70 241.5,-106\"/>\n", | ||
"<text text-anchor=\"middle\" x=\"195\" y=\"-84.3\" font-family=\"Times,serif\" font-size=\"14.00\">random forest</text>\n", | ||
"</g>\n", | ||
"<!-- a->c -->\n", | ||
"<g id=\"edge4\" class=\"edge\">\n", | ||
"<title>a->c</title>\n", | ||
"<path fill=\"none\" stroke=\"black\" d=\"M91.16,-88C106.04,-88 122.81,-88 138.42,-88\"/>\n", | ||
"<polygon fill=\"black\" stroke=\"black\" points=\"138.48,-91.5 148.48,-88 138.48,-84.5 138.48,-91.5\"/>\n", | ||
"</g>\n", | ||
"<!-- d -->\n", | ||
"<g id=\"node4\" class=\"node\">\n", | ||
"<title>d</title>\n", | ||
"<polygon fill=\"none\" stroke=\"black\" points=\"263,-52 127,-52 127,-16 263,-16 263,-52\"/>\n", | ||
"<text text-anchor=\"middle\" x=\"195\" y=\"-30.3\" font-family=\"Times,serif\" font-size=\"14.00\">gradient boosted trees</text>\n", | ||
"</g>\n", | ||
"<!-- a->d -->\n", | ||
"<g id=\"edge6\" class=\"edge\">\n", | ||
"<title>a->d</title>\n", | ||
"<path fill=\"none\" stroke=\"black\" d=\"M91.33,-71.22C100.48,-67.82 110.05,-64.28 119,-61 123.83,-59.23 128.84,-57.41 133.87,-55.58\"/>\n", | ||
"<polygon fill=\"black\" stroke=\"black\" points=\"135.33,-58.77 143.54,-52.08 132.95,-52.19 135.33,-58.77\"/>\n", | ||
"</g>\n", | ||
"<!-- e -->\n", | ||
"<g id=\"node5\" class=\"node\">\n", | ||
"<title>e</title>\n", | ||
"<polygon fill=\"none\" stroke=\"black\" points=\"358,-106 299,-106 299,-70 358,-70 358,-106\"/>\n", | ||
"<text text-anchor=\"middle\" x=\"328.5\" y=\"-84.3\" font-family=\"Times,serif\" font-size=\"14.00\">average</text>\n", | ||
"</g>\n", | ||
"<!-- b->e -->\n", | ||
"<g id=\"edge2\" class=\"edge\">\n", | ||
"<title>b->e</title>\n", | ||
"<path fill=\"none\" stroke=\"black\" d=\"M241.08,-123.93C248.42,-120.96 255.92,-117.91 263,-115 271.66,-111.44 280.95,-107.58 289.71,-103.92\"/>\n", | ||
"<polygon fill=\"black\" stroke=\"black\" points=\"291.09,-107.14 298.96,-100.04 288.38,-100.68 291.09,-107.14\"/>\n", | ||
"</g>\n", | ||
"<!-- c->e -->\n", | ||
"<g id=\"edge5\" class=\"edge\">\n", | ||
"<title>c->e</title>\n", | ||
"<path fill=\"none\" stroke=\"black\" d=\"M241.62,-88C256.9,-88 273.79,-88 288.52,-88\"/>\n", | ||
"<polygon fill=\"black\" stroke=\"black\" points=\"288.8,-91.5 298.8,-88 288.8,-84.5 288.8,-91.5\"/>\n", | ||
"</g>\n", | ||
"<!-- d->e -->\n", | ||
"<g id=\"edge7\" class=\"edge\">\n", | ||
"<title>d->e</title>\n", | ||
"<path fill=\"none\" stroke=\"black\" d=\"M241.08,-52.07C248.42,-55.04 255.92,-58.09 263,-61 271.66,-64.56 280.95,-68.42 289.71,-72.08\"/>\n", | ||
"<polygon fill=\"black\" stroke=\"black\" points=\"288.38,-75.32 298.96,-75.96 291.09,-68.86 288.38,-75.32\"/>\n", | ||
"</g>\n", | ||
"<!-- f -->\n", | ||
"<g id=\"node6\" class=\"node\">\n", | ||
"<title>f</title>\n", | ||
"<text text-anchor=\"middle\" x=\"432.5\" y=\"-84.3\" font-family=\"Times,serif\" font-size=\"14.00\">predictions</text>\n", | ||
"</g>\n", | ||
"<!-- e->f -->\n", | ||
"<g id=\"edge3\" class=\"edge\">\n", | ||
"<title>e->f</title>\n", | ||
"<path fill=\"none\" stroke=\"black\" d=\"M358.18,-88C366.15,-88 375.01,-88 383.75,-88\"/>\n", | ||
"<polygon fill=\"black\" stroke=\"black\" points=\"383.89,-91.5 393.89,-88 383.89,-84.5 383.89,-91.5\"/>\n", | ||
"</g>\n", | ||
"</g>\n", | ||
"</svg>\n" | ||
], | ||
"text/plain": [ | ||
"<graphviz.sources.Source at 0x7fa3346c4710>" | ||
] | ||
}, | ||
"execution_count": 12, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"s = Source(\"\"\"\n", | ||
"digraph G {\n", | ||
" graph [rankdir=LR];\n", | ||
" node [shape=plaintext];\n", | ||
" a [label=\"input features\"];\n", | ||
" subgraph cluster_0 {\n", | ||
" label=\"ensemble\";\n", | ||
" b [label=\"neural network\", shape=rect];\n", | ||
" c [label=\"random forest\", shape=rect];\n", | ||
" d [label=\"gradient boosted trees\", shape=rect];\n", | ||
" e [label=\"average\", shape=rect];\n", | ||
" }\n", | ||
" f [label=\"predictions\"];\n", | ||
" a -> b -> e -> f;\n", | ||
" a -> c -> e;\n", | ||
" a -> d -> e;\n", | ||
"}\n", | ||
"\"\"\")\n", | ||
"s.render(\"../image/tutorial/compose_with_tf_ensemble\",format=\"png\")\n", | ||
"s" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.8" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters