Giter VIP home page Giter VIP logo

cnn's Introduction

CNN

This is Convolutional Neural Network only in python & numpy. It is simple and slow but will get the job done +1

Specification Weight Initialization : HE Normal

Weight Update Policy : ADAM, NAG, Momentum, Vanila

Active Function : ReLU, Sigmoid

Regulization : Droupout(only on fc), L2

Pooling : Max, Average

Loss Function : Softmax, Logistic

Prerequisites numpy (+ mkl for intel processors. recommend anaconda) Used sklearn for LabelEncoder & utils.shuffle on examples.

Example AND gate and CIFAR-10 examples are included.

lr = 1e-4 l2_reg = 8e-6

cnn = NeuralNetwork(train_images.shape[1:], [ {'type': 'conv', 'k': 16, 'u_type': 'nag', 'f': 5, 's': 1, 'p': 2}, {'type': 'pool', 'method': 'average'}, {'type': 'conv', 'k': 20, 'u_type': 'nag', 'f': 5, 's': 1, 'p': 2}, {'type': 'pool', 'method': 'average'}, {'type': 'conv', 'k': 20, 'u_type': 'nag', 'f': 5, 's': 1, 'p': 2}, {'type': 'pool', 'method': 'average'}, {'type': 'output', 'k': len(le.classes_), 'u_type': 'adam'} ] , lr, l2_reg=l2_reg) CIFAR-10 example gets ~72% test accuracy in 20 epoch.

API Reference classes.NeuralNetwork(self, input_shape, layer_list, lr, l2_reg=0, loss='softmax'):

Parameter Description input_shape Data's numpy shape. layer_list List of layers you want to be networked. All of properties goes to **kwargs. lr Learning rate. l2_reg L2 regularization loss Loss function. 'softmax', 'logistic'

type fc, output

classes.NeuralLayer(input_size, k, f=3, s=1, p=1, u_type='adam', a_type='relu', dropout=1)

type pool

classes.PoolLayer(input_size, f=2, s=2, method='max', dropout=1):

type conv

classes.ConvLayer(input_size, k, f=3, s=1, p=1, u_type='adam', a_type='relu', dropout=1)

cnn's People

Contributors

harshwaman 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.