Skip to content

paullo0106/scikit-neuralnetwork

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scikit-neuralnetwork

Deep neural network implementation without the learning cliff! This library implements multi-layer perceptrons, auto-encoders and (soon) recurrent neural networks with a stable Future Proof™ interface that's compatible with scikit-learn for a more user-friendly and Pythonic interface. It's a wrapper for powerful existing libraries such as lasagne currently, with plans for blocks.

NOTE: This project is possible thanks to the nucl.ai Conference on July 18-20. Join us in Vienna!

Build Status Documentation Status Code Coverage License Type Project Stars


Features

By importing the sknn package provided by this library, you can easily train deep neural networks as regressors (to estimate continuous outputs from inputs) and classifiers (to predict labels from features).

image

Thanks to the underlying Lasagne implementation, the code supports the following neural network features — exposed in an intuitive and well documented API:

  • Activation Functions — Sigmoid, Tanh, Rectifier, Softmax, Linear.
  • Layer Types — Convolution (greyscale and color, 2D), Dense (standard, 1D).
  • Learning Rules — sgd, momentum, nesterov, adadelta, adagrad, rmsprop, adam.
  • Regularization — L1, L2, dropout, and soon batch normalization.
  • Dataset Formats — numpy.ndarray, scipy.sparse, and iterators (via callback).

If a feature you need is missing, consider opening a GitHub Issue with a detailed explanation about the use case and we'll see what we can do.

Installation & Testing

If you want to use the latest official release, you can do so from PYPI directly:

> pip install scikit-neuralnetwork

This will install a copy of Lasagne and other minor packages too as a dependency. We strongly suggest you use a virtualenv for Python.

B) Pulling Repositories [Optional]

You'll need some dependencies, which you can install manually as follows:

> pip install numpy scipy theano lasagne

Once that's done, you can grab this repository and install from setup.py in the exact same way:

> git clone https://github.com/aigamedev/scikit-neuralnetwork.git
> cd scikit-neuralnetwork; python setup.py develop

This will make the sknn package globally available within Python as a reference to the current directory.

Running Automated Tests

image

Then, you can run the samples and benchmarks available in the examples/ folder, or launch the tests to check everything is working:

> pip install nose
> nosetests -v sknn.tests

We strive to maintain 100% test coverage for all code-paths, to ensure that rapid changes in the underlying backend libraries are caught automatically.

Getting Started

The library supports both regressors (to estimate continuous outputs from inputs) and classifiers (to predict labels from features). This is the sklearn-compatible API:

from sknn.mlp import Classifier, Layer

nn = Classifier(
    layers=[
        Layer("Rectifier", units=100),
        Layer("Linear")],
    learning_rate=0.02,
    n_iter=10)
nn.fit(X_train, y_train)

y_valid = nn.predict(X_valid)

score = nn.score(X_test, y_test)

The generated documentation as a standalone page where you can find more information about parameters, as well as examples in the User Guide.

Demonstration

To run the example that generates the visualization above using our sknn.mlp.Classifier, just run the following command in the project's root folder:

> python examples/plot_mlp.py --params activation

There are multiple parameters you can plot as well, for example iterations, rules or units. The datasets are randomized each time, but the output should be an image that looks like this...

  • Lasagne by benanne — The amazing neural network library that powers sknn.
  • Theano by LISA Lab — Underlying array/math library for efficient computation.
  • scikit-learn by INRIA — Machine learning library with an elegant Pythonic interface.
  • nolearn by dnouri — Similar wrapper library for Lasagne compatible with scikit-learn.

Build Status Documentation Status Code Coverage License Type Project Stars

About

Deep neural networks without the learning cliff! A wrapper library compatible with scikit-learn.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%