File size: 54,450 Bytes
525fbd4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "code",
      "source": [
        "from graphviz import Digraph\n",
        "\n",
        "def trace(root):\n",
        "    #Builds a set of all nodes and edges in a graph\n",
        "    nodes, edges = set(), set()\n",
        "    def build(v):\n",
        "        if v not in nodes:\n",
        "            nodes.add(v)\n",
        "            for child in v._prev:\n",
        "                edges.add((child, v))\n",
        "                build(child)\n",
        "    build(root)\n",
        "    return nodes, edges\n",
        "\n",
        "def draw_dot(root):\n",
        "    dot = Digraph(format='svg', graph_attr={'rankdir': 'LR'}) #LR == Left to Right\n",
        "\n",
        "    nodes, edges = trace(root)\n",
        "    for n in nodes:\n",
        "        uid = str(id(n))\n",
        "        #For any value in the graph, create a rectangular ('record') node for it\n",
        "        dot.node(name = uid, label = \"{ %s | data %.4f | grad %.4f }\" % ( n.label, n.data, n.grad), shape='record')\n",
        "        if n._op:\n",
        "            #If this value is a result of some operation, then create an op node for it\n",
        "            dot.node(name = uid + n._op, label=n._op)\n",
        "            #and connect this node to it\n",
        "            dot.edge(uid + n._op, uid)\n",
        "\n",
        "    for n1, n2 in edges:\n",
        "        #Connect n1 to the node of n2\n",
        "        dot.edge(str(id(n1)), str(id(n2)) + n2._op)\n",
        "\n",
        "    return dot"
      ],
      "metadata": {
        "id": "T0rN8d146jvF"
      },
      "execution_count": 1,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "import math"
      ],
      "metadata": {
        "id": "JlYxBvFK0AjA"
      },
      "execution_count": 2,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "class Value:\n",
        "\n",
        "    def __init__(self, data, _children=(), _op='', label=''):\n",
        "        self.data = data\n",
        "        self.grad = 0.0\n",
        "        self._backward = lambda: None #Its an empty function by default. This is what will do that gradient calculation at each of the operations.\n",
        "        self._prev = set(_children)\n",
        "        self._op = _op\n",
        "        self.label = label\n",
        "\n",
        "\n",
        "    def __repr__(self):\n",
        "        return f\"Value(data={self.data})\"\n",
        "\n",
        "    def __add__(self, other):\n",
        "        out = Value(self.data + other.data, (self, other), '+')\n",
        "\n",
        "        def backward():\n",
        "          self.grad += 1.0 * out.grad   #Adding it on\n",
        "          other.grad += 1.0 * out.grad  #Adding it on\n",
        "\n",
        "        out._backward = backward\n",
        "        return out\n",
        "\n",
        "    def __mul__(self, other):\n",
        "        out = Value(self.data * other.data, (self, other), '*')\n",
        "\n",
        "        def backward():\n",
        "          self.grad += other.data * out.grad  #Adding it on\n",
        "          other.grad += self.data * out.grad  #Adding it on\n",
        "\n",
        "        out._backward = backward\n",
        "        return out\n",
        "\n",
        "    def tanh(self):\n",
        "        x = self.data\n",
        "        t = (math.exp(2*x) - 1)/(math.exp(2*x) + 1)\n",
        "        out = Value(t, (self, ), 'tanh')\n",
        "\n",
        "        def backward():\n",
        "          self.grad += 1 - (t**2) * out.grad    #Adding it on\n",
        "\n",
        "        out._backward = backward\n",
        "        return out\n",
        "\n",
        "    def backward(self):\n",
        "\n",
        "      topo = []\n",
        "      visited = set()\n",
        "      def build_topo(v):\n",
        "        if v not in visited:\n",
        "          visited.add(v)\n",
        "          for child in v._prev:\n",
        "            build_topo(child)\n",
        "          topo.append(v)\n",
        "\n",
        "      build_topo(self)\n",
        "\n",
        "      self.grad = 1.0\n",
        "      for node in reversed(topo):\n",
        "        node._backward()"
      ],
      "metadata": {
        "id": "XBafkiKxJ-in"
      },
      "execution_count": 3,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "#Inputs x1, x2 of the neuron\n",
        "x1 = Value(2.0, label='x1')\n",
        "x2 = Value(0.0, label='x2')\n",
        "\n",
        "#Weights w1, w2 of the neuron - The synaptic values\n",
        "w1 = Value(-3.0, label='w1')\n",
        "w2 = Value(1.0, label='w2')\n",
        "\n",
        "#The bias of the neuron\n",
        "b = Value(6.8813735870195432, label='b')\n",
        "\n",
        "x1w1 = x1*w1; x1w1.label = 'x1*w1'\n",
        "x2w2 = x2*w2; x2w2.label = 'x2*w2'\n",
        "\n",
        "#The summation\n",
        "x1w1x2w2 = x1w1 + x2w2; x1w1x2w2.label = 'x1*w1 + x2*w2'\n",
        "\n",
        "#n is basically the cell body, but without the activation function\n",
        "n = x1w1x2w2 + b; n.label = 'n'\n",
        "\n",
        "#Now we pass n to the activation function\n",
        "o = n.tanh(); o.label = 'o'"
      ],
      "metadata": {
        "id": "S3HaLbW_zvne"
      },
      "execution_count": 8,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "#o.grad = 1.0\n",
        "o.backward()\n",
        "\n",
        "draw_dot(o)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 322
        },
        "id": "P6OmwdXGGoJZ",
        "outputId": "b5f3e9c2-c28f-4272-c328-db0c0536f5b5"
      },
      "execution_count": 9,
      "outputs": [
        {
          "output_type": "execute_result",
          "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: %3 Pages: 1 -->\n<svg width=\"1575pt\" height=\"210pt\"\n viewBox=\"0.00 0.00 1575.00 210.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 206)\">\n<title>%3</title>\n<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-206 1571,-206 1571,4 -4,4\"/>\n<!-- 134557530771504 -->\n<g id=\"node1\" class=\"node\">\n<title>134557530771504</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"4,-165.5 4,-201.5 196,-201.5 196,-165.5 4,-165.5\"/>\n<text text-anchor=\"middle\" x=\"19\" y=\"-179.8\" font-family=\"Times,serif\" font-size=\"14.00\">x2</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"34,-165.5 34,-201.5 \"/>\n<text text-anchor=\"middle\" x=\"74\" y=\"-179.8\" font-family=\"Times,serif\" font-size=\"14.00\">data 0.0000</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"114,-165.5 114,-201.5 \"/>\n<text text-anchor=\"middle\" x=\"155\" y=\"-179.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 0.5000</text>\n</g>\n<!-- 134557530506528* -->\n<g id=\"node12\" class=\"node\">\n<title>134557530506528*</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"263\" cy=\"-128.5\" rx=\"27\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"263\" y=\"-124.8\" font-family=\"Times,serif\" font-size=\"14.00\">*</text>\n</g>\n<!-- 134557530771504&#45;&gt;134557530506528* -->\n<g id=\"edge6\" class=\"edge\">\n<title>134557530771504&#45;&gt;134557530506528*</title>\n<path fill=\"none\" stroke=\"black\" d=\"M172.53,-165.44C181.84,-162.67 191.2,-159.67 200,-156.5 210.53,-152.71 221.75,-147.9 231.72,-143.33\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"233.25,-146.48 240.82,-139.07 230.28,-140.14 233.25,-146.48\"/>\n</g>\n<!-- 134557530774768 -->\n<g id=\"node2\" class=\"node\">\n<title>134557530774768</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"0,-55.5 0,-91.5 200,-91.5 200,-55.5 0,-55.5\"/>\n<text text-anchor=\"middle\" x=\"16.5\" y=\"-69.8\" font-family=\"Times,serif\" font-size=\"14.00\">w1</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"33,-55.5 33,-91.5 \"/>\n<text text-anchor=\"middle\" x=\"75.5\" y=\"-69.8\" font-family=\"Times,serif\" font-size=\"14.00\">data &#45;3.0000</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"118,-55.5 118,-91.5 \"/>\n<text text-anchor=\"middle\" x=\"159\" y=\"-69.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 1.0000</text>\n</g>\n<!-- 134557530518288* -->\n<g id=\"node5\" class=\"node\">\n<title>134557530518288*</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"263\" cy=\"-73.5\" rx=\"27\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"263\" y=\"-69.8\" font-family=\"Times,serif\" font-size=\"14.00\">*</text>\n</g>\n<!-- 134557530774768&#45;&gt;134557530518288* -->\n<g id=\"edge9\" class=\"edge\">\n<title>134557530774768&#45;&gt;134557530518288*</title>\n<path fill=\"none\" stroke=\"black\" d=\"M200.21,-73.5C209.2,-73.5 217.86,-73.5 225.7,-73.5\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"225.85,-77 235.85,-73.5 225.85,-70 225.85,-77\"/>\n</g>\n<!-- 134557530779376 -->\n<g id=\"node3\" class=\"node\">\n<title>134557530779376</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"716,-27.5 716,-63.5 901,-63.5 901,-27.5 716,-27.5\"/>\n<text text-anchor=\"middle\" x=\"727.5\" y=\"-41.8\" font-family=\"Times,serif\" font-size=\"14.00\">b</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"739,-27.5 739,-63.5 \"/>\n<text text-anchor=\"middle\" x=\"779\" y=\"-41.8\" font-family=\"Times,serif\" font-size=\"14.00\">data 6.8814</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"819,-27.5 819,-63.5 \"/>\n<text text-anchor=\"middle\" x=\"860\" y=\"-41.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 0.5000</text>\n</g>\n<!-- 134557531013424+ -->\n<g id=\"node9\" class=\"node\">\n<title>134557531013424+</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"1008\" cy=\"-72.5\" rx=\"27\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"1008\" y=\"-68.8\" font-family=\"Times,serif\" font-size=\"14.00\">+</text>\n</g>\n<!-- 134557530779376&#45;&gt;134557531013424+ -->\n<g id=\"edge12\" class=\"edge\">\n<title>134557530779376&#45;&gt;134557531013424+</title>\n<path fill=\"none\" stroke=\"black\" d=\"M901.02,-58.01C926,-61.43 951.59,-64.93 971.37,-67.63\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"971.05,-71.12 981.43,-69.01 972,-64.18 971.05,-71.12\"/>\n</g>\n<!-- 134557530518288 -->\n<g id=\"node4\" class=\"node\">\n<title>134557530518288</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"326,-55.5 326,-91.5 546,-91.5 546,-55.5 326,-55.5\"/>\n<text text-anchor=\"middle\" x=\"352.5\" y=\"-69.8\" font-family=\"Times,serif\" font-size=\"14.00\">x1*w1</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"379,-55.5 379,-91.5 \"/>\n<text text-anchor=\"middle\" x=\"421.5\" y=\"-69.8\" font-family=\"Times,serif\" font-size=\"14.00\">data &#45;6.0000</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"464,-55.5 464,-91.5 \"/>\n<text text-anchor=\"middle\" x=\"505\" y=\"-69.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 0.5000</text>\n</g>\n<!-- 134557531020672+ -->\n<g id=\"node15\" class=\"node\">\n<title>134557531020672+</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"609\" cy=\"-100.5\" rx=\"27\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"609\" y=\"-96.8\" font-family=\"Times,serif\" font-size=\"14.00\">+</text>\n</g>\n<!-- 134557530518288&#45;&gt;134557531020672+ -->\n<g id=\"edge7\" class=\"edge\">\n<title>134557530518288&#45;&gt;134557531020672+</title>\n<path fill=\"none\" stroke=\"black\" d=\"M546.27,-90.75C555.64,-92.23 564.6,-93.65 572.65,-94.92\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"572.23,-98.4 582.65,-96.5 573.32,-91.48 572.23,-98.4\"/>\n</g>\n<!-- 134557530518288*&#45;&gt;134557530518288 -->\n<g id=\"edge1\" class=\"edge\">\n<title>134557530518288*&#45;&gt;134557530518288</title>\n<path fill=\"none\" stroke=\"black\" d=\"M290.34,-73.5C297.77,-73.5 306.37,-73.5 315.6,-73.5\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"315.84,-77 325.84,-73.5 315.84,-70 315.84,-77\"/>\n</g>\n<!-- 134557531017504 -->\n<g id=\"node6\" class=\"node\">\n<title>134557531017504</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"1382,-54.5 1382,-90.5 1567,-90.5 1567,-54.5 1382,-54.5\"/>\n<text text-anchor=\"middle\" x=\"1393.5\" y=\"-68.8\" font-family=\"Times,serif\" font-size=\"14.00\">o</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"1405,-54.5 1405,-90.5 \"/>\n<text text-anchor=\"middle\" x=\"1445\" y=\"-68.8\" font-family=\"Times,serif\" font-size=\"14.00\">data 0.7071</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"1485,-54.5 1485,-90.5 \"/>\n<text text-anchor=\"middle\" x=\"1526\" y=\"-68.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 1.0000</text>\n</g>\n<!-- 134557531017504tanh -->\n<g id=\"node7\" class=\"node\">\n<title>134557531017504tanh</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"1319\" cy=\"-72.5\" rx=\"27\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"1319\" y=\"-68.8\" font-family=\"Times,serif\" font-size=\"14.00\">tanh</text>\n</g>\n<!-- 134557531017504tanh&#45;&gt;134557531017504 -->\n<g id=\"edge2\" class=\"edge\">\n<title>134557531017504tanh&#45;&gt;134557531017504</title>\n<path fill=\"none\" stroke=\"black\" d=\"M1346.04,-72.5C1353.58,-72.5 1362.3,-72.5 1371.57,-72.5\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"1371.81,-76 1381.81,-72.5 1371.81,-69 1371.81,-76\"/>\n</g>\n<!-- 134557531013424 -->\n<g id=\"node8\" class=\"node\">\n<title>134557531013424</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"1071,-54.5 1071,-90.5 1256,-90.5 1256,-54.5 1071,-54.5\"/>\n<text text-anchor=\"middle\" x=\"1082.5\" y=\"-68.8\" font-family=\"Times,serif\" font-size=\"14.00\">n</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"1094,-54.5 1094,-90.5 \"/>\n<text text-anchor=\"middle\" x=\"1134\" y=\"-68.8\" font-family=\"Times,serif\" font-size=\"14.00\">data 0.8814</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"1174,-54.5 1174,-90.5 \"/>\n<text text-anchor=\"middle\" x=\"1215\" y=\"-68.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 0.5000</text>\n</g>\n<!-- 134557531013424&#45;&gt;134557531017504tanh -->\n<g id=\"edge14\" class=\"edge\">\n<title>134557531013424&#45;&gt;134557531017504tanh</title>\n<path fill=\"none\" stroke=\"black\" d=\"M1256.01,-72.5C1265.01,-72.5 1273.74,-72.5 1281.66,-72.5\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"1281.91,-76 1291.91,-72.5 1281.91,-69 1281.91,-76\"/>\n</g>\n<!-- 134557531013424+&#45;&gt;134557531013424 -->\n<g id=\"edge3\" class=\"edge\">\n<title>134557531013424+&#45;&gt;134557531013424</title>\n<path fill=\"none\" stroke=\"black\" d=\"M1035.04,-72.5C1042.58,-72.5 1051.3,-72.5 1060.57,-72.5\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"1060.81,-76 1070.81,-72.5 1060.81,-69 1060.81,-76\"/>\n</g>\n<!-- 134557530768192 -->\n<g id=\"node10\" class=\"node\">\n<title>134557530768192</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"2,-0.5 2,-36.5 198,-36.5 198,-0.5 2,-0.5\"/>\n<text text-anchor=\"middle\" x=\"17\" y=\"-14.8\" font-family=\"Times,serif\" font-size=\"14.00\">x1</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"32,-0.5 32,-36.5 \"/>\n<text text-anchor=\"middle\" x=\"72\" y=\"-14.8\" font-family=\"Times,serif\" font-size=\"14.00\">data 2.0000</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"112,-0.5 112,-36.5 \"/>\n<text text-anchor=\"middle\" x=\"155\" y=\"-14.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad &#45;1.5000</text>\n</g>\n<!-- 134557530768192&#45;&gt;134557530518288* -->\n<g id=\"edge8\" class=\"edge\">\n<title>134557530768192&#45;&gt;134557530518288*</title>\n<path fill=\"none\" stroke=\"black\" d=\"M169.28,-36.5C179.65,-39.61 190.16,-42.98 200,-46.5 210.28,-50.17 221.28,-54.74 231.11,-59.07\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"229.93,-62.37 240.48,-63.27 232.79,-55.99 229.93,-62.37\"/>\n</g>\n<!-- 134557530506528 -->\n<g id=\"node11\" class=\"node\">\n<title>134557530506528</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"328.5,-110.5 328.5,-146.5 543.5,-146.5 543.5,-110.5 328.5,-110.5\"/>\n<text text-anchor=\"middle\" x=\"355\" y=\"-124.8\" font-family=\"Times,serif\" font-size=\"14.00\">x2*w2</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"381.5,-110.5 381.5,-146.5 \"/>\n<text text-anchor=\"middle\" x=\"421.5\" y=\"-124.8\" font-family=\"Times,serif\" font-size=\"14.00\">data 0.0000</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"461.5,-110.5 461.5,-146.5 \"/>\n<text text-anchor=\"middle\" x=\"502.5\" y=\"-124.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 0.5000</text>\n</g>\n<!-- 134557530506528&#45;&gt;134557531020672+ -->\n<g id=\"edge13\" class=\"edge\">\n<title>134557530506528&#45;&gt;134557531020672+</title>\n<path fill=\"none\" stroke=\"black\" d=\"M543.84,-111.01C554.01,-109.34 563.76,-107.74 572.44,-106.32\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"573.17,-109.75 582.47,-104.68 572.04,-102.84 573.17,-109.75\"/>\n</g>\n<!-- 134557530506528*&#45;&gt;134557530506528 -->\n<g id=\"edge4\" class=\"edge\">\n<title>134557530506528*&#45;&gt;134557530506528</title>\n<path fill=\"none\" stroke=\"black\" d=\"M290.34,-128.5C298.51,-128.5 308.08,-128.5 318.36,-128.5\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"318.39,-132 328.39,-128.5 318.39,-125 318.39,-132\"/>\n</g>\n<!-- 134557530782592 -->\n<g id=\"node13\" class=\"node\">\n<title>134557530782592</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"2.5,-110.5 2.5,-146.5 197.5,-146.5 197.5,-110.5 2.5,-110.5\"/>\n<text text-anchor=\"middle\" x=\"19\" y=\"-124.8\" font-family=\"Times,serif\" font-size=\"14.00\">w2</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"35.5,-110.5 35.5,-146.5 \"/>\n<text text-anchor=\"middle\" x=\"75.5\" y=\"-124.8\" font-family=\"Times,serif\" font-size=\"14.00\">data 1.0000</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"115.5,-110.5 115.5,-146.5 \"/>\n<text text-anchor=\"middle\" x=\"156.5\" y=\"-124.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 0.0000</text>\n</g>\n<!-- 134557530782592&#45;&gt;134557530506528* -->\n<g id=\"edge11\" class=\"edge\">\n<title>134557530782592&#45;&gt;134557530506528*</title>\n<path fill=\"none\" stroke=\"black\" d=\"M197.91,-128.5C207.65,-128.5 217.05,-128.5 225.52,-128.5\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"225.7,-132 235.7,-128.5 225.7,-125 225.7,-132\"/>\n</g>\n<!-- 134557531020672 -->\n<g id=\"node14\" class=\"node\">\n<title>134557531020672</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"672,-82.5 672,-118.5 945,-118.5 945,-82.5 672,-82.5\"/>\n<text text-anchor=\"middle\" x=\"725\" y=\"-96.8\" font-family=\"Times,serif\" font-size=\"14.00\">x1*w1 + x2*w2</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"778,-82.5 778,-118.5 \"/>\n<text text-anchor=\"middle\" x=\"820.5\" y=\"-96.8\" font-family=\"Times,serif\" font-size=\"14.00\">data &#45;6.0000</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"863,-82.5 863,-118.5 \"/>\n<text text-anchor=\"middle\" x=\"904\" y=\"-96.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 0.5000</text>\n</g>\n<!-- 134557531020672&#45;&gt;134557531013424+ -->\n<g id=\"edge10\" class=\"edge\">\n<title>134557531020672&#45;&gt;134557531013424+</title>\n<path fill=\"none\" stroke=\"black\" d=\"M936.53,-82.49C949.09,-80.71 960.99,-79.02 971.3,-77.56\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"972.03,-80.99 981.44,-76.12 971.05,-74.06 972.03,-80.99\"/>\n</g>\n<!-- 134557531020672+&#45;&gt;134557531020672 -->\n<g id=\"edge5\" class=\"edge\">\n<title>134557531020672+&#45;&gt;134557531020672</title>\n<path fill=\"none\" stroke=\"black\" d=\"M636.23,-100.5C643.7,-100.5 652.41,-100.5 661.87,-100.5\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"661.98,-104 671.98,-100.5 661.98,-97 661.98,-104\"/>\n</g>\n</g>\n</svg>\n",
            "text/plain": [
              "<graphviz.graphs.Digraph at 0x7a611dd6a6b0>"
            ]
          },
          "metadata": {},
          "execution_count": 9
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "--------------------"
      ],
      "metadata": {
        "id": "476LQxU3FXL4"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "### **Updating the Value object**"
      ],
      "metadata": {
        "id": "vP0ZtM9HFX9p"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "class Value:\n",
        "\n",
        "    def __init__(self, data, _children=(), _op='', label=''):\n",
        "        self.data = data\n",
        "        self.grad = 0.0\n",
        "        self._backward = lambda: None #Its an empty function by default. This is what will do that gradient calculation at each of the operations.\n",
        "        self._prev = set(_children)\n",
        "        self._op = _op\n",
        "        self.label = label\n",
        "\n",
        "\n",
        "    def __repr__(self):\n",
        "        return f\"Value(data={self.data})\"\n",
        "\n",
        "    def __add__(self, other):\n",
        "        other = other if isinstance(other, Value) else Value(other)\n",
        "        out = Value(self.data + other.data, (self, other), '+')\n",
        "\n",
        "        def backward():\n",
        "          self.grad += 1.0 * out.grad\n",
        "          other.grad += 1.0 * out.grad\n",
        "\n",
        "        out._backward = backward\n",
        "        return out\n",
        "\n",
        "    def __mul__(self, other):\n",
        "        other = other if isinstance(other, Value) else Value(other)\n",
        "        out = Value(self.data * other.data, (self, other), '*')\n",
        "\n",
        "        def backward():\n",
        "          self.grad += other.data * out.grad\n",
        "          other.grad += self.data * out.grad\n",
        "        out._backward = backward\n",
        "        return out\n",
        "\n",
        "    def __rmul__(self, other):   #other * self\n",
        "        return self * other\n",
        "\n",
        "    def __truediv__(self, other):  #self/other\n",
        "        return self * other**-1\n",
        "\n",
        "    def __neg__(self):\n",
        "        return self * -1\n",
        "\n",
        "    def __sub__(self, other):  #self - other\n",
        "        return self + (-other)\n",
        "\n",
        "    def __pow__(self, other):\n",
        "        assert isinstance(other, (int, float)), \"only supporting int/float powers for now\"\n",
        "        out = Value(self.data ** other, (self, ), f\"**{other}\")\n",
        "\n",
        "        def backward():\n",
        "          self.grad += (other * (self.data ** (other - 1))) * out.grad\n",
        "\n",
        "        out._backward = backward\n",
        "        return out\n",
        "\n",
        "    def tanh(self):\n",
        "        x = self.data\n",
        "        t = (math.exp(2*x) - 1)/(math.exp(2*x) + 1)\n",
        "        out = Value(t, (self, ), 'tanh')\n",
        "\n",
        "        def backward():\n",
        "          self.grad += 1 - (t**2) * out.grad\n",
        "\n",
        "        out._backward = backward\n",
        "        return out\n",
        "\n",
        "    def exp(self):\n",
        "        x = self.data\n",
        "        out = Value(math.exp(x), (self, ), 'exp')   #We merged t and out, into just out\n",
        "\n",
        "        def backward():\n",
        "            self.grad += out.data * out.grad\n",
        "\n",
        "        out._backward = backward\n",
        "        return out\n",
        "\n",
        "    def backward(self):\n",
        "\n",
        "      topo = []\n",
        "      visited = set()\n",
        "      def build_topo(v):\n",
        "        if v not in visited:\n",
        "          visited.add(v)\n",
        "          for child in v._prev:\n",
        "            build_topo(child)\n",
        "          topo.append(v)\n",
        "\n",
        "      build_topo(self)\n",
        "\n",
        "      self.grad = 1.0\n",
        "      for node in reversed(topo):\n",
        "        node._backward()"
      ],
      "metadata": {
        "id": "tA0zbyEwFbD5"
      },
      "execution_count": 10,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "x1 = Value(2.0, label='x1')\n",
        "x2 = Value(0.0, label='x2')\n",
        "\n",
        "w1 = Value(-3.0, label='w1')\n",
        "w2 = Value(1.0, label='w2')\n",
        "\n",
        "b = Value(6.8813735870195432, label='b')\n",
        "\n",
        "x1w1 = x1*w1; x1w1.label = 'x1*w1'\n",
        "x2w2 = x2*w2; x2w2.label = 'x2*w2'\n",
        "\n",
        "x1w1x2w2 = x1w1 + x2w2; x1w1x2w2.label = 'x1*w1 + x2*w2'\n",
        "\n",
        "n = x1w1x2w2 + b; n.label = 'n'\n",
        "\n",
        "#o = n.tanh(); o.label = 'o'\n",
        "\n",
        "#Spliting up of the tanh function\n",
        "\n",
        "e = (2*n).exp()\n",
        "o = (e - 1) / (e + 1)\n",
        "o.label = 'o'"
      ],
      "metadata": {
        "id": "Ounbj2XwHSZ1"
      },
      "execution_count": 11,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "o.backward()\n",
        "\n",
        "draw_dot(o)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 360
        },
        "id": "FomTAJvaIFcb",
        "outputId": "c1de2563-fad8-4049-9b37-84254d4b45c1"
      },
      "execution_count": 13,
      "outputs": [
        {
          "output_type": "execute_result",
          "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: %3 Pages: 1 -->\n<svg width=\"2944pt\" height=\"239pt\"\n viewBox=\"0.00 0.00 2944.00 239.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 235)\">\n<title>%3</title>\n<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-235 2940,-235 2940,4 -4,4\"/>\n<!-- 134557531141120 -->\n<g id=\"node1\" class=\"node\">\n<title>134557531141120</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"0,-194.5 0,-230.5 200,-230.5 200,-194.5 0,-194.5\"/>\n<text text-anchor=\"middle\" x=\"16.5\" y=\"-208.8\" font-family=\"Times,serif\" font-size=\"14.00\">w1</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"33,-194.5 33,-230.5 \"/>\n<text text-anchor=\"middle\" x=\"75.5\" y=\"-208.8\" font-family=\"Times,serif\" font-size=\"14.00\">data &#45;3.0000</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"118,-194.5 118,-230.5 \"/>\n<text text-anchor=\"middle\" x=\"159\" y=\"-208.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 1.0000</text>\n</g>\n<!-- 134557531129936* -->\n<g id=\"node5\" class=\"node\">\n<title>134557531129936*</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"263\" cy=\"-157.5\" rx=\"27\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"263\" y=\"-153.8\" font-family=\"Times,serif\" font-size=\"14.00\">*</text>\n</g>\n<!-- 134557531141120&#45;&gt;134557531129936* -->\n<g id=\"edge19\" class=\"edge\">\n<title>134557531141120&#45;&gt;134557531129936*</title>\n<path fill=\"none\" stroke=\"black\" d=\"M172.53,-194.44C181.84,-191.67 191.2,-188.67 200,-185.5 210.53,-181.71 221.75,-176.9 231.72,-172.33\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"233.25,-175.48 240.82,-168.07 230.28,-169.14 233.25,-175.48\"/>\n</g>\n<!-- 134557531141168 -->\n<g id=\"node2\" class=\"node\">\n<title>134557531141168</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"2443,-31.5 2443,-67.5 2625,-67.5 2625,-31.5 2443,-31.5\"/>\n<text text-anchor=\"middle\" x=\"2453\" y=\"-45.8\" font-family=\"Times,serif\" font-size=\"14.00\"> </text>\n<polyline fill=\"none\" stroke=\"black\" points=\"2463,-31.5 2463,-67.5 \"/>\n<text text-anchor=\"middle\" x=\"2503\" y=\"-45.8\" font-family=\"Times,serif\" font-size=\"14.00\">data 0.1464</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"2543,-31.5 2543,-67.5 \"/>\n<text text-anchor=\"middle\" x=\"2584\" y=\"-45.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 4.8284</text>\n</g>\n<!-- 134557531141312* -->\n<g id=\"node11\" class=\"node\">\n<title>134557531141312*</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"2688\" cy=\"-72.5\" rx=\"27\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"2688\" y=\"-68.8\" font-family=\"Times,serif\" font-size=\"14.00\">*</text>\n</g>\n<!-- 134557531141168&#45;&gt;134557531141312* -->\n<g id=\"edge16\" class=\"edge\">\n<title>134557531141168&#45;&gt;134557531141312*</title>\n<path fill=\"none\" stroke=\"black\" d=\"M2625.18,-63.15C2634.42,-64.54 2643.38,-65.9 2651.47,-67.12\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"2651.15,-70.61 2661.56,-68.65 2652.19,-63.69 2651.15,-70.61\"/>\n</g>\n<!-- 134557531141168**&#45;1 -->\n<g id=\"node3\" class=\"node\">\n<title>134557531141168**&#45;1</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"2316\" cy=\"-45.5\" rx=\"27\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"2316\" y=\"-41.8\" font-family=\"Times,serif\" font-size=\"14.00\">**&#45;1</text>\n</g>\n<!-- 134557531141168**&#45;1&#45;&gt;134557531141168 -->\n<g id=\"edge1\" class=\"edge\">\n<title>134557531141168**&#45;1&#45;&gt;134557531141168</title>\n<path fill=\"none\" stroke=\"black\" d=\"M2343.05,-45.98C2365.53,-46.4 2399.48,-47.03 2432.5,-47.64\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"2432.64,-51.14 2442.7,-47.83 2432.77,-44.14 2432.64,-51.14\"/>\n</g>\n<!-- 134557531129936 -->\n<g id=\"node4\" class=\"node\">\n<title>134557531129936</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"326,-139.5 326,-175.5 546,-175.5 546,-139.5 326,-139.5\"/>\n<text text-anchor=\"middle\" x=\"352.5\" y=\"-153.8\" font-family=\"Times,serif\" font-size=\"14.00\">x1*w1</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"379,-139.5 379,-175.5 \"/>\n<text text-anchor=\"middle\" x=\"421.5\" y=\"-153.8\" font-family=\"Times,serif\" font-size=\"14.00\">data &#45;6.0000</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"464,-139.5 464,-175.5 \"/>\n<text text-anchor=\"middle\" x=\"505\" y=\"-153.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 0.5000</text>\n</g>\n<!-- 134557531131184+ -->\n<g id=\"node18\" class=\"node\">\n<title>134557531131184+</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"609\" cy=\"-129.5\" rx=\"27\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"609\" y=\"-125.8\" font-family=\"Times,serif\" font-size=\"14.00\">+</text>\n</g>\n<!-- 134557531129936&#45;&gt;134557531131184+ -->\n<g id=\"edge15\" class=\"edge\">\n<title>134557531129936&#45;&gt;134557531131184+</title>\n<path fill=\"none\" stroke=\"black\" d=\"M546.27,-139.61C555.64,-138.07 564.6,-136.61 572.65,-135.29\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"573.35,-138.72 582.65,-133.65 572.22,-131.81 573.35,-138.72\"/>\n</g>\n<!-- 134557531129936*&#45;&gt;134557531129936 -->\n<g id=\"edge2\" class=\"edge\">\n<title>134557531129936*&#45;&gt;134557531129936</title>\n<path fill=\"none\" stroke=\"black\" d=\"M290.34,-157.5C297.77,-157.5 306.37,-157.5 315.6,-157.5\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"315.84,-161 325.84,-157.5 315.84,-154 315.84,-161\"/>\n</g>\n<!-- 134557531132576 -->\n<g id=\"node6\" class=\"node\">\n<title>134557531132576</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"2225,-82.5 2225,-118.5 2407,-118.5 2407,-82.5 2225,-82.5\"/>\n<text text-anchor=\"middle\" x=\"2235\" y=\"-96.8\" font-family=\"Times,serif\" font-size=\"14.00\"> </text>\n<polyline fill=\"none\" stroke=\"black\" points=\"2245,-82.5 2245,-118.5 \"/>\n<text text-anchor=\"middle\" x=\"2285\" y=\"-96.8\" font-family=\"Times,serif\" font-size=\"14.00\">data 4.8284</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"2325,-82.5 2325,-118.5 \"/>\n<text text-anchor=\"middle\" x=\"2366\" y=\"-96.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 0.1464</text>\n</g>\n<!-- 134557531132576&#45;&gt;134557531141312* -->\n<g id=\"edge17\" class=\"edge\">\n<title>134557531132576&#45;&gt;134557531141312*</title>\n<path fill=\"none\" stroke=\"black\" d=\"M2407.31,-93.9C2468.7,-89.37 2551.76,-83.19 2625,-77.5 2633.42,-76.85 2642.48,-76.13 2651.01,-75.44\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"2651.37,-78.92 2661.06,-74.63 2650.81,-71.94 2651.37,-78.92\"/>\n</g>\n<!-- 134557531132576+ -->\n<g id=\"node7\" class=\"node\">\n<title>134557531132576+</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"1940\" cy=\"-100.5\" rx=\"27\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"1940\" y=\"-96.8\" font-family=\"Times,serif\" font-size=\"14.00\">+</text>\n</g>\n<!-- 134557531132576+&#45;&gt;134557531132576 -->\n<g id=\"edge3\" class=\"edge\">\n<title>134557531132576+&#45;&gt;134557531132576</title>\n<path fill=\"none\" stroke=\"black\" d=\"M1967,-100.5C2017.46,-100.5 2131.06,-100.5 2214.81,-100.5\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"2214.87,-104 2224.87,-100.5 2214.87,-97 2214.87,-104\"/>\n</g>\n<!-- 134557531133104 -->\n<g id=\"node8\" class=\"node\">\n<title>134557531133104</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"1382,-55.5 1382,-91.5 1564,-91.5 1564,-55.5 1382,-55.5\"/>\n<text text-anchor=\"middle\" x=\"1392\" y=\"-69.8\" font-family=\"Times,serif\" font-size=\"14.00\"> </text>\n<polyline fill=\"none\" stroke=\"black\" points=\"1402,-55.5 1402,-91.5 \"/>\n<text text-anchor=\"middle\" x=\"1442\" y=\"-69.8\" font-family=\"Times,serif\" font-size=\"14.00\">data 1.7627</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"1482,-55.5 1482,-91.5 \"/>\n<text text-anchor=\"middle\" x=\"1523\" y=\"-69.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 0.2500</text>\n</g>\n<!-- 134557531132816exp -->\n<g id=\"node23\" class=\"node\">\n<title>134557531132816exp</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"1627\" cy=\"-73.5\" rx=\"27\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"1627\" y=\"-69.8\" font-family=\"Times,serif\" font-size=\"14.00\">exp</text>\n</g>\n<!-- 134557531133104&#45;&gt;134557531132816exp -->\n<g id=\"edge21\" class=\"edge\">\n<title>134557531133104&#45;&gt;134557531132816exp</title>\n<path fill=\"none\" stroke=\"black\" d=\"M1564.18,-73.5C1573.14,-73.5 1581.83,-73.5 1589.73,-73.5\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"1589.96,-77 1599.96,-73.5 1589.96,-70 1589.96,-77\"/>\n</g>\n<!-- 134557531133104* -->\n<g id=\"node9\" class=\"node\">\n<title>134557531133104*</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"1319\" cy=\"-73.5\" rx=\"27\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"1319\" y=\"-69.8\" font-family=\"Times,serif\" font-size=\"14.00\">*</text>\n</g>\n<!-- 134557531133104*&#45;&gt;134557531133104 -->\n<g id=\"edge4\" class=\"edge\">\n<title>134557531133104*&#45;&gt;134557531133104</title>\n<path fill=\"none\" stroke=\"black\" d=\"M1346.13,-73.5C1353.67,-73.5 1362.39,-73.5 1371.64,-73.5\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"1371.87,-77 1381.87,-73.5 1371.87,-70 1371.87,-77\"/>\n</g>\n<!-- 134557531141312 -->\n<g id=\"node10\" class=\"node\">\n<title>134557531141312</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"2751,-54.5 2751,-90.5 2936,-90.5 2936,-54.5 2751,-54.5\"/>\n<text text-anchor=\"middle\" x=\"2762.5\" y=\"-68.8\" font-family=\"Times,serif\" font-size=\"14.00\">o</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"2774,-54.5 2774,-90.5 \"/>\n<text text-anchor=\"middle\" x=\"2814\" y=\"-68.8\" font-family=\"Times,serif\" font-size=\"14.00\">data 0.7071</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"2854,-54.5 2854,-90.5 \"/>\n<text text-anchor=\"middle\" x=\"2895\" y=\"-68.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 1.0000</text>\n</g>\n<!-- 134557531141312*&#45;&gt;134557531141312 -->\n<g id=\"edge5\" class=\"edge\">\n<title>134557531141312*&#45;&gt;134557531141312</title>\n<path fill=\"none\" stroke=\"black\" d=\"M2715.04,-72.5C2722.58,-72.5 2731.3,-72.5 2740.57,-72.5\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"2740.81,-76 2750.81,-72.5 2740.81,-69 2740.81,-76\"/>\n</g>\n<!-- 134557531131568 -->\n<g id=\"node12\" class=\"node\">\n<title>134557531131568</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"716,-56.5 716,-92.5 901,-92.5 901,-56.5 716,-56.5\"/>\n<text text-anchor=\"middle\" x=\"727.5\" y=\"-70.8\" font-family=\"Times,serif\" font-size=\"14.00\">b</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"739,-56.5 739,-92.5 \"/>\n<text text-anchor=\"middle\" x=\"779\" y=\"-70.8\" font-family=\"Times,serif\" font-size=\"14.00\">data 6.8814</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"819,-56.5 819,-92.5 \"/>\n<text text-anchor=\"middle\" x=\"860\" y=\"-70.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 0.5000</text>\n</g>\n<!-- 134557531129648+ -->\n<g id=\"node16\" class=\"node\">\n<title>134557531129648+</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"1008\" cy=\"-101.5\" rx=\"27\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"1008\" y=\"-97.8\" font-family=\"Times,serif\" font-size=\"14.00\">+</text>\n</g>\n<!-- 134557531131568&#45;&gt;134557531129648+ -->\n<g id=\"edge27\" class=\"edge\">\n<title>134557531131568&#45;&gt;134557531129648+</title>\n<path fill=\"none\" stroke=\"black\" d=\"M901.02,-87.01C926,-90.43 951.59,-93.93 971.37,-96.63\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"971.05,-100.12 981.43,-98.01 972,-93.18 971.05,-100.12\"/>\n</g>\n<!-- 134557531132624 -->\n<g id=\"node13\" class=\"node\">\n<title>134557531132624</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"1690,-110.5 1690,-146.5 1877,-146.5 1877,-110.5 1690,-110.5\"/>\n<text text-anchor=\"middle\" x=\"1700\" y=\"-124.8\" font-family=\"Times,serif\" font-size=\"14.00\"> </text>\n<polyline fill=\"none\" stroke=\"black\" points=\"1710,-110.5 1710,-146.5 \"/>\n<text text-anchor=\"middle\" x=\"1752.5\" y=\"-124.8\" font-family=\"Times,serif\" font-size=\"14.00\">data &#45;1.0000</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"1795,-110.5 1795,-146.5 \"/>\n<text text-anchor=\"middle\" x=\"1836\" y=\"-124.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 0.1464</text>\n</g>\n<!-- 134557531132624&#45;&gt;134557531132576+ -->\n<g id=\"edge18\" class=\"edge\">\n<title>134557531132624&#45;&gt;134557531132576+</title>\n<path fill=\"none\" stroke=\"black\" d=\"M1877.05,-111.73C1886.54,-110.01 1895.71,-108.35 1903.95,-106.85\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"1904.64,-110.28 1913.85,-105.06 1903.39,-103.4 1904.64,-110.28\"/>\n</g>\n<!-- 134557531142944 -->\n<g id=\"node14\" class=\"node\">\n<title>134557531142944</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"2,-139.5 2,-175.5 198,-175.5 198,-139.5 2,-139.5\"/>\n<text text-anchor=\"middle\" x=\"17\" y=\"-153.8\" font-family=\"Times,serif\" font-size=\"14.00\">x1</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"32,-139.5 32,-175.5 \"/>\n<text text-anchor=\"middle\" x=\"72\" y=\"-153.8\" font-family=\"Times,serif\" font-size=\"14.00\">data 2.0000</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"112,-139.5 112,-175.5 \"/>\n<text text-anchor=\"middle\" x=\"155\" y=\"-153.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad &#45;1.5000</text>\n</g>\n<!-- 134557531142944&#45;&gt;134557531129936* -->\n<g id=\"edge24\" class=\"edge\">\n<title>134557531142944&#45;&gt;134557531129936*</title>\n<path fill=\"none\" stroke=\"black\" d=\"M198.37,-157.5C208.05,-157.5 217.4,-157.5 225.8,-157.5\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"225.91,-161 235.91,-157.5 225.91,-154 225.91,-161\"/>\n</g>\n<!-- 134557531129648 -->\n<g id=\"node15\" class=\"node\">\n<title>134557531129648</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"1071,-83.5 1071,-119.5 1256,-119.5 1256,-83.5 1071,-83.5\"/>\n<text text-anchor=\"middle\" x=\"1082.5\" y=\"-97.8\" font-family=\"Times,serif\" font-size=\"14.00\">n</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"1094,-83.5 1094,-119.5 \"/>\n<text text-anchor=\"middle\" x=\"1134\" y=\"-97.8\" font-family=\"Times,serif\" font-size=\"14.00\">data 0.8814</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"1174,-83.5 1174,-119.5 \"/>\n<text text-anchor=\"middle\" x=\"1215\" y=\"-97.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 0.5000</text>\n</g>\n<!-- 134557531129648&#45;&gt;134557531133104* -->\n<g id=\"edge12\" class=\"edge\">\n<title>134557531129648&#45;&gt;134557531133104*</title>\n<path fill=\"none\" stroke=\"black\" d=\"M1256.01,-84.81C1265.49,-83.08 1274.66,-81.41 1282.9,-79.9\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"1283.6,-83.33 1292.81,-78.09 1282.35,-76.45 1283.6,-83.33\"/>\n</g>\n<!-- 134557531129648+&#45;&gt;134557531129648 -->\n<g id=\"edge6\" class=\"edge\">\n<title>134557531129648+&#45;&gt;134557531129648</title>\n<path fill=\"none\" stroke=\"black\" d=\"M1035.04,-101.5C1042.58,-101.5 1051.3,-101.5 1060.57,-101.5\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"1060.81,-105 1070.81,-101.5 1060.81,-98 1060.81,-105\"/>\n</g>\n<!-- 134557531131184 -->\n<g id=\"node17\" class=\"node\">\n<title>134557531131184</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"672,-111.5 672,-147.5 945,-147.5 945,-111.5 672,-111.5\"/>\n<text text-anchor=\"middle\" x=\"725\" y=\"-125.8\" font-family=\"Times,serif\" font-size=\"14.00\">x1*w1 + x2*w2</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"778,-111.5 778,-147.5 \"/>\n<text text-anchor=\"middle\" x=\"820.5\" y=\"-125.8\" font-family=\"Times,serif\" font-size=\"14.00\">data &#45;6.0000</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"863,-111.5 863,-147.5 \"/>\n<text text-anchor=\"middle\" x=\"904\" y=\"-125.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 0.5000</text>\n</g>\n<!-- 134557531131184&#45;&gt;134557531129648+ -->\n<g id=\"edge23\" class=\"edge\">\n<title>134557531131184&#45;&gt;134557531129648+</title>\n<path fill=\"none\" stroke=\"black\" d=\"M936.53,-111.49C949.09,-109.71 960.99,-108.02 971.3,-106.56\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"972.03,-109.99 981.44,-105.12 971.05,-103.06 972.03,-109.99\"/>\n</g>\n<!-- 134557531131184+&#45;&gt;134557531131184 -->\n<g id=\"edge7\" class=\"edge\">\n<title>134557531131184+&#45;&gt;134557531131184</title>\n<path fill=\"none\" stroke=\"black\" d=\"M636.23,-129.5C643.7,-129.5 652.41,-129.5 661.87,-129.5\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"661.98,-133 671.98,-129.5 661.98,-126 661.98,-133\"/>\n</g>\n<!-- 134557531142992 -->\n<g id=\"node19\" class=\"node\">\n<title>134557531142992</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"2.5,-84.5 2.5,-120.5 197.5,-120.5 197.5,-84.5 2.5,-84.5\"/>\n<text text-anchor=\"middle\" x=\"19\" y=\"-98.8\" font-family=\"Times,serif\" font-size=\"14.00\">w2</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"35.5,-84.5 35.5,-120.5 \"/>\n<text text-anchor=\"middle\" x=\"75.5\" y=\"-98.8\" font-family=\"Times,serif\" font-size=\"14.00\">data 1.0000</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"115.5,-84.5 115.5,-120.5 \"/>\n<text text-anchor=\"middle\" x=\"156.5\" y=\"-98.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 0.0000</text>\n</g>\n<!-- 134557531135936* -->\n<g id=\"node25\" class=\"node\">\n<title>134557531135936*</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"263\" cy=\"-102.5\" rx=\"27\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"263\" y=\"-98.8\" font-family=\"Times,serif\" font-size=\"14.00\">*</text>\n</g>\n<!-- 134557531142992&#45;&gt;134557531135936* -->\n<g id=\"edge26\" class=\"edge\">\n<title>134557531142992&#45;&gt;134557531135936*</title>\n<path fill=\"none\" stroke=\"black\" d=\"M197.91,-102.5C207.65,-102.5 217.05,-102.5 225.52,-102.5\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"225.7,-106 235.7,-102.5 225.7,-99 225.7,-106\"/>\n</g>\n<!-- 134557531139392 -->\n<g id=\"node20\" class=\"node\">\n<title>134557531139392</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"1690.5,-0.5 1690.5,-36.5 1876.5,-36.5 1876.5,-0.5 1690.5,-0.5\"/>\n<text text-anchor=\"middle\" x=\"1700.5\" y=\"-14.8\" font-family=\"Times,serif\" font-size=\"14.00\"> </text>\n<polyline fill=\"none\" stroke=\"black\" points=\"1710.5,-0.5 1710.5,-36.5 \"/>\n<text text-anchor=\"middle\" x=\"1750.5\" y=\"-14.8\" font-family=\"Times,serif\" font-size=\"14.00\">data 1.0000</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"1790.5,-0.5 1790.5,-36.5 \"/>\n<text text-anchor=\"middle\" x=\"1833.5\" y=\"-14.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad &#45;0.1036</text>\n</g>\n<!-- 134557531131856+ -->\n<g id=\"node27\" class=\"node\">\n<title>134557531131856+</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"1940\" cy=\"-45.5\" rx=\"27\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"1940\" y=\"-41.8\" font-family=\"Times,serif\" font-size=\"14.00\">+</text>\n</g>\n<!-- 134557531139392&#45;&gt;134557531131856+ -->\n<g id=\"edge11\" class=\"edge\">\n<title>134557531139392&#45;&gt;134557531131856+</title>\n<path fill=\"none\" stroke=\"black\" d=\"M1876.6,-34.6C1886.15,-36.26 1895.37,-37.88 1903.68,-39.33\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"1903.2,-42.8 1913.65,-41.07 1904.4,-35.9 1903.2,-42.8\"/>\n</g>\n<!-- 134557531140976 -->\n<g id=\"node21\" class=\"node\">\n<title>134557531140976</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"4,-29.5 4,-65.5 196,-65.5 196,-29.5 4,-29.5\"/>\n<text text-anchor=\"middle\" x=\"19\" y=\"-43.8\" font-family=\"Times,serif\" font-size=\"14.00\">x2</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"34,-29.5 34,-65.5 \"/>\n<text text-anchor=\"middle\" x=\"74\" y=\"-43.8\" font-family=\"Times,serif\" font-size=\"14.00\">data 0.0000</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"114,-29.5 114,-65.5 \"/>\n<text text-anchor=\"middle\" x=\"155\" y=\"-43.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 0.5000</text>\n</g>\n<!-- 134557531140976&#45;&gt;134557531135936* -->\n<g id=\"edge25\" class=\"edge\">\n<title>134557531140976&#45;&gt;134557531135936*</title>\n<path fill=\"none\" stroke=\"black\" d=\"M169.28,-65.5C179.65,-68.61 190.16,-71.98 200,-75.5 210.28,-79.17 221.28,-83.74 231.11,-88.07\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"229.93,-91.37 240.48,-92.27 232.79,-84.99 229.93,-91.37\"/>\n</g>\n<!-- 134557531132816 -->\n<g id=\"node22\" class=\"node\">\n<title>134557531132816</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"1692.5,-55.5 1692.5,-91.5 1874.5,-91.5 1874.5,-55.5 1692.5,-55.5\"/>\n<text text-anchor=\"middle\" x=\"1702.5\" y=\"-69.8\" font-family=\"Times,serif\" font-size=\"14.00\"> </text>\n<polyline fill=\"none\" stroke=\"black\" points=\"1712.5,-55.5 1712.5,-91.5 \"/>\n<text text-anchor=\"middle\" x=\"1752.5\" y=\"-69.8\" font-family=\"Times,serif\" font-size=\"14.00\">data 5.8284</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"1792.5,-55.5 1792.5,-91.5 \"/>\n<text text-anchor=\"middle\" x=\"1833.5\" y=\"-69.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 0.0429</text>\n</g>\n<!-- 134557531132816&#45;&gt;134557531132576+ -->\n<g id=\"edge13\" class=\"edge\">\n<title>134557531132816&#45;&gt;134557531132576+</title>\n<path fill=\"none\" stroke=\"black\" d=\"M1874.82,-89.28C1885.07,-91.08 1895.01,-92.81 1903.88,-94.36\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"1903.3,-97.81 1913.75,-96.09 1904.5,-90.92 1903.3,-97.81\"/>\n</g>\n<!-- 134557531132816&#45;&gt;134557531131856+ -->\n<g id=\"edge14\" class=\"edge\">\n<title>134557531132816&#45;&gt;134557531131856+</title>\n<path fill=\"none\" stroke=\"black\" d=\"M1874.82,-57.13C1885.07,-55.27 1895.01,-53.47 1903.88,-51.87\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"1904.54,-55.3 1913.75,-50.08 1903.29,-48.42 1904.54,-55.3\"/>\n</g>\n<!-- 134557531132816exp&#45;&gt;134557531132816 -->\n<g id=\"edge8\" class=\"edge\">\n<title>134557531132816exp&#45;&gt;134557531132816</title>\n<path fill=\"none\" stroke=\"black\" d=\"M1654.21,-73.5C1662.34,-73.5 1671.85,-73.5 1681.94,-73.5\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"1682.19,-77 1692.19,-73.5 1682.19,-70 1682.19,-77\"/>\n</g>\n<!-- 134557531135936 -->\n<g id=\"node24\" class=\"node\">\n<title>134557531135936</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"328.5,-84.5 328.5,-120.5 543.5,-120.5 543.5,-84.5 328.5,-84.5\"/>\n<text text-anchor=\"middle\" x=\"355\" y=\"-98.8\" font-family=\"Times,serif\" font-size=\"14.00\">x2*w2</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"381.5,-84.5 381.5,-120.5 \"/>\n<text text-anchor=\"middle\" x=\"421.5\" y=\"-98.8\" font-family=\"Times,serif\" font-size=\"14.00\">data 0.0000</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"461.5,-84.5 461.5,-120.5 \"/>\n<text text-anchor=\"middle\" x=\"502.5\" y=\"-98.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 0.5000</text>\n</g>\n<!-- 134557531135936&#45;&gt;134557531131184+ -->\n<g id=\"edge20\" class=\"edge\">\n<title>134557531135936&#45;&gt;134557531131184+</title>\n<path fill=\"none\" stroke=\"black\" d=\"M543.84,-119.37C554.01,-120.98 563.76,-122.51 572.44,-123.89\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"572.05,-127.37 582.47,-125.47 573.14,-120.45 572.05,-127.37\"/>\n</g>\n<!-- 134557531135936*&#45;&gt;134557531135936 -->\n<g id=\"edge9\" class=\"edge\">\n<title>134557531135936*&#45;&gt;134557531135936</title>\n<path fill=\"none\" stroke=\"black\" d=\"M290.34,-102.5C298.51,-102.5 308.08,-102.5 318.36,-102.5\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"318.39,-106 328.39,-102.5 318.39,-99 318.39,-106\"/>\n</g>\n<!-- 134557531131856 -->\n<g id=\"node26\" class=\"node\">\n<title>134557531131856</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"2003,-27.5 2003,-63.5 2189,-63.5 2189,-27.5 2003,-27.5\"/>\n<text text-anchor=\"middle\" x=\"2013\" y=\"-41.8\" font-family=\"Times,serif\" font-size=\"14.00\"> </text>\n<polyline fill=\"none\" stroke=\"black\" points=\"2023,-27.5 2023,-63.5 \"/>\n<text text-anchor=\"middle\" x=\"2063\" y=\"-41.8\" font-family=\"Times,serif\" font-size=\"14.00\">data 6.8284</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"2103,-27.5 2103,-63.5 \"/>\n<text text-anchor=\"middle\" x=\"2146\" y=\"-41.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad &#45;0.1036</text>\n</g>\n<!-- 134557531131856&#45;&gt;134557531141168**&#45;1 -->\n<g id=\"edge22\" class=\"edge\">\n<title>134557531131856&#45;&gt;134557531141168**&#45;1</title>\n<path fill=\"none\" stroke=\"black\" d=\"M2189.14,-45.5C2220.72,-45.5 2254.24,-45.5 2278.74,-45.5\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"2278.98,-49 2288.98,-45.5 2278.98,-42 2278.98,-49\"/>\n</g>\n<!-- 134557531131856+&#45;&gt;134557531131856 -->\n<g id=\"edge10\" class=\"edge\">\n<title>134557531131856+&#45;&gt;134557531131856</title>\n<path fill=\"none\" stroke=\"black\" d=\"M1967.12,-45.5C1974.62,-45.5 1983.29,-45.5 1992.5,-45.5\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"1992.69,-49 2002.69,-45.5 1992.69,-42 1992.69,-49\"/>\n</g>\n<!-- 134557531132912 -->\n<g id=\"node28\" class=\"node\">\n<title>134557531132912</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"1072.5,-28.5 1072.5,-64.5 1254.5,-64.5 1254.5,-28.5 1072.5,-28.5\"/>\n<text text-anchor=\"middle\" x=\"1082.5\" y=\"-42.8\" font-family=\"Times,serif\" font-size=\"14.00\"> </text>\n<polyline fill=\"none\" stroke=\"black\" points=\"1092.5,-28.5 1092.5,-64.5 \"/>\n<text text-anchor=\"middle\" x=\"1132.5\" y=\"-42.8\" font-family=\"Times,serif\" font-size=\"14.00\">data 2.0000</text>\n<polyline fill=\"none\" stroke=\"black\" points=\"1172.5,-28.5 1172.5,-64.5 \"/>\n<text text-anchor=\"middle\" x=\"1213.5\" y=\"-42.8\" font-family=\"Times,serif\" font-size=\"14.00\">grad 0.2203</text>\n</g>\n<!-- 134557531132912&#45;&gt;134557531133104* -->\n<g id=\"edge28\" class=\"edge\">\n<title>134557531132912&#45;&gt;134557531133104*</title>\n<path fill=\"none\" stroke=\"black\" d=\"M1254.68,-62.36C1264.61,-64.11 1274.23,-65.8 1282.84,-67.32\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"1282.36,-70.78 1292.81,-69.07 1283.57,-63.89 1282.36,-70.78\"/>\n</g>\n</g>\n</svg>\n",
            "text/plain": [
              "<graphviz.graphs.Digraph at 0x7a611dd86e60>"
            ]
          },
          "metadata": {},
          "execution_count": 13
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "---------------"
      ],
      "metadata": {
        "id": "5kMAOl3gIn0w"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "**Hence, we have now split the tanh function and the additional operations have also been added!** \\\n",
        "\\\n",
        "**Plus, we are also getting the same output as before: o and the inputs & weights :)**"
      ],
      "metadata": {
        "id": "tfCbeRFQIou_"
      }
    }
  ]
}