Skip to content

liamb315/deepx

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DeepX Build Status Coverage Status PyPI

DeepX is a deep learning library designed with flexibility and succinctness in mind. The key aspect is an expressive shorthand to describe your neural network architecture.

DeepX supports both Theano and Tensorflow.

Installation

$ pip install deepx

Quickstart

The first step in building your first network is to define your model. The model is the input-output structure of your network. Let's consider the task of classifying MNIST with a multilayer perceptron (MLP).

>>> from deepx.nn import *
>>> mlp = Vector(784) >> Tanh(200) >> Tanh(200) >> Softmax(10)

Another way of writing the same net would be:

>>> mlp = Vector(784) >> Repeat(Tanh(200), 2) >> Softmax(10)

Our model has a predict method, which allows us to pass data through the network. Let's test it with some dummy data:

>>> mlp.predict(np.ones((10, 784)))

10 is our batch size in this example.

Sweet! We now have an model that can predict MNIST classes! To start learning the parameters of our model, we first want to define a loss function. Let's use cross entropy loss.

>>> from deepx.loss import *
>>> loss = CrossEntropy()

Finally, we want to set up an optimization algorithm to minimize loss. An optimization algorithm takes in a model and a loss function.

>>> from deepx.optimize import *
>>> rmsprop = RMSProp(model, loss)

Finally, to perform gradient descent updates, we just call the train method of rmsprop.

>>> rmsprop.train(X_batch, y_batch, learning_rate)

That's it, we're done!

About

A basic deep learning library written using `theano` and `theanify`

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%