Giter Club home page Giter Club logo

spyne's Introduction

SpyNE

SpyNE is a minimalist deep learning famework written "purely" in python.

"proof" deep learning is easy. It's simplicty makes it an excellent tool to learn the mathematical framework behind deep learning.

SpyNE features a dead-simple api, super readable code, no dependencies (other than numpy), eager execution by default and an accessible but exhaustive explanation of the underlying mathematical framework.

Modules

SpyNE features custom implementations of the following:

  • Automatic Differentiation (Reverse Mode)
  • Optimization Engines
  • An API to translate neural architectures into the AD mini-language

Generally these are the fundamental components to all deep learning frameworks.

Installation (python 3.6+)

$ git clone https://github.com/bwhitesell/SpyNE
$ cd SpyNE
$ python setup.py install

Documentation

In Progress https://medium.com/@whitesell.ben/how-to-build-your-own-deep-learning-framework-its-easy-i-ll-prove-it-c859cb790386

Example (Defining a Neural Network in 10 Seconds)

from spyne.models import NeuralNetwork
from spyne.layers import FullyConnectedLayer

nn = NeuralNetwork()
nn.add_layer(FullyConnectedLayer(neurons=5, activation='relu', dropout=0))
nn.add_layer(FullyConnectedLayer(neurons=1, activation='linear'))

And that's it... we've defined a neural network architecture that has one hidden layer of 5 neurons per feature-axis and an ouput layer with a single neuron per feature-axis (as is desired for a regression problem).

Now let's get some data to train on...

from sklearn.datasets import load_boston
from sklearn.preprocessing import StandardScaler
boston = load_boston()

# standardize the data
scaler = StandardScaler(with_mean=False)
x = scaler.fit_transform(boston['data'])
y = boston['target']

To train our neural net is just a single line.

nn.fit(x, y, batch_size=10, epochs=20, learning_rate=.09, optimizer='rmsprop', l2=0.0000001)

The model performance will be printed as it is being trained:

Neural Network Architecture
Layers: 2
Params: 76 parameters
Using optimizer: RMSProp Optimizer


Batch 40/40, 100.0% for epoch 0:  Train Loss: 141.414 | Val Loss: 22.2118
Batch 40/40, 100.0% for epoch 1:  Train Loss: 96.3986 | Val Loss: 17.7557
Batch 40/40, 100.0% for epoch 2:  Train Loss: 74.4629 | Val Loss: 16.3234
Batch 40/40, 100.0% for epoch 3:  Train Loss: 61.1243 | Val Loss: 16.2161
Batch 40/40, 100.0% for epoch 4:  Train Loss: 51.9994 | Val Loss: 16.7056

Project Status

Completed
- Reverse Mode Auto Diff
- Neural Net API
- SGD/Momentum/RMSProp Optimization
- L2 Regularization
- Fully Connected Layers
- Dropout
- Unit Test coverage up to MLP


In Development
- Documentation
    
Not Implemented
- Convolutional Layers (2d / 1d)
- Recurrent Layers (LSTM)
- GPU support (Probably through CuPy)

spyne's People

Contributors

bwhitesell avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.