commit 9bf64326838a903dcc1cf9390fc7e056bf99a1c2
parent ea4890b8fb55d9abdda7f0af0f772df753874327
Author: David Freifeld <freifeld.david@gmail.com>
Date: Mon, 29 Mar 2021 11:41:12 -0700
Update python examples to use submodules
Diffstat:
2 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/example.py b/example.py
@@ -4,11 +4,11 @@ import matplotlib.pyplot as plt
import numpy as np
import time
net = jcb.Network("./data_banknote_authentication.txt", 10, 0.0155, 0.03, jcb.L2, 1, 0.9)
-net.add_layer(4, jcb.linear, jcb.linear_deriv)
-net.add_layer(5, jcb.sigmoid, jcb.sigmoid_deriv)
-net.add_layer(2, jcb.linear, jcb.linear_deriv)
-net.init_optimizer(jcb.momentum(0.1))
-net.init_decay(jcb.exponential(1, 0.5))
+net.add_layer(4, jcb.activations.linear, jcb.activations.linear_deriv)
+net.add_layer(5, jcb.activations.sigmoid, jcb.activations.sigmoid_deriv)
+net.add_layer(2, jcb.activations.linear, jcb.activations.linear_deriv)
+net.init_optimizer(jcb.optimizers.momentum(0.1))
+net.init_decay(jcb.decays.exponential(1, 0.5))
net.initialize()
fig, axs = plt.subplots()
accuracies = []
diff --git a/readme.md b/readme.md
@@ -1,14 +1,13 @@
-
<!-- readme.md -->
<!-- Jacobian -->
<!-- Created by David Freifeld -->
- <!-- Markdown has the worst comment syntax I've ever seen. Seriously, what is this. TODO: Migrate this README to Org Mode. -->
+ <!-- Markdown has the worst comment syntax I've ever seen. Seriously, what is this. TODO: Migrate this README to Org Mode. -->

## About
-Jacobian is a work-in-progress machine learning library written in C++ designed to run as fast as possible while still being simple to use. Jacobian is accessible via Python and enables you to write models that train faster with the same amount of code. As of now, Jacobian supports feedforward neural networks and has partial support for convolutional neural networks.
+Jacobian is a work-in-progress machine learning library written in C++ designed to run as fast as possible while still being simple to use. Jacobian is accessible via Python and enables you to write models that train faster with the same amount of code. As of now, Jacobian supports feedforward neural networks and has partial support for convolutional neural networks.
## Usage
@@ -16,11 +15,11 @@ Initializing and training a neural network with Jacobian takes just 8 lines of c
```python
import jacobian as jcb
net = jcb.Network("./data_banknote_authentication.txt", 10, 0.0155, 0.03, jcb.L2, 1, 0.9)
-net.add_layer(4, jcb.linear, jcb.linear_deriv)
-net.add_layer(5, jcb.sigmoid, jcb.sigmoid_deriv)
-net.add_layer(2, jcb.linear, jcb.linear_deriv)
-# Optional: net.init_optimizer(jcb.momentum(0.1))
-# Optional: net.init_decay(jcb.exponential(1, 0.5))
+net.add_layer(4, jcb.activations.linear, jcb.activations.linear_deriv)
+net.add_layer(5, jcb.activations.sigmoid, jcb.activations.sigmoid_deriv)
+net.add_layer(2, jcb.activations.linear, jcb.activations.linear_deriv)
+# Optional: net.init_optimizer(jcb.optimizers.momentum(0.1))
+# Optional: net.init_decay(jcb.decays.exponential(1, 0.5))
net.initialize()
for i in range(50):
net.train()
@@ -50,7 +49,7 @@ Note: This is all ideally the process for manual building, but it's so confusing
There are two target languages, five main build configurations, and a number of toggleable build 'attributes'. The preferred target language can be specified by setting a CMake variable from the command-line: `-DCXX=ON` or `-DPYTHON=ON`.
The five main configurations correspond to differing levels of optimization.
-
+
- `cmake .`: No compiler optimizations.
- `cmake . -DFAST=ON`: Enables the O3 optimization layer in the compiler.
- `cmake . -DFASTER=ON`: Enables O3 as well as extra individual flags.
@@ -61,8 +60,8 @@ One you've selected a main optimization level, extra configurations can be passe
- `-DDEBUG=ON` enables debugging features in the compiler (and shows warnings).
-A sample build process would look like this:
+A sample build process would look like this:
-```)
+```sh
rm CMakeCache.txt && cmake . -DPYTHON=ON -DFASTER=ON -DDEBUG=ON && make
```