Giter Club home page Giter Club logo

numpytorch's Introduction

numpytorch

Simple neural network implementation in numpy with a PyTorch-like API

Originally made for an assignment for the course "Machine Intelligence" at PES University. Although the commits are recent, most of the code was written during the course (Oct/Nov 2020) and moved from a different repo.

What can you do with it?

This is not meant to be used for serious workloads. You can use it as a learning tool though. For example, here is a list of things you could try learning from the code here:

  • Modular implementation of neural networks - each layer is a module with many trainable parameters. Refer nn.py
  • Usage of Einstein summation operations in numpy (and in general). Here's a nice reference for Einstein summation.
  • Type annotations in python - the codebase is almost completely type-annotated. This makes the code a little easier to maintain and improves the editing experience significantly for users of the library. Although, mypy does report a few errors, most of the type annotations are correct (PRs are welcome to fix this).

Some possible future plans

I don't plan to develop this further, but if you want to learn, you can try implementing the following (either in your own fork or send a PR!):

  • More activation functions. numpytorch/activations.py has a limited set of activation functions, there are many more you can add.
  • More loss functions. numpytorch/losses.py has only one loss function (binary cross-entropy).
  • More optimisers. numpytorch/optim.py has only one optimiser (Stochastic Gradient Descent, SGD) with support for L2 regularization and momentum. The ADAM optimiser would be a nice addition.
  • Automatic differentiation. Currently, backward passes (derivatives) have to be hand-coded into all the activation functions, layers, etc. Integrating some kind of automatic differentiation library (like autograd or autodidact) would make this a lot less painful to customize. You could also try writing your own automatic differentiation library, that will be a fun project! (ref)
  • Other fancy layers like convolution, recurrent cells, etc.

Acknowledgements

Team members Aayush and Bhargav for helping.

License

numpytorch is MIT Licensed

numpytorch's People

Contributors

samyak2 avatar

Stargazers

Mudit Jha avatar Aayush Naik avatar Anirudh Rowjee avatar

Watchers

James Cloos avatar  avatar  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.