Skip to content

dcrescim/NN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Neural Net

This package aims to provide a python implementation of a neural net. This module is heavily influenced by scikit learn and Torch 7.

This neural net is fully compliant with the Estimator API present in every scikit learn estimator. Let's take a look at a simple example.

NN = NN_Regressor()
NN.add_layer(DotLayer(dim=(4,3)))
NN.add_layer()

NN.fit(X,Y)
results = NN.predict(X)
NN.error(X,Y)

Because Neural Nets are generalizations of common linear models, we can make one that acts like a Linear Regression.

We can also make one that mimics a logistic regression

NN = NN_Classifier()
NN.add_layer(DotLayer(dim=(4,3)))
NN.add_layer(SigLayer())

NN.fit(X,Y)
results = NN.predict(X)
NN.error(X,Y)

Let's build a more complicated deeper network. This will be a 4-layer network.

NN= NN_Classifier()
NN.add_layer(DotLayer(dim=(4,10)))
NN.add_layer(TanhLayer())
NN.add_layer(DotLayer(dim=10,3))
NN.add_layer(SigLayer())

NN.fit(X,Y)
results = NN.predict(X)
NN.error(X,Y)

There are two flavors of this neural net, the one that performs regression (NN_Regressor) and the one that performs classification (NN_Classifier). They share a ton of code, there are a few functions though that the classifier needs in order to stay compliant with sklearn classifier (predict_proba for one).

About

Neural Net in python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages