GithubHelp home page GithubHelp logo

piyushnags / overcoming-catastrophic-forgetting-in-neural-networks Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shivamsaboo17/overcoming-catastrophic-forgetting-in-neural-networks

0.0 0.0 0.0 18 KB

Elastic weight consolidation technique for incremental learning.

Python 21.79% Jupyter Notebook 78.21%

overcoming-catastrophic-forgetting-in-neural-networks's Introduction

Overcoming-Catastrophic-forgetting-in-Neural-Networks

Elastic weight consolidation technique for incremental learning.

About

Use this API if you dont want your neural network to forget previously learnt tasks while doing transfer learning or domain adaption!

Results

The experiment is done as follow:

  1. Train a 2 layer feed forward neural network on MNIST for 4 epochs
  2. Train the same network later on Fashion-MNIST for 4 epochs This is done once with EWC and then without EWC and results are calculated on test data for both data on same model. Constant learning rate of 1e-4 is used throughout with Adam Optimizer. Importance multiplier is kept at 10e5 and sampling is done with half data before moving to next dataset
EWC MNIST Fashion-MNIST
Yes 70.27 81.88
No 48.43 86.69

Usage

from elastic_weight_consolidation import ElasticWeightConsolidation
# Build a neural network of your choice and pytorch dataset for it
# Define a criterion class for new task and pass it as shown below
ewc = ElasticWeightConsolidation(model, crit, lr=0.01, weight=0.1)
# Training procedure
for input, target in dataloader:
  ewc.forward_backward_update(input, target)
ewc.register_ewc_params(dataset, batch_size, num_batches_to_run_for_sampling)
# Repeat this for each new task and it's corresponding dataset

Reference

Paper

overcoming-catastrophic-forgetting-in-neural-networks's People

Contributors

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