master-thesis/EvolutionaryAlgorithm/EvolutionaryAlgorithm.ipynb

2035 lines
90 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Evolutionary Algorithm"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
" <script type=\"text/javascript\">\n",
" window.PlotlyConfig = {MathJaxConfig: 'local'};\n",
" if (window.MathJax) {MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}\n",
" if (typeof require !== 'undefined') {\n",
" require.undef(\"plotly\");\n",
" requirejs.config({\n",
" paths: {\n",
" 'plotly': ['https://cdn.plot.ly/plotly-latest.min']\n",
" }\n",
" });\n",
" require(['plotly'], function(Plotly) {\n",
" window._Plotly = Plotly;\n",
" });\n",
" }\n",
" </script>\n",
" "
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
" <script type=\"text/javascript\">\n",
" window.PlotlyConfig = {MathJaxConfig: 'local'};\n",
" if (window.MathJax) {MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}\n",
" if (typeof require !== 'undefined') {\n",
" require.undef(\"plotly\");\n",
" requirejs.config({\n",
" paths: {\n",
" 'plotly': ['https://cdn.plot.ly/plotly-latest.min']\n",
" }\n",
" });\n",
" require(['plotly'], function(Plotly) {\n",
" window._Plotly = Plotly;\n",
" });\n",
" }\n",
" </script>\n",
" "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import sys\n",
"sys.path.append(\"../\")\n",
"sys.path.append(\"../RecipeAnalysis/\")\n",
"\n",
"import settings\n",
"\n",
"import pycrfsuite\n",
"\n",
"import json\n",
"\n",
"import db.db_settings as db_settings\n",
"from db.database_connection import DatabaseConnection\n",
"\n",
"from Tagging.conllu_generator import ConlluGenerator\n",
"from Tagging.crf_data_generator import *\n",
"\n",
"from RecipeAnalysis.Recipe import Ingredient\n",
"\n",
"from difflib import SequenceMatcher\n",
"\n",
"import numpy as np\n",
"\n",
"import plotly.graph_objs as go\n",
"from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot\n",
"from plotly.subplots import make_subplots\n",
"init_notebook_mode(connected=True)\n",
"\n",
"from graphviz import Digraph\n",
"\n",
"import itertools\n",
"\n",
"import random\n",
"\n",
"import plotly.io as pio\n",
"pio.renderers.default = \"jupyterlab\"\n",
"\n",
"from IPython.display import Markdown, HTML, display\n",
"\n",
"from copy import deepcopy"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## load adjacency matrices"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import pickle\n",
"m_act = pickle.load(open(\"m_act.pickle\", \"rb\"))\n",
"m_mix = pickle.load(open(\"m_mix.pickle\", \"rb\"))\n",
"m_base_act = pickle.load(open(\"m_base_act.pickle\", \"rb\"))\n",
"m_base_mix = pickle.load(open(\"m_base_mix.pickle\", \"rb\"))\n",
"\n",
"c_act = m_act.get_csr()\n",
"c_mix = m_mix.get_csr()\n",
"c_base_act = m_base_act.get_csr()\n",
"c_base_mix = m_base_mix.get_csr()\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"actions = m_act.get_labels()[0]"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"base_ingredients = m_base_mix.get_labels()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"sym_label_buffer = {}\n",
"fw_label_buffer = {}\n",
"bw_label_buffer = {}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### helper functions for adjacency matrices"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"def get_sym_adjacent(key, m, c):\n",
" index = m._label_index[key]\n",
" i1 = c[index,:].nonzero()[1]\n",
" i2 = c[:,index].nonzero()[0]\n",
" \n",
" i = np.concatenate((i1,i2))\n",
" \n",
" if m in sym_label_buffer:\n",
" names = sym_label_buffer[m][i]\n",
" else:\n",
" names = np.array(m.get_labels())\n",
" sym_label_buffer[m] = names\n",
" names = names[i]\n",
" \n",
" counts = np.concatenate((c[index, i1].toarray().flatten(), c[i2, index].toarray().flatten()))\n",
" \n",
" s = np.argsort(-counts)\n",
" \n",
" return names[s], counts[s]"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"def get_forward_adjacent(key, m, c):\n",
" index = m._x_label_index[key]\n",
" i = c[index,:].nonzero()[1]\n",
" \n",
" if m in fw_label_buffer:\n",
" names = fw_label_buffer[m][i]\n",
" else:\n",
" names = np.array(m._y_labels)\n",
" fw_label_buffer[m] = names\n",
" names = names[i]\n",
" \n",
" \n",
" counts = c[index, i].toarray().flatten()\n",
" \n",
" s = np.argsort(-counts)\n",
" \n",
" return names[s], counts[s]"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"def get_backward_adjacent(key, m, c):\n",
" index = m._y_label_index[key]\n",
" i = c[:,index].nonzero()[0]\n",
" \n",
" if m in bw_label_buffer:\n",
" names = bw_label_buffer[m][i]\n",
" else:\n",
" names = np.array(m._x_labels)\n",
" bw_label_buffer[m] = names\n",
" names = names[i]\n",
" \n",
" \n",
" counts = c[i, index].toarray().flatten()\n",
" \n",
" s = np.argsort(-counts)\n",
" \n",
" return names[s], counts[s]"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(array(['heat', 'simmer', 'cook', 'bake', 'boil', 'place', 'cut', 'slice',\n",
" 'chop', 'dice', 'pour', 'drain', 'cool', 'refrigerate', 'thicken',\n",
" 'warm', 'chill', 'brown', 'blend', 'spread', 'grill', 'fry',\n",
" 'saute', 'mash', 'melt', 'whisk', 'peel', 'freeze', 'wash',\n",
" 'grate', 'squeeze', 'broil', 'marinate', 'skim', 'soak', 'mince',\n",
" 'break', 'open', 'sour', 'thaw', 'beat', 'wipe', 'carve', 'curdle'],\n",
" dtype='<U11'),\n",
" array([141, 116, 108, 67, 62, 50, 42, 40, 35, 28, 26, 26, 25,\n",
" 25, 20, 19, 17, 16, 15, 13, 12, 10, 10, 8, 7, 7,\n",
" 6, 6, 5, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1,\n",
" 1, 1, 1, 1, 1]))"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"get_backward_adjacent(\"tomato\", m_base_act, c_base_act)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(array(['cook', 'heat', 'simmer', 'boil', 'bake', 'place', 'cool', 'brown',\n",
" 'warm', 'drain', 'pour', 'spread', 'cut', 'chill', 'chop',\n",
" 'refrigerate', 'steam', 'soak', 'thicken', 'rinse', 'fry', 'wash',\n",
" 'blend', 'saute', 'freeze', 'slice', 'thaw', 'break', 'melt',\n",
" 'whisk', 'open', 'whip', 'scorch', 'peel', 'burn', 'baste',\n",
" 'broil', 'marinate', 'squeeze', 'skim', 'grind'], dtype='<U11'),\n",
" array([121, 108, 61, 47, 42, 38, 27, 26, 20, 18, 16, 14, 13,\n",
" 13, 10, 10, 8, 8, 8, 7, 7, 6, 5, 5, 4, 4,\n",
" 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,\n",
" 1, 1]))"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"get_backward_adjacent(\"rice\", m_base_act, c_base_act)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"def sym_sum(key, m, c):\n",
" return np.sum(get_sym_adjacent(key,m,c)[1])\n",
"\n",
"def fw_sum(key, m, c):\n",
" return np.sum(get_forward_adjacent(key,m,c)[1])\n",
"\n",
"def bw_sum(key, m, c):\n",
" return np.sum(get_backward_adjacent(key,m,c)[1])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### different score functions"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### normalizations"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"def fw_normalization_factor(key, m, c, quotient_func):\n",
" ia = m._x_label_index[key]\n",
" \n",
" occurances = c[ia,:].nonzero()[1]\n",
" \n",
" return 1. / quotient_func(c[ia,occurances].toarray())\n",
"\n",
"def bw_normalization_factor(key, m, c, quotient_func):\n",
" ib = m._y_label_index[key]\n",
" \n",
" occurances = c[:,ib].nonzero()[0]\n",
" \n",
" return 1. / quotient_func(c[occurances,ib].toarray())\n",
"\n",
"def sym_normalization_factor(key, m, c, quotient_func):\n",
" ii = m._label_index[key]\n",
" \n",
" fw_occurances = c[ii,:].nonzero()[1]\n",
" bw_occurances = c[:,ii].nonzero()[0]\n",
" \n",
" return 1. / quotient_func(np.concatenate(\n",
" [c[ii,fw_occurances].toarray().flatten(),\n",
" c[bw_occurances,ii].toarray().flatten()]\n",
" ))"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"def sym_p_a_given_b(key_a, key_b, m, c, quot_func = np.max):\n",
" ia = m._label_index[key_a]\n",
" ib = m._label_index[key_b]\n",
" \n",
" v = c[ia,ib] + c[ib,ia]\n",
" \n",
" return v * sym_normalization_factor(key_b, m, c, quot_func)\n",
"\n",
"def fw_p_a_given_b(key_a, key_b, m, c, quot_func = np.max):\n",
" ia = m._x_label_index[key_a]\n",
" ib = m._y_label_index[key_b]\n",
" \n",
" v = c[ia,ib]\n",
" \n",
" return v * bw_normalization_factor(key_b, m, c, quot_func)\n",
"\n",
"def bw_p_a_given_b(key_a, key_b, m, c, quot_func = np.max):\n",
" ia = m._y_label_index[key_a]\n",
" ib = m._x_label_index[key_b]\n",
" \n",
" v = c[ib,ia]\n",
" \n",
" return v * fw_normalization_factor(key_b, m, c, quot_func)\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"def sym_score(key_a, key_b, m, c):\n",
"\n",
" ia = m._label_index[key_a]\n",
" ib = m._label_index[key_b]\n",
" \n",
" v = c[ia,ib] + c[ib,ia]\n",
" \n",
" if v == 0:\n",
" return 0\n",
" \n",
" return max((v/sym_sum(key_a, m, c)), (v/sym_sum(key_b, m, c)))\n",
"\n",
"def asym_score(key_a, key_b, m, c):\n",
" ia = m._x_label_index[key_a]\n",
" ib = m._y_label_index[key_b]\n",
" \n",
" v = c[ia,ib]\n",
" \n",
" if v == 0:\n",
" return 0\n",
" \n",
" return max(v/fw_sum(key_a, m, c), v/bw_sum(key_b, m, c))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Recipe Tree\n",
"### Tree Node Base Class"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"class RecipeTreeNode(object):\n",
" \n",
" id = 0\n",
" \n",
" def __init__(self, name, constant=False, single_child=False):\n",
" self._constant = constant\n",
" self._name = name\n",
" self._parent = None\n",
" \n",
" self._id = str(RecipeTreeNode.id)\n",
" RecipeTreeNode.id += 1\n",
" \n",
" self._single_child = single_child\n",
" \n",
" if self._single_child:\n",
" self._child = None\n",
" \n",
" def child():\n",
" return self._child\n",
" \n",
" def remove_child(c):\n",
" assert c == self._child\n",
" self._child._parent = None\n",
" self._child = None\n",
" \n",
" def childs():\n",
" c = self.child()\n",
" if c is None:\n",
" return set()\n",
" return set([c])\n",
" \n",
" def add_child(n):\n",
" self._child = n\n",
" n._parent = self\n",
" \n",
" self.child = child\n",
" self.childs = childs\n",
" self.add_child = add_child\n",
" self.remove_child = remove_child\n",
" else:\n",
" self._childs = set()\n",
" \n",
" def childs():\n",
" return self._childs\n",
" \n",
" def add_child(n):\n",
" self._childs.add(n)\n",
" n._parent = self\n",
" \n",
" def remove_child(c):\n",
" assert c in self._childs\n",
" c._parent = None\n",
" self._childs.remove(c)\n",
" \n",
" self.childs = childs\n",
" self.add_child = add_child\n",
" self.remove_child = remove_child\n",
" \n",
" def parent(self):\n",
" return self._parent\n",
" \n",
" def name(self):\n",
" return self._name\n",
" \n",
" def traverse(self):\n",
" l = []\n",
" \n",
" for c in self.childs():\n",
" l += c.traverse()\n",
" \n",
" return [self] + l\n",
" \n",
" def traverse_ingredients(self):\n",
" ingredient_set = []\n",
" for c in self.childs():\n",
" ingredient_set += c.traverse_ingredients()\n",
" \n",
" return ingredient_set\n",
" \n",
" def remove(self):\n",
" p = self.parent()\n",
" childs = self.childs().copy()\n",
" \n",
" assert p is None or not (len(childs) > 1 and p._single_child)\n",
" \n",
" for c in childs:\n",
" self.remove_child(c)\n",
" \n",
" if p is not None:\n",
" p.remove_child(self)\n",
" \n",
" if self._single_child and self._child is not None and p._name == self._child._name:\n",
" # two adjacent nodes with same name would remain after deletion.\n",
" # merge them! (by adding the child's childs to our parent instead of our childs)\n",
" childs = self._child.childs()\n",
" self._child.remove()\n",
" \n",
" \n",
" for c in childs:\n",
" p.add_child(c)\n",
" \n",
" def insert_before(self, n):\n",
" p = self._parent\n",
" if p is not None:\n",
" p.remove_child(self)\n",
" p.add_child(n)\n",
" n.add_child(self)\n",
" \n",
" def mutate(self):\n",
" n_node = self.n_node_mutate_options()\n",
" n_edge = self.n_edge_mutate_options()\n",
" \n",
" choice = random.choice(range(n_node + n_edge))\n",
" if choice < n_node:\n",
" self.mutate_node()\n",
" else:\n",
" self.mutate_edges()\n",
" \n",
" def mutate_edges(self):\n",
" ings = self.traverse_ingredients()\n",
" ing = random.choice(ings)\n",
" \n",
" a, w = get_backward_adjacent(ing._base_ingredient, m_base_act, c_base_act)\n",
" \n",
" action = random.choices(a, w)[0]\n",
" self.insert_before(ActionNode(action))\n",
" \n",
" def mutate_node(self):\n",
" raise NotImplementedError\n",
" \n",
" def n_node_mutate_options(self):\n",
" \n",
" return 0 if self._constant else 1\n",
" \n",
" def n_edge_mutate_options(self):\n",
" n = 1 if self._parent is not None else 0\n",
" return n\n",
" \n",
" def n_mutate_options(self):\n",
" return self.n_edge_mutate_options() + self.n_node_mutate_options()\n",
" \n",
" def dot_node(self, dot):\n",
" raise NotImplementedError()\n",
" \n",
" def dot(self, d=None):\n",
" if d is None:\n",
" d = Digraph()\n",
" self.dot_node(d)\n",
" \n",
" else:\n",
" self.dot_node(d)\n",
" if self._parent is not None:\n",
" d.edge(self._parent._id, self._id)\n",
" \n",
" \n",
" for c in self.childs():\n",
" c.dot(d)\n",
" \n",
" return d\n",
" \n",
" def serialize(self):\n",
" r = {}\n",
" r['type'] = str(self.__class__.__name__)\n",
" r['id'] = self._id\n",
" r['parent'] = self._parent._id if self._parent is not None else None\n",
" r['name'] = self._name\n",
" r['childs'] = [c._id for c in self.childs()]\n",
" r['constant'] = self._constant\n",
" r['single_child'] = self._single_child\n",
" \n",
" return r\n",
" \n",
" def node_score(self):\n",
" raise NotImplementedError()\n",
" \n",
" "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Mix Node"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
"class MixNode(RecipeTreeNode):\n",
" def __init__(self, constant=False):\n",
" super().__init__(\"mix\", constant, single_child=False)\n",
" \n",
" def dot_node(self, dot):\n",
" dot.node(self._id, label=f\"< <B>{self._name}</B><BR/>node score: {self.node_score()}>\", shape=\"diamond\")\n",
" \n",
" def split(self, set_above, set_below, node_between):\n",
" assert len(set_above.difference(self.childs())) == 0\n",
" assert len(set_below.difference(self.childs())) == 0\n",
" \n",
" n_above = MixNode()\n",
" n_below = MixNode()\n",
" \n",
" p = self.parent()\n",
" \n",
" for c in self.childs().copy():\n",
" self.remove_child(c)\n",
" self.remove()\n",
" \n",
" for c in set_below:\n",
" n_below.add_child(c)\n",
" \n",
" for c in set_above:\n",
" n_above.add_child(c)\n",
" \n",
" n_above.add_child(node_between)\n",
" node_between.add_child(n_below)\n",
" \n",
" if p is not None:\n",
" p.add_child(n_above)\n",
" \n",
" # test whether the mix nodes are useless\n",
" if len(n_above.childs()) == 1:\n",
" n_above.remove()\n",
" \n",
" if len(n_below.childs()) == 1:\n",
" n_below.remove()\n",
" \n",
" def n_node_mutate_options(self):\n",
" return 0 if self._constant or len(self.childs()) <= 2 else len(self.childs())\n",
" \n",
" def mutate_node(self):\n",
" \n",
" childs = self.childs()\n",
" \n",
" if len(childs) <= 2:\n",
" print(\"Warning: cannot modify mix node\")\n",
" return\n",
" \n",
" childs = random.sample(childs, len(childs))\n",
" \n",
" n = random.choice(range(1, len(childs)-1))\n",
" \n",
" between_node = ActionNode(random.choice(actions))\n",
" \n",
" self.split(set(childs[:n]), set(childs[n:]), between_node)\n",
" \n",
" \n",
" def node_score(self):\n",
" child_ingredients = [c.traverse_ingredients() for c in self.childs()]\n",
" \n",
" tmp_set = set()\n",
" cumulative_sets = []\n",
" \n",
" pairwise_tuples = []\n",
" \n",
" for c in child_ingredients:\n",
" if len(tmp_set) > 0:\n",
" cumulative_sets.append(tmp_set)\n",
" pairwise_tuples += [x for x in itertools.product(tmp_set, c)]\n",
" tmp_set = tmp_set.union(set(c))\n",
" \n",
" s_base = 0\n",
" s = 0\n",
" \n",
" for ing_a, ing_b in pairwise_tuples:\n",
" try:\n",
" #s_base += sym_score(ing_a._base_ingredient, ing_b._base_ingredient, m_base_mix, c_base_mix)\n",
" \n",
" #s += sym_score(ing_a.to_json(), ing_b.to_json(), m_mix, c_mix)\n",
" p1 = sym_p_a_given_b(ing_a.to_json(), ing_b.to_json(), m_mix, c_mix)\n",
" p2 = sym_p_a_given_b(ing_b.to_json(), ing_a.to_json(), m_mix, c_mix)\n",
" \n",
" s += 0.5 * p1 + 0.5 * p2\n",
" \n",
" except:\n",
" pass\n",
" \n",
" #s_base /= len(pairwise_tuples)\n",
" s /= len(pairwise_tuples)\n",
" \n",
" #return 0.5 * (s_base + s)\n",
" return s\n",
" \n",
" \n",
" \n",
" "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Ingredient Node Class"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"class IngredientNode(RecipeTreeNode):\n",
" def __init__(self, name, constant=False):\n",
" super().__init__(name, constant, single_child=True)\n",
" \n",
" def get_actions(self):\n",
" a_list = []\n",
" n = self.parent()\n",
" while n is not None:\n",
" if type(n) == ActionNode:\n",
" a_list.append(n.name())\n",
" n = n.parent()\n",
" return a_list\n",
" \n",
" def mutate_node(self):\n",
" self._name = random.choice(base_ingredients)\n",
" #TODO: change w.r.t. mixing probabilities \n",
" \n",
" def traverse_ingredients(self):\n",
" return [Ingredient(self._name)]\n",
" \n",
" def node_score(self):\n",
" actions = self.get_actions()\n",
" \n",
" if len(actions) == 0:\n",
" return 1\n",
" \n",
" seen_actions = set()\n",
" n_duplicates = 0\n",
" for act in actions:\n",
" if act in seen_actions:\n",
" n_duplicates += 1\n",
" else:\n",
" seen_actions.add(act)\n",
" \n",
" return len(seen_actions) / len(actions)\n",
" \n",
" \n",
" def dot_node(self, dot):\n",
" dot.node(self._id, label=f\"< <B>{self._name}</B><BR/>node score:{self.node_score()}>\", shape=\"box\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Action Node Class"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"class ActionNode(RecipeTreeNode):\n",
" def __init__(self, name, constant=False):\n",
" super().__init__(name, constant, single_child=True)\n",
" \n",
" def n_node_mutate_options(self):\n",
" # beacause we can change or remove ourselve!\n",
" return 0 if self._constant else 2 \n",
" def mutate_node(self):\n",
" if random.choice(range(2)) == 0:\n",
" # change action\n",
" self._name = random.choice(actions)\n",
" else:\n",
" # delete\n",
" self.remove()\n",
" \n",
" def traverse_ingredients(self):\n",
" ingredient_set = super().traverse_ingredients()\n",
" for ing in ingredient_set:\n",
" ing.apply_action(self._name)\n",
" \n",
" return ingredient_set\n",
" \n",
" def node_score(self):\n",
" ings = self.child().traverse_ingredients()\n",
" \n",
" s = 0\n",
" \n",
" for ing in ings:\n",
" try:\n",
" #score = asym_score(self._name, ing.to_json(), m_act, c_act)\n",
" #base_score = asym_score(self._name, ing._base_ingredient, m_base_act, c_base_act)\n",
" \n",
" score = fw_p_a_given_b(self._name, ing._base_ingredient, m_base_act, c_base_act)\n",
" \n",
" s += score\n",
" except KeyError as e:\n",
" pass\n",
" \n",
" \n",
" return s / len(ings)\n",
" \n",
" def dot_node(self, dot):\n",
" dot.node(self._id, label=f\"< <B>{self._name}</B><BR/>node score: {self.node_score()}>\", shape=\"ellipse\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Tree Class"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"class Tree(object):\n",
" \n",
" @staticmethod\n",
" def from_ingredients(ingredients: list):\n",
" root = MixNode()\n",
" \n",
" for ing in ingredients:\n",
" root.add_child(IngredientNode(ing, constant=True))\n",
" \n",
" return Tree(root)\n",
" \n",
" @staticmethod\n",
" def from_serialization(s):\n",
" def empty_node(raw_n):\n",
" if raw_n['type'] == \"MixNode\":\n",
" node = MixNode(raw_n['constant'])\n",
" elif raw_n['type'] == \"IngredientNode\":\n",
" node = IngredientNode(raw_n['name'], raw_n['constant'])\n",
" elif raw_n['type'] == \"ActionNode\":\n",
" node = ActionNode(raw_n['name'], raw_n['constant'])\n",
" else:\n",
" print(\"unknown node detected\")\n",
" return\n",
" \n",
" return node\n",
" \n",
" nodes = {}\n",
" for n in s:\n",
" nodes[n['id']] = empty_node(n)\n",
" \n",
" for n in s:\n",
" childs = n['childs']\n",
" id = n['id']\n",
" for c in childs:\n",
" nodes[id].add_child(nodes[c])\n",
" \n",
" return Tree(nodes[s[0]['id']])\n",
" \n",
" \n",
" def __init__(self, root):\n",
" # create a dummy entry node\n",
" self._root = RecipeTreeNode(\"root\", single_child=True)\n",
" self._root.add_child(root)\n",
" \n",
" def root(self):\n",
" return self._root.child()\n",
" \n",
" def mutate(self):\n",
" nodes = self.root().traverse()\n",
" weights = [n.n_mutate_options() for n in nodes]\n",
" \n",
" n = random.choices(nodes, weights)[0]\n",
" \n",
" n.mutate()\n",
" \n",
" def dot(self):\n",
" return self.root().dot()\n",
" \n",
" def serialize(self):\n",
" return [n.serialize() for n in self.root().traverse()]\n",
" \n",
" def structure_score(self):\n",
" n_duplicates = 0\n",
" \n",
" \n",
" def collect_scores(self):\n",
" self._mix_scores = []\n",
" self._act_scores = []\n",
" self._ing_scores = []\n",
" \n",
" nodes = self.root().traverse()\n",
" self._n_mix_nodes = 0\n",
" self._n_act_nodes = 0\n",
" self._n_ing_nodes = 0\n",
" \n",
" s = 0\n",
" for n in nodes:\n",
" if type(n) == MixNode:\n",
" self._mix_scores.append(n.node_score())\n",
" self._n_mix_nodes += 1\n",
" if type(n) == ActionNode:\n",
" self._act_scores.append(n.node_score())\n",
" self._n_act_nodes += 1\n",
" if type(n) == IngredientNode:\n",
" self._ing_scores.append(n.node_score())\n",
" self._n_ing_nodes += 1\n",
" \n",
" self._n_duplicates = 0\n",
" seen_actions = set()\n",
" \n",
" for n in nodes:\n",
" if type(n) == ActionNode:\n",
" if n.name() in seen_actions:\n",
" self._n_duplicates += 1\n",
" else:\n",
" seen_actions.add(n.name())\n",
" \n",
" self._mix_scores = np.array(self._mix_scores)\n",
" self._act_scores = np.array(self._act_scores)\n",
" self._ing_scores = np.array(self._ing_scores)\n",
" \n",
" \n",
" def mix_scores(self):\n",
" return self._mix_scores\n",
" \n",
" def action_scores(self):\n",
" return self._act_scores\n",
" \n",
" def ing_scores(self):\n",
" return self._ing_scores\n",
" \n",
" def bounds_mix_scores(self):\n",
" \n",
" nonzeros = self._mix_scores[self._mix_scores > 0]\n",
" if len(nonzeros) > 0:\n",
" mmax = np.max(nonzeros)\n",
" mmin = np.min(nonzeros)\n",
" return mmin, mmax\n",
" else:\n",
" return None, None\n",
" \n",
" def bounds_act_scores(self):\n",
" \n",
" if len(self._act_scores) == 0:\n",
" return None, None\n",
" nonzeros = self._act_scores[self._act_scores > 0]\n",
" if len(nonzeros) > 0:\n",
" mmax = np.max(nonzeros)\n",
" mmin = np.min(nonzeros)\n",
" return mmin, mmax\n",
" else:\n",
" return None, None\n",
" \n",
" def normalized_mix_scores(self, min, max):\n",
" if (max != min):\n",
" normalized = (self._mix_scores - min)/(max-min)\n",
" normalized[normalized <= 0] = 0\n",
" return normalized\n",
" else:\n",
" return None\n",
" \n",
" def normalized_act_scores(self, min, max):\n",
" if len(self._act_scores) == 0 or max == min:\n",
" return None\n",
" normalized = (self._act_scores - min)/(max-min)\n",
" normalized[normalized <= 0] = 0\n",
" return normalized\n",
" \n",
" def copy(self):\n",
" return Tree.from_serialization(self.serialize())\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Population"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"class Population(object):\n",
" def __init__(self, start_ingredients, n_population = 10):\n",
" self.population = [Tree.from_ingredients(start_ingredients) for i in range(n_population)]\n",
" self._n = n_population\n",
" self._mix_min = None\n",
" self._mix_max = None\n",
" self._act_min = None\n",
" self._act_max = None\n",
" self._mix_scores = None\n",
" self._act_scores = None\n",
" self._scores = None\n",
" \n",
" def mutate(self):\n",
" for tree in self.population.copy():\n",
" t_clone = tree.copy()\n",
" t_clone.mutate()\n",
" self.population.append(t_clone)\n",
" \n",
" def pairwise_competition(self):\n",
" new_population = []\n",
" indices = list(range(len(self.population)))\n",
" random.shuffle(indices)\n",
" \n",
" for i in range(len(self.population) // 2):\n",
" i_a = indices[2*i]\n",
" i_b = indices[2*i+1]\n",
" \n",
" if self._scores[i_a] > self._scores[i_b]:\n",
" new_population.append(self.population[i_a])\n",
" else:\n",
" new_population.append(self.population[i_b])\n",
" \n",
" self.population = new_population\n",
" \n",
" def hold_best(self, n=10):\n",
" sorted_indices = np.argsort(-self._scores)\n",
" \n",
" self.population = np.array(self.population)[sorted_indices[:n]].tolist()\n",
" \n",
" def analyse_scores(self):\n",
" for tree in self.population:\n",
" min, max = tree.bounds_mix_scores()\n",
" if min is not None and max is not None:\n",
" if self._mix_min is None or min < self._mix_min:\n",
" self._mix_min = min\n",
" if self._mix_max is None or max > self._mix_max:\n",
" self._mix_max = max\n",
" \n",
" min, max = tree.bounds_act_scores()\n",
" if min is not None and max is not None:\n",
" if self._act_min is None or min < self._act_min:\n",
" self._act_min = min\n",
" if self._act_max is None or max > self._act_max:\n",
" self._act_max = max\n",
" \n",
" def single_score(self, mix_scores, act_scores, ing_scores):\n",
" if mix_scores is None or act_scores is None or ing_scores is None:\n",
" return 0\n",
" return np.average(mix_scores) * np.average(act_scores) * np.average(ing_scores)\n",
" \n",
" \n",
" \n",
" def collect_scores(self):\n",
" for tree in self.population:\n",
" tree.collect_scores()\n",
" \n",
" self.analyse_scores()\n",
" \n",
" if self._mix_min is not None and self._mix_max is not None:\n",
" self._mix_scores = [t.normalized_mix_scores(self._mix_min, self._mix_max) for t in self.population]\n",
" else:\n",
" # if no normalization can be done, all values are the same or 0.\n",
" # in this case just fill in zeros as score\n",
" self._mix_scores = [np.zeros(shape=t._mix_scores.shape) for t in self.population]\n",
" \n",
" if self._act_min is not None and self._act_max is not None:\n",
" self._act_scores = [t.normalized_act_scores(self._act_min, self._act_max) for t in self.population]\n",
" else:\n",
" self._act_scores = [np.zeros(shape=t._act_scores) for t in self.population]\n",
" \n",
" self._scores = []\n",
" for i in range(len(self._mix_scores)):\n",
" #print (self._mix_scores[i], self._act_scores[i])\n",
" if self._act_scores is None or self._mix_scores is None or self._act_scores[i] is None:\n",
" self._scores.append(0)\n",
" continue\n",
" \n",
" self._scores.append(self.single_score(self._mix_scores[i], self._act_scores[i], self.population[i].ing_scores()))\n",
" self._scores = np.array(self._scores)\n",
" \n",
" def run(self, n=50):\n",
" for i in range(n):\n",
" print(i)\n",
" self.mutate()\n",
" self.mutate()\n",
" self.collect_scores()\n",
" #self.pairwise_competition()\n",
" #self.collect_scores()\n",
" self.hold_best(self._n)\n",
" \n",
" \n",
" \n",
" def plot_population(self):\n",
" self.collect_scores()\n",
" #print(self._mix_scores)\n",
" #print(self._act_scores)\n",
" #print(self._scores)\n",
" for i, t in enumerate(self.population):\n",
" print(self._scores[i])\n",
" display(t.root().dot())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Run Evolutionary Algorithm"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
"p = Population([\"tomato\",\"onion\"])"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0\n"
]
}
],
"source": [
"p.run(1)"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.3304126483795514\n"
]
},
{
"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.40.1 (20161225.0304)\n",
" -->\n",
"<!-- Title: %3 Pages: 1 -->\n",
"<svg width=\"462pt\" height=\"326pt\"\n",
" viewBox=\"0.00 0.00 462.08 325.82\" 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 321.8234)\">\n",
"<title>%3</title>\n",
"<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-321.8234 458.0782,-321.8234 458.0782,4 -4,4\"/>\n",
"<!-- 152 -->\n",
"<g id=\"node1\" class=\"node\">\n",
"<title>152</title>\n",
"<ellipse fill=\"none\" stroke=\"#000000\" cx=\"253.0782\" cy=\"-292.3675\" rx=\"142.257\" ry=\"25.4118\"/>\n",
"<text text-anchor=\"start\" x=\"237.0782\" y=\"-296.1675\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"241.0782\" y=\"-296.1675\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">bake</text>\n",
"<text text-anchor=\"start\" x=\"160.5782\" y=\"-282.1675\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score: 0.4546361041518653</text>\n",
"</g>\n",
"<!-- 153 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>153</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"253.0782,-230.9117 52.0782,-194.9117 253.0782,-158.9117 454.0782,-194.9117 253.0782,-230.9117\"/>\n",
"<text text-anchor=\"start\" x=\"239.5782\" y=\"-198.7117\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"243.5782\" y=\"-198.7117\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">mix</text>\n",
"<text text-anchor=\"start\" x=\"160.5782\" y=\"-184.7117\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score: 0.3897435897435897</text>\n",
"</g>\n",
"<!-- 152&#45;&gt;153 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>152&#45;&gt;153</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M253.0782,-266.7622C253.0782,-258.8985 253.0782,-249.989 253.0782,-241.1865\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"256.5783,-240.9713 253.0782,-230.9713 249.5783,-240.9714 256.5783,-240.9713\"/>\n",
"</g>\n",
"<!-- 157 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>157</title>\n",
"<ellipse fill=\"none\" stroke=\"#000000\" cx=\"147.0782\" cy=\"-97.4558\" rx=\"147.1565\" ry=\"25.4118\"/>\n",
"<text text-anchor=\"start\" x=\"131.0782\" y=\"-101.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"135.0782\" y=\"-101.2558\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">chop</text>\n",
"<text text-anchor=\"start\" x=\"51.0782\" y=\"-87.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score: 0.21089630931458697</text>\n",
"</g>\n",
"<!-- 153&#45;&gt;157 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>153&#45;&gt;157</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M220.1202,-164.6103C207.9406,-153.4124 194.105,-140.692 181.7758,-129.3566\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"184.0525,-126.6953 174.3221,-122.5037 179.3147,-131.8484 184.0525,-126.6953\"/>\n",
"</g>\n",
"<!-- 155 -->\n",
"<g id=\"node5\" class=\"node\">\n",
"<title>155</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"408.0782,-115.4558 312.0782,-115.4558 312.0782,-79.4558 408.0782,-79.4558 408.0782,-115.4558\"/>\n",
"<text text-anchor=\"start\" x=\"337.0782\" y=\"-101.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"341.0782\" y=\"-101.2558\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">tomato</text>\n",
"<text text-anchor=\"start\" x=\"320.0782\" y=\"-87.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score:1.0</text>\n",
"</g>\n",
"<!-- 153&#45;&gt;155 -->\n",
"<g id=\"edge4\" class=\"edge\">\n",
"<title>153&#45;&gt;155</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M286.3471,-164.6103C301.2547,-151.0325 318.6199,-135.2162 332.752,-122.3446\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"335.198,-124.8509 340.2344,-115.5297 330.4844,-119.6758 335.198,-124.8509\"/>\n",
"</g>\n",
"<!-- 154 -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>154</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"195.0782,-36 99.0782,-36 99.0782,0 195.0782,0 195.0782,-36\"/>\n",
"<text text-anchor=\"start\" x=\"128.5782\" y=\"-21.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"132.5782\" y=\"-21.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">onion</text>\n",
"<text text-anchor=\"start\" x=\"107.0782\" y=\"-7.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score:1.0</text>\n",
"</g>\n",
"<!-- 157&#45;&gt;154 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>157&#45;&gt;154</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M147.0782,-71.8782C147.0782,-63.7122 147.0782,-54.6289 147.0782,-46.2824\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"150.5783,-46.2287 147.0782,-36.2288 143.5783,-46.2288 150.5783,-46.2287\"/>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<graphviz.dot.Digraph at 0x7fdb17b04278>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.28606469692626313\n"
]
},
{
"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.40.1 (20161225.0304)\n",
" -->\n",
"<!-- Title: %3 Pages: 1 -->\n",
"<svg width=\"424pt\" height=\"239pt\"\n",
" viewBox=\"0.00 0.00 424.00 238.91\" 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 234.9117)\">\n",
"<title>%3</title>\n",
"<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-234.9117 420,-234.9117 420,4 -4,4\"/>\n",
"<!-- 139 -->\n",
"<g id=\"node1\" class=\"node\">\n",
"<title>139</title>\n",
"<ellipse fill=\"none\" stroke=\"#000000\" cx=\"208\" cy=\"-205.4558\" rx=\"142.257\" ry=\"25.4118\"/>\n",
"<text text-anchor=\"start\" x=\"192\" y=\"-209.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"196\" y=\"-209.2558\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">cook</text>\n",
"<text text-anchor=\"start\" x=\"115.5\" y=\"-195.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score: 0.8829787234042552</text>\n",
"</g>\n",
"<!-- 135 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>135</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"208,-144 0,-108 208,-72 416,-108 208,-144\"/>\n",
"<text text-anchor=\"start\" x=\"194.5\" y=\"-111.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"198.5\" y=\"-111.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">mix</text>\n",
"<text text-anchor=\"start\" x=\"112\" y=\"-97.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score: 0.20029027576197386</text>\n",
"</g>\n",
"<!-- 139&#45;&gt;135 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>139&#45;&gt;135</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M208,-179.8505C208,-171.9868 208,-163.0773 208,-154.2748\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"211.5001,-154.0596 208,-144.0596 204.5001,-154.0597 211.5001,-154.0596\"/>\n",
"</g>\n",
"<!-- 137 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>137</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"199,-36 103,-36 103,0 199,0 199,-36\"/>\n",
"<text text-anchor=\"start\" x=\"132.5\" y=\"-21.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"136.5\" y=\"-21.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">onion</text>\n",
"<text text-anchor=\"start\" x=\"111\" y=\"-7.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score:1.0</text>\n",
"</g>\n",
"<!-- 135&#45;&gt;137 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>135&#45;&gt;137</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M187.4217,-75.5079C180.9762,-65.3309 173.9435,-54.2266 167.7918,-44.5133\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"170.7394,-42.626 162.432,-36.0505 164.8257,-46.3714 170.7394,-42.626\"/>\n",
"</g>\n",
"<!-- 136 -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>136</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"313,-36 217,-36 217,0 313,0 313,-36\"/>\n",
"<text text-anchor=\"start\" x=\"242\" y=\"-21.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"246\" y=\"-21.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">tomato</text>\n",
"<text text-anchor=\"start\" x=\"225\" y=\"-7.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score:1.0</text>\n",
"</g>\n",
"<!-- 135&#45;&gt;136 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>135&#45;&gt;136</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M228.5783,-75.5079C235.0238,-65.3309 242.0565,-54.2266 248.2082,-44.5133\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"251.1743,-46.3714 253.568,-36.0505 245.2606,-42.626 251.1743,-46.3714\"/>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<graphviz.dot.Digraph at 0x7fdb17b0cf28>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.2081128747795414\n"
]
},
{
"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.40.1 (20161225.0304)\n",
" -->\n",
"<!-- Title: %3 Pages: 1 -->\n",
"<svg width=\"460pt\" height=\"239pt\"\n",
" viewBox=\"0.00 0.00 460.08 238.91\" 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 234.9117)\">\n",
"<title>%3</title>\n",
"<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-234.9117 456.0782,-234.9117 456.0782,4 -4,4\"/>\n",
"<!-- 185 -->\n",
"<g id=\"node1\" class=\"node\">\n",
"<title>185</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"201,-230.9117 0,-194.9117 201,-158.9117 402,-194.9117 201,-230.9117\"/>\n",
"<text text-anchor=\"start\" x=\"187.5\" y=\"-198.7117\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"191.5\" y=\"-198.7117\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">mix</text>\n",
"<text text-anchor=\"start\" x=\"108.5\" y=\"-184.7117\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score: 0.3897435897435897</text>\n",
"</g>\n",
"<!-- 188 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>188</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"140,-115.4558 54,-115.4558 54,-79.4558 140,-79.4558 140,-115.4558\"/>\n",
"<text text-anchor=\"start\" x=\"74\" y=\"-101.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"78\" y=\"-101.2558\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">tomato</text>\n",
"<text text-anchor=\"start\" x=\"62\" y=\"-87.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score:1</text>\n",
"</g>\n",
"<!-- 185&#45;&gt;188 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>185&#45;&gt;188</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M168.6638,-164.6103C154.3084,-151.1582 137.6083,-135.5089 123.9424,-122.7029\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"125.9776,-119.8135 116.2875,-115.5297 121.1912,-124.9214 125.9776,-119.8135\"/>\n",
"</g>\n",
"<!-- 186 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>186</title>\n",
"<ellipse fill=\"none\" stroke=\"#000000\" cx=\"305\" cy=\"-97.4558\" rx=\"147.1565\" ry=\"25.4118\"/>\n",
"<text text-anchor=\"start\" x=\"289\" y=\"-101.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"293\" y=\"-101.2558\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">chop</text>\n",
"<text text-anchor=\"start\" x=\"209\" y=\"-87.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score: 0.21089630931458697</text>\n",
"</g>\n",
"<!-- 185&#45;&gt;186 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>185&#45;&gt;186</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M233.3362,-164.6103C245.2859,-153.4124 258.8605,-140.692 270.9571,-129.3566\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"273.3665,-131.8954 278.2702,-122.5037 268.58,-126.7876 273.3665,-131.8954\"/>\n",
"</g>\n",
"<!-- 187 -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>187</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"353,-36 257,-36 257,0 353,0 353,-36\"/>\n",
"<text text-anchor=\"start\" x=\"286.5\" y=\"-21.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"290.5\" y=\"-21.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">onion</text>\n",
"<text text-anchor=\"start\" x=\"265\" y=\"-7.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score:1.0</text>\n",
"</g>\n",
"<!-- 186&#45;&gt;187 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>186&#45;&gt;187</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M305,-71.8782C305,-63.7122 305,-54.6289 305,-46.2824\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"308.5001,-46.2287 305,-36.2288 301.5001,-46.2288 308.5001,-46.2287\"/>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<graphviz.dot.Digraph at 0x7fdb17b0cf28>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.1467369569343487\n"
]
},
{
"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.40.1 (20161225.0304)\n",
" -->\n",
"<!-- Title: %3 Pages: 1 -->\n",
"<svg width=\"424pt\" height=\"239pt\"\n",
" viewBox=\"0.00 0.00 424.00 238.91\" 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 234.9117)\">\n",
"<title>%3</title>\n",
"<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-234.9117 420,-234.9117 420,4 -4,4\"/>\n",
"<!-- 74 -->\n",
"<g id=\"node1\" class=\"node\">\n",
"<title>74</title>\n",
"<ellipse fill=\"none\" stroke=\"#000000\" cx=\"208\" cy=\"-205.4558\" rx=\"142.257\" ry=\"25.4118\"/>\n",
"<text text-anchor=\"start\" x=\"192\" y=\"-209.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"196\" y=\"-209.2558\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">bake</text>\n",
"<text text-anchor=\"start\" x=\"115.5\" y=\"-195.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score: 0.4546361041518653</text>\n",
"</g>\n",
"<!-- 70 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>70</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"208,-144 0,-108 208,-72 416,-108 208,-144\"/>\n",
"<text text-anchor=\"start\" x=\"194.5\" y=\"-111.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"198.5\" y=\"-111.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">mix</text>\n",
"<text text-anchor=\"start\" x=\"112\" y=\"-97.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score: 0.20029027576197386</text>\n",
"</g>\n",
"<!-- 74&#45;&gt;70 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>74&#45;&gt;70</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M208,-179.8505C208,-171.9868 208,-163.0773 208,-154.2748\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"211.5001,-154.0596 208,-144.0596 204.5001,-154.0597 211.5001,-154.0596\"/>\n",
"</g>\n",
"<!-- 71 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>71</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"199,-36 103,-36 103,0 199,0 199,-36\"/>\n",
"<text text-anchor=\"start\" x=\"128\" y=\"-21.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"132\" y=\"-21.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">tomato</text>\n",
"<text text-anchor=\"start\" x=\"111\" y=\"-7.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score:1.0</text>\n",
"</g>\n",
"<!-- 70&#45;&gt;71 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>70&#45;&gt;71</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M187.4217,-75.5079C180.9762,-65.3309 173.9435,-54.2266 167.7918,-44.5133\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"170.7394,-42.626 162.432,-36.0505 164.8257,-46.3714 170.7394,-42.626\"/>\n",
"</g>\n",
"<!-- 72 -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>72</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"313,-36 217,-36 217,0 313,0 313,-36\"/>\n",
"<text text-anchor=\"start\" x=\"246.5\" y=\"-21.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"250.5\" y=\"-21.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">onion</text>\n",
"<text text-anchor=\"start\" x=\"225\" y=\"-7.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score:1.0</text>\n",
"</g>\n",
"<!-- 70&#45;&gt;72 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>70&#45;&gt;72</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M228.5783,-75.5079C235.0238,-65.3309 242.0565,-54.2266 248.2082,-44.5133\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"251.1743,-46.3714 253.568,-36.0505 245.2606,-42.626 251.1743,-46.3714\"/>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<graphviz.dot.Digraph at 0x7fdb17b0cf28>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.1467369569343487\n"
]
},
{
"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.40.1 (20161225.0304)\n",
" -->\n",
"<!-- Title: %3 Pages: 1 -->\n",
"<svg width=\"424pt\" height=\"239pt\"\n",
" viewBox=\"0.00 0.00 424.00 238.91\" 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 234.9117)\">\n",
"<title>%3</title>\n",
"<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-234.9117 420,-234.9117 420,4 -4,4\"/>\n",
"<!-- 54 -->\n",
"<g id=\"node1\" class=\"node\">\n",
"<title>54</title>\n",
"<ellipse fill=\"none\" stroke=\"#000000\" cx=\"208\" cy=\"-205.4558\" rx=\"142.257\" ry=\"25.4118\"/>\n",
"<text text-anchor=\"start\" x=\"192\" y=\"-209.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"196\" y=\"-209.2558\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">bake</text>\n",
"<text text-anchor=\"start\" x=\"115.5\" y=\"-195.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score: 0.4546361041518653</text>\n",
"</g>\n",
"<!-- 50 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>50</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"208,-144 0,-108 208,-72 416,-108 208,-144\"/>\n",
"<text text-anchor=\"start\" x=\"194.5\" y=\"-111.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"198.5\" y=\"-111.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">mix</text>\n",
"<text text-anchor=\"start\" x=\"112\" y=\"-97.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score: 0.20029027576197386</text>\n",
"</g>\n",
"<!-- 54&#45;&gt;50 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>54&#45;&gt;50</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M208,-179.8505C208,-171.9868 208,-163.0773 208,-154.2748\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"211.5001,-154.0596 208,-144.0596 204.5001,-154.0597 211.5001,-154.0596\"/>\n",
"</g>\n",
"<!-- 51 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>51</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"199,-36 103,-36 103,0 199,0 199,-36\"/>\n",
"<text text-anchor=\"start\" x=\"132.5\" y=\"-21.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"136.5\" y=\"-21.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">onion</text>\n",
"<text text-anchor=\"start\" x=\"111\" y=\"-7.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score:1.0</text>\n",
"</g>\n",
"<!-- 50&#45;&gt;51 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>50&#45;&gt;51</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M187.4217,-75.5079C180.9762,-65.3309 173.9435,-54.2266 167.7918,-44.5133\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"170.7394,-42.626 162.432,-36.0505 164.8257,-46.3714 170.7394,-42.626\"/>\n",
"</g>\n",
"<!-- 52 -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>52</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"313,-36 217,-36 217,0 313,0 313,-36\"/>\n",
"<text text-anchor=\"start\" x=\"242\" y=\"-21.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"246\" y=\"-21.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">tomato</text>\n",
"<text text-anchor=\"start\" x=\"225\" y=\"-7.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score:1.0</text>\n",
"</g>\n",
"<!-- 50&#45;&gt;52 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>50&#45;&gt;52</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M228.5783,-75.5079C235.0238,-65.3309 242.0565,-54.2266 248.2082,-44.5133\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"251.1743,-46.3714 253.568,-36.0505 245.2606,-42.626 251.1743,-46.3714\"/>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<graphviz.dot.Digraph at 0x7fdb17b0cf28>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.10385674736299129\n"
]
},
{
"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.40.1 (20161225.0304)\n",
" -->\n",
"<!-- Title: %3 Pages: 1 -->\n",
"<svg width=\"424pt\" height=\"239pt\"\n",
" viewBox=\"0.00 0.00 424.00 238.91\" 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 234.9117)\">\n",
"<title>%3</title>\n",
"<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-234.9117 420,-234.9117 420,4 -4,4\"/>\n",
"<!-- 114 -->\n",
"<g id=\"node1\" class=\"node\">\n",
"<title>114</title>\n",
"<ellipse fill=\"none\" stroke=\"#000000\" cx=\"208\" cy=\"-205.4558\" rx=\"142.257\" ry=\"25.4118\"/>\n",
"<text text-anchor=\"start\" x=\"190.5\" y=\"-209.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"194.5\" y=\"-209.2558\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">saute</text>\n",
"<text text-anchor=\"start\" x=\"115.5\" y=\"-195.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score: 0.3228072143489262</text>\n",
"</g>\n",
"<!-- 110 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>110</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"208,-144 0,-108 208,-72 416,-108 208,-144\"/>\n",
"<text text-anchor=\"start\" x=\"194.5\" y=\"-111.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"198.5\" y=\"-111.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">mix</text>\n",
"<text text-anchor=\"start\" x=\"112\" y=\"-97.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score: 0.20029027576197386</text>\n",
"</g>\n",
"<!-- 114&#45;&gt;110 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>114&#45;&gt;110</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M208,-179.8505C208,-171.9868 208,-163.0773 208,-154.2748\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"211.5001,-154.0596 208,-144.0596 204.5001,-154.0597 211.5001,-154.0596\"/>\n",
"</g>\n",
"<!-- 111 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>111</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"199,-36 103,-36 103,0 199,0 199,-36\"/>\n",
"<text text-anchor=\"start\" x=\"128\" y=\"-21.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"132\" y=\"-21.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">tomato</text>\n",
"<text text-anchor=\"start\" x=\"111\" y=\"-7.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score:1.0</text>\n",
"</g>\n",
"<!-- 110&#45;&gt;111 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>110&#45;&gt;111</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M187.4217,-75.5079C180.9762,-65.3309 173.9435,-54.2266 167.7918,-44.5133\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"170.7394,-42.626 162.432,-36.0505 164.8257,-46.3714 170.7394,-42.626\"/>\n",
"</g>\n",
"<!-- 112 -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>112</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"313,-36 217,-36 217,0 313,0 313,-36\"/>\n",
"<text text-anchor=\"start\" x=\"246.5\" y=\"-21.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"250.5\" y=\"-21.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">onion</text>\n",
"<text text-anchor=\"start\" x=\"225\" y=\"-7.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score:1.0</text>\n",
"</g>\n",
"<!-- 110&#45;&gt;112 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>110&#45;&gt;112</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M228.5783,-75.5079C235.0238,-65.3309 242.0565,-54.2266 248.2082,-44.5133\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"251.1743,-46.3714 253.568,-36.0505 245.2606,-42.626 251.1743,-46.3714\"/>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<graphviz.dot.Digraph at 0x7fdb17b0cf28>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.0979739710108862\n"
]
},
{
"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.40.1 (20161225.0304)\n",
" -->\n",
"<!-- Title: %3 Pages: 1 -->\n",
"<svg width=\"424pt\" height=\"239pt\"\n",
" viewBox=\"0.00 0.00 424.00 238.91\" 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 234.9117)\">\n",
"<title>%3</title>\n",
"<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-234.9117 420,-234.9117 420,4 -4,4\"/>\n",
"<!-- 49 -->\n",
"<g id=\"node1\" class=\"node\">\n",
"<title>49</title>\n",
"<ellipse fill=\"none\" stroke=\"#000000\" cx=\"208\" cy=\"-205.4558\" rx=\"142.257\" ry=\"25.4118\"/>\n",
"<text text-anchor=\"start\" x=\"190.5\" y=\"-209.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"194.5\" y=\"-209.2558\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">place</text>\n",
"<text text-anchor=\"start\" x=\"115.5\" y=\"-195.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score: 0.3047214847499034</text>\n",
"</g>\n",
"<!-- 45 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>45</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"208,-144 0,-108 208,-72 416,-108 208,-144\"/>\n",
"<text text-anchor=\"start\" x=\"194.5\" y=\"-111.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"198.5\" y=\"-111.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">mix</text>\n",
"<text text-anchor=\"start\" x=\"112\" y=\"-97.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score: 0.20029027576197386</text>\n",
"</g>\n",
"<!-- 49&#45;&gt;45 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>49&#45;&gt;45</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M208,-179.8505C208,-171.9868 208,-163.0773 208,-154.2748\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"211.5001,-154.0596 208,-144.0596 204.5001,-154.0597 211.5001,-154.0596\"/>\n",
"</g>\n",
"<!-- 47 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>47</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"199,-36 103,-36 103,0 199,0 199,-36\"/>\n",
"<text text-anchor=\"start\" x=\"128\" y=\"-21.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"132\" y=\"-21.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">tomato</text>\n",
"<text text-anchor=\"start\" x=\"111\" y=\"-7.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score:1.0</text>\n",
"</g>\n",
"<!-- 45&#45;&gt;47 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>45&#45;&gt;47</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M187.4217,-75.5079C180.9762,-65.3309 173.9435,-54.2266 167.7918,-44.5133\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"170.7394,-42.626 162.432,-36.0505 164.8257,-46.3714 170.7394,-42.626\"/>\n",
"</g>\n",
"<!-- 46 -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>46</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"313,-36 217,-36 217,0 313,0 313,-36\"/>\n",
"<text text-anchor=\"start\" x=\"246.5\" y=\"-21.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"250.5\" y=\"-21.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">onion</text>\n",
"<text text-anchor=\"start\" x=\"225\" y=\"-7.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score:1.0</text>\n",
"</g>\n",
"<!-- 45&#45;&gt;46 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>45&#45;&gt;46</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M228.5783,-75.5079C235.0238,-65.3309 242.0565,-54.2266 248.2082,-44.5133\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"251.1743,-46.3714 253.568,-36.0505 245.2606,-42.626 251.1743,-46.3714\"/>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<graphviz.dot.Digraph at 0x7fdb17b0cf28>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.048854207472685374\n"
]
},
{
"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.40.1 (20161225.0304)\n",
" -->\n",
"<!-- Title: %3 Pages: 1 -->\n",
"<svg width=\"424pt\" height=\"239pt\"\n",
" viewBox=\"0.00 0.00 424.00 238.91\" 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 234.9117)\">\n",
"<title>%3</title>\n",
"<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-234.9117 420,-234.9117 420,4 -4,4\"/>\n",
"<!-- 104 -->\n",
"<g id=\"node1\" class=\"node\">\n",
"<title>104</title>\n",
"<ellipse fill=\"none\" stroke=\"#000000\" cx=\"208\" cy=\"-205.4558\" rx=\"147.1565\" ry=\"25.4118\"/>\n",
"<text text-anchor=\"start\" x=\"192\" y=\"-209.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"196\" y=\"-209.2558\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">pour</text>\n",
"<text text-anchor=\"start\" x=\"112\" y=\"-195.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score: 0.15371000511037156</text>\n",
"</g>\n",
"<!-- 100 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>100</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"208,-144 0,-108 208,-72 416,-108 208,-144\"/>\n",
"<text text-anchor=\"start\" x=\"194.5\" y=\"-111.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"198.5\" y=\"-111.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">mix</text>\n",
"<text text-anchor=\"start\" x=\"112\" y=\"-97.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score: 0.20029027576197386</text>\n",
"</g>\n",
"<!-- 104&#45;&gt;100 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>104&#45;&gt;100</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M208,-179.8505C208,-171.9868 208,-163.0773 208,-154.2748\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"211.5001,-154.0596 208,-144.0596 204.5001,-154.0597 211.5001,-154.0596\"/>\n",
"</g>\n",
"<!-- 102 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>102</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"199,-36 103,-36 103,0 199,0 199,-36\"/>\n",
"<text text-anchor=\"start\" x=\"128\" y=\"-21.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"132\" y=\"-21.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">tomato</text>\n",
"<text text-anchor=\"start\" x=\"111\" y=\"-7.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score:1.0</text>\n",
"</g>\n",
"<!-- 100&#45;&gt;102 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>100&#45;&gt;102</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M187.4217,-75.5079C180.9762,-65.3309 173.9435,-54.2266 167.7918,-44.5133\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"170.7394,-42.626 162.432,-36.0505 164.8257,-46.3714 170.7394,-42.626\"/>\n",
"</g>\n",
"<!-- 101 -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>101</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"313,-36 217,-36 217,0 313,0 313,-36\"/>\n",
"<text text-anchor=\"start\" x=\"246.5\" y=\"-21.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"250.5\" y=\"-21.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">onion</text>\n",
"<text text-anchor=\"start\" x=\"225\" y=\"-7.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score:1.0</text>\n",
"</g>\n",
"<!-- 100&#45;&gt;101 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>100&#45;&gt;101</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M228.5783,-75.5079C235.0238,-65.3309 242.0565,-54.2266 248.2082,-44.5133\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"251.1743,-46.3714 253.568,-36.0505 245.2606,-42.626 251.1743,-46.3714\"/>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<graphviz.dot.Digraph at 0x7fdb17b0cf28>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.029112476630023528\n"
]
},
{
"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.40.1 (20161225.0304)\n",
" -->\n",
"<!-- Title: %3 Pages: 1 -->\n",
"<svg width=\"460pt\" height=\"239pt\"\n",
" viewBox=\"0.00 0.00 460.13 238.91\" 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 234.9117)\">\n",
"<title>%3</title>\n",
"<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-234.9117 456.1285,-234.9117 456.1285,4 -4,4\"/>\n",
"<!-- 95 -->\n",
"<g id=\"node1\" class=\"node\">\n",
"<title>95</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"208,-230.9117 0,-194.9117 208,-158.9117 416,-194.9117 208,-230.9117\"/>\n",
"<text text-anchor=\"start\" x=\"194.5\" y=\"-198.7117\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"198.5\" y=\"-198.7117\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">mix</text>\n",
"<text text-anchor=\"start\" x=\"112\" y=\"-184.7117\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score: 0.13782051282051283</text>\n",
"</g>\n",
"<!-- 97 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>97</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"150,-115.4558 64,-115.4558 64,-79.4558 150,-79.4558 150,-115.4558\"/>\n",
"<text text-anchor=\"start\" x=\"84\" y=\"-101.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"88\" y=\"-101.2558\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">tomato</text>\n",
"<text text-anchor=\"start\" x=\"72\" y=\"-87.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score:1</text>\n",
"</g>\n",
"<!-- 95&#45;&gt;97 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>95&#45;&gt;97</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M176.3201,-164.3434C162.489,-150.9977 146.4601,-135.5313 133.3017,-122.8346\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"135.5507,-120.141 125.9242,-115.716 130.6901,-125.1783 135.5507,-120.141\"/>\n",
"</g>\n",
"<!-- 99 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>99</title>\n",
"<ellipse fill=\"none\" stroke=\"#000000\" cx=\"310\" cy=\"-97.4558\" rx=\"142.257\" ry=\"25.4118\"/>\n",
"<text text-anchor=\"start\" x=\"289\" y=\"-101.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"293\" y=\"-101.2558\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">brown</text>\n",
"<text text-anchor=\"start\" x=\"217.5\" y=\"-87.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score: 0.2899824253075571</text>\n",
"</g>\n",
"<!-- 95&#45;&gt;99 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>95&#45;&gt;99</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M239.9936,-164.3434C251.4959,-153.3536 264.5033,-140.9256 276.1577,-129.7904\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"278.7791,-132.1266 283.5915,-122.6878 273.9433,-127.0654 278.7791,-132.1266\"/>\n",
"</g>\n",
"<!-- 96 -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>96</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"358,-36 262,-36 262,0 358,0 358,-36\"/>\n",
"<text text-anchor=\"start\" x=\"291.5\" y=\"-21.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"295.5\" y=\"-21.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">onion</text>\n",
"<text text-anchor=\"start\" x=\"270\" y=\"-7.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score:1.0</text>\n",
"</g>\n",
"<!-- 99&#45;&gt;96 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>99&#45;&gt;96</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M310,-71.8782C310,-63.7122 310,-54.6289 310,-46.2824\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"313.5001,-46.2287 310,-36.2288 306.5001,-46.2288 313.5001,-46.2287\"/>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<graphviz.dot.Digraph at 0x7fdb17b0cf28>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.012923052806571338\n"
]
},
{
"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.40.1 (20161225.0304)\n",
" -->\n",
"<!-- Title: %3 Pages: 1 -->\n",
"<svg width=\"424pt\" height=\"239pt\"\n",
" viewBox=\"0.00 0.00 424.00 238.91\" 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 234.9117)\">\n",
"<title>%3</title>\n",
"<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-234.9117 420,-234.9117 420,4 -4,4\"/>\n",
"<!-- 89 -->\n",
"<g id=\"node1\" class=\"node\">\n",
"<title>89</title>\n",
"<ellipse fill=\"none\" stroke=\"#000000\" cx=\"208\" cy=\"-205.4558\" rx=\"147.1565\" ry=\"25.4118\"/>\n",
"<text text-anchor=\"start\" x=\"194\" y=\"-209.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"198\" y=\"-209.2558\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">peel</text>\n",
"<text text-anchor=\"start\" x=\"112\" y=\"-195.2558\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score: 0.04324496129828366</text>\n",
"</g>\n",
"<!-- 85 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>85</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"208,-144 0,-108 208,-72 416,-108 208,-144\"/>\n",
"<text text-anchor=\"start\" x=\"194.5\" y=\"-111.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"198.5\" y=\"-111.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">mix</text>\n",
"<text text-anchor=\"start\" x=\"112\" y=\"-97.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score: 0.20029027576197386</text>\n",
"</g>\n",
"<!-- 89&#45;&gt;85 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>89&#45;&gt;85</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M208,-179.8505C208,-171.9868 208,-163.0773 208,-154.2748\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"211.5001,-154.0596 208,-144.0596 204.5001,-154.0597 211.5001,-154.0596\"/>\n",
"</g>\n",
"<!-- 86 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>86</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"199,-36 103,-36 103,0 199,0 199,-36\"/>\n",
"<text text-anchor=\"start\" x=\"128\" y=\"-21.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"132\" y=\"-21.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">tomato</text>\n",
"<text text-anchor=\"start\" x=\"111\" y=\"-7.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score:1.0</text>\n",
"</g>\n",
"<!-- 85&#45;&gt;86 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>85&#45;&gt;86</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M187.4217,-75.5079C180.9762,-65.3309 173.9435,-54.2266 167.7918,-44.5133\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"170.7394,-42.626 162.432,-36.0505 164.8257,-46.3714 170.7394,-42.626\"/>\n",
"</g>\n",
"<!-- 87 -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>87</title>\n",
"<polygon fill=\"none\" stroke=\"#000000\" points=\"313,-36 217,-36 217,0 313,0 313,-36\"/>\n",
"<text text-anchor=\"start\" x=\"246.5\" y=\"-21.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> </text>\n",
"<text text-anchor=\"start\" x=\"250.5\" y=\"-21.8\" font-family=\"Times,serif\" font-weight=\"bold\" font-size=\"14.00\" fill=\"#000000\">onion</text>\n",
"<text text-anchor=\"start\" x=\"225\" y=\"-7.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">node score:1.0</text>\n",
"</g>\n",
"<!-- 85&#45;&gt;87 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>85&#45;&gt;87</title>\n",
"<path fill=\"none\" stroke=\"#000000\" d=\"M228.5783,-75.5079C235.0238,-65.3309 242.0565,-54.2266 248.2082,-44.5133\"/>\n",
"<polygon fill=\"#000000\" stroke=\"#000000\" points=\"251.1743,-46.3714 253.568,-36.0505 245.2606,-42.626 251.1743,-46.3714\"/>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<graphviz.dot.Digraph at 0x7fdb17b0cf28>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"p.plot_population()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.7.3"
},
"toc-autonumbering": false,
"toc-showcode": false,
"toc-showmarkdowntxt": false,
"toc-showtags": false
},
"nbformat": 4,
"nbformat_minor": 4
}