Code Monkey home page Code Monkey logo

deepx's Introduction

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(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 = mlp >> 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(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!

deepx's People

Contributors

sharadmv avatar zackchase avatar turambar avatar liamb315 avatar

Watchers

Yuxin Zhu 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.