GithubHelp home page GithubHelp logo

ann-pso's Introduction

ANN-PSO

Traning Neural Network with Particle Swarm Optimization instead of Gradient Descent

  • Motivation

    • Gradient Descent requires differentiable activation function to calculate derivates making it slower than feedforward
    • To speed up backprop lot of memory is required to store activations
    • Backpropagation is strongly dependent on weights and biases initialization. A bad choice can lead to stagnation at local minima and so a suboptimal solution is found.
    • Backpropagation cannot make full use of parallelization due to its sequential nature
  • Advantages of PSO

    • PSO does not require a differentiable or continous function
    • PSO leads to better convergence and is less likely to get stuck at local minima
    • Faster on GPU

Hybrid Approach PSO+Backprop

  • The performance of PSO deteriorates as the dimensionality of search space increases.
  • For huge network use PSO for initialization and then use gradient descent

Variants

  • Local best
    • Robust against local optimas
    • Slow convergence
  • Global best
    • Fast convergence

Environment

  • Ubuntu
  • Nvidia GPU with CUDA 9
  • Python3
  • Tensorflow
  • QtCreator-QML

How to run

Testing with IRIS dataset

  • GUI
    Execute nnui in terminal

  • Terminal
    python clinn.py [OPTION]

    • --gbest: GlobalBest Factor - Global best for PSO. The higher it is, the more the particles stick together. Control Particles from going from too further.
    • --lbest: LocalBest Factor - Local best for PSO. The higher it is, the less the particle will move towards the global best. And lesser chance of convergence. Set it to higher values if you wish to increase the exploration. Set a high value if using for initialization and not training.
    • --veldec: Velocity Decay: Decay in velocity after each position update. The decay prevents the network weights going too far away.
    • --mv: Velocity Max - Maximum velocity for a particle along a dimension.
    • --mvdec: Velocity Max Decay - Multiplier for Max Velocity with each update.
    • --lr: Learning Rate: Learning Rate if Hybrid Approach. A much higher learning rate can be used with hybrid approach for learning weights.
    • --pno: Number of Particles - Number of particles.
    • --iter: Number of Iterations.
    • --bs: Batchsize for training.
    • --hybrid: Use Adam along with PSO.
    • --lr: Learning Rate if Hybrid Approach.
    • --hl: Hidden layers for the network.
    • --lbpso: Use Local Best Variant of PSO.

ann-pso's People

Contributors

asbudhkar avatar

Stargazers

 avatar

Forkers

iiitmg

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.