Skip to content

Commit d51a757

Browse files
committed
Update README.
1 parent 4a06c97 commit d51a757

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

README.ipynb

+15-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"source": [
77
"# Nabla\n",
88
"\n",
9-
"Automatic, machine-precision forward differentiation in python using dual numbers."
9+
"Automatic, machine-precision forward differentiation in python using dual numbers.\n",
10+
"\n",
11+
"[Example use for logistic regression](examples/mnist/logistic.ipynb)"
1012
]
1113
},
1214
{
@@ -35,7 +37,7 @@
3537
"cell_type": "markdown",
3638
"metadata": {},
3739
"source": [
38-
"Support for multiple variables:"
40+
"## Support for multiple variables"
3941
]
4042
},
4143
{
@@ -68,7 +70,7 @@
6870
"cell_type": "markdown",
6971
"metadata": {},
7072
"source": [
71-
"Specify variables explicitly by position:"
73+
"## Specify variables explicitly by position"
7274
]
7375
},
7476
{
@@ -93,19 +95,22 @@
9395
"cell_type": "markdown",
9496
"metadata": {},
9597
"source": [
96-
"Use decorators; interop with numpy:"
98+
"## Use decorators; interop with numpy"
9799
]
98100
},
99101
{
100102
"cell_type": "code",
101-
"execution_count": 11,
103+
"execution_count": 17,
102104
"metadata": {},
103105
"outputs": [
104106
{
105107
"name": "stdout",
106108
"output_type": "stream",
107109
"text": [
108-
"Dual(-0.35017548837401463, [-0.2248451 -0.7651474])\n"
110+
"Dual(-0.35017548837401463, [-0.2248451 -0.7651474])\n",
111+
"[Dual(-0.35017548837401463, [-0.2248451 -0. -0. -0.7651474])\n",
112+
" Dual(-0.37840124765396416, [ 0. 0.17317819 0. -0.82682181])\n",
113+
" Dual(-0.05872664492762098, [ 0. 0. 0.41198225 -0.12832006])]\n"
109114
]
110115
}
111116
],
@@ -116,7 +121,10 @@
116121
"def f(x, y):\n",
117122
" return sin(x)*cos(y)\n",
118123
"\n",
119-
"print(f(1,2))"
124+
"print(f(1,2))\n",
125+
"\n",
126+
"# nabla can automatically differentiate w.r.t. a combination of numpy array entries and other function arguments: \n",
127+
"print(f(np.array([1,2,3]), 2))"
120128
]
121129
},
122130
{

README.md

+11-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
Automatic, machine-precision forward differentiation in python using dual numbers.
55

6+
[Example use for logistic regression](examples/mnist/logistic.ipynb)
7+
68

79
```python
810
from nabla import grad
@@ -16,7 +18,7 @@ print(grad(f)(5))
1618
Dual(75, [30.])
1719

1820

19-
Support for multiple variables:
21+
## Support for multiple variables
2022

2123

2224
```python
@@ -35,7 +37,7 @@ print(grad(f)(x, y, param, z))
3537
Dual(85, [ 4. 2. 108.])
3638

3739

38-
Specify variables explicitly by position:
40+
## Specify variables explicitly by position
3941

4042

4143
```python
@@ -46,7 +48,7 @@ print(grad([1,0])(f)(x, y, param, z))
4648
Dual(85, [2. 4.])
4749

4850

49-
Use decorators; interop with numpy:
51+
## Use decorators; interop with numpy
5052

5153

5254
```python
@@ -57,9 +59,15 @@ def f(x, y):
5759
return sin(x)*cos(y)
5860

5961
print(f(1,2))
62+
63+
# nabla can automatically differentiate w.r.t. a combination of numpy array entries and other function arguments:
64+
print(f(np.array([1,2,3]), 2))
6065
```
6166

6267
Dual(-0.35017548837401463, [-0.2248451 -0.7651474])
68+
[Dual(-0.35017548837401463, [-0.2248451 -0. -0. -0.7651474])
69+
Dual(-0.37840124765396416, [ 0. 0.17317819 0. -0.82682181])
70+
Dual(-0.05872664492762098, [ 0. 0. 0.41198225 -0.12832006])]
6371

6472

6573
## Gradient descent without any extra code

0 commit comments

Comments
 (0)