Giter Club home page Giter Club logo

deep-learning-library's Introduction

DLL: Deep Learning Library

A deep learning library written from scratch using Numpy.

DLL is not GPU accelerated and does not contain nearly as many features as other deep learning libraries like PyTorch or Keras, so it's not practical to use. I made DLL to better understand the math behind deep learning, and because it was fun!

Example

import dll
from dll.layers import Linear, Flatten
import dll.data as data
import dll.optimizers as optimizers

train_dataset = data.MNISTDataset(train=True)
test_dataset = data.MNISTDataset(train=False)

model = dll.Model([
    Flatten((28, 28)),
    Linear(28 * 28, 128, dll.ReLU),
    Linear(128, 10)
])
model.print_summary()

model.compile(dll.CrossEntropyLoss, optimizers.SGD, learning_rate=0.01)
model.train(train_dataset, batch_size=128, epochs=50, val_split=0.1)

print()
print(f"Accuracy: {model.test(test_dataset): .3%}")

Output:

      Layer   Output Shape   # Params  
=======================================
      Input   (None, 28, 28)            
———————————————————————————————————————
    Flatten   (None, 784)           0  
———————————————————————————————————————
     Linear   (None, 128)      100480  
———————————————————————————————————————
     Linear   (None, 10)         1290  
=======================================
  Total params: 101770

Epoch 50, loss  0.062: 100%|██████████| 2700000/2700000 [01:20<00:00, 33445.49it/s]

Accuracy: 97.460%

Features

  • Layers
    • Linear
    • Flatten
  • Activations
    • Sigmoid
    • ReLU
    • Tanh
  • Loss functions
    • Binary cross-entropy (BCE)
    • Cross-entropy
    • Mean-squared error (MSE)
  • Optimizers
    • Stochastic gradient descent (SGD)

deep-learning-library's People

Contributors

tnarayanan avatar

Stargazers

 avatar

Watchers

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