readme.md (2625B)
1 <!-- readme.md --> 2 <!-- Jacobian --> 3 4 <!-- Markdown has the worst comment syntax I've ever seen. Seriously, what is this. --> 5 <!-- TODO: Migrate this README to Org Mode. --> 6 7  8 9 ## About 10 Jacobian is a work-in-progress machine learning library written in C++ 11 designed to run as fast as possible while still being simple to 12 use. Jacobian is accessible via Python and enables you to write models that 13 train faster with the same amount of code. As of now, Jacobian supports 14 feedforward neural networks and has partial support for convolutional 15 neural networks. 16 17 ## Usage 18 19 Initializing and training a neural network with Jacobian takes just 8 lines 20 of code! 21 22 ```python 23 import jacobian as jcb 24 net = jcb.Network("./data_banknote_authentication.txt", 10, 0.0155, 0.03, jcb.L2, 1, 0.9) 25 net.add_layer(4, jcb.activations.linear, jcb.activations.linear_deriv) 26 net.add_layer(5, jcb.activations.sigmoid, jcb.activations.sigmoid_deriv) 27 net.add_layer(2, jcb.activations.linear, jcb.activations.linear_deriv) 28 # Optional: net.init_optimizer(jcb.optimizers.momentum(0.1)) 29 # Optional: net.init_decay(jcb.decays.exponential(1, 0.5)) 30 net.initialize() 31 for i in range(50): 32 net.train() 33 ``` 34 ## Examples 35 36 See `example.cpp` for an example of using Jacobian from C++, and 37 `example.py` for an example of using Jacobian from Python. 38 39 ## Building 40 41 ### Dependencies 42 Eigen 3 is the only dependency, although building the python library 43 requires `pybind11`. 44 45 ### Building with CMake 46 47 **Don't forget to delete `CMakeCache.txt` after each compilation if you 48 plan on switching things up!** 49 50 There are two target languages, five main build configurations, and a 51 number of toggleable build 'attributes'. The preferred target language can 52 be specified by setting a CMake variable from the command-line: `-DCXX=ON` 53 or `-DPYTHON=ON`. 54 55 The five main configurations correspond to differing levels of optimization. 56 57 - `cmake .`: No compiler optimizations. 58 - `cmake . -DFAST=ON`: Enables the O3 optimization layer in the compiler. 59 - `cmake . -DFASTER=ON`: Enables O3 as well as extra individual flags. 60 - `cmake . -DTRADEOFFS=ON`: All previous optimizations as well as ones that 61 sacrifice precision. 62 - `cmake . -DRECKLESS=ON`: Like `TRADEOFFS`, but defines the RECKLESS macro 63 (and NDEBUG) which skips all checks within the code. 64 65 One you've selected a main optimization level, extra configurations can be 66 passed in. 67 68 - `-DDEBUG=ON` enables debugging features in the compiler (and shows 69 warnings). 70 71 A sample build process would look like this: 72 73 ```sh 74 rm CMakeCache.txt && cmake . -DPYTHON=ON -DFASTER=ON -DDEBUG=ON && make 75 ```