Giter Site home page Giter Site logo

keras_npi's Introduction

About

Implementation of Neural Programmer-Interpreters with Keras.

How to Demo

Demo Movie

requirement

  • Python3

setup

pip install -r requirements.txt

create training dataset

create training dataset

sh src/run_create_addition_data.sh

create training dataset with showing steps on terminal

DEBUG=1 sh src/run_create_addition_data.sh

training model

Create New Model (-> remove old model if exists and then create new model)

NEW_MODEL=1 sh src/run_train_addition_model.sh

Training Existing Model (-> if a model exists, use the model)

sh src/run_train_addition_model.sh

test model

check the model accuracy

sh src/run_test_addition_model.sh

check the model accuracy with showing steps on terminal

DEBUG=1 sh src/run_test_addition_model.sh

Implementation FAQ

These are questions about implementation that I received in the past.

about pydot

Q: I am using Python3. I am getting an error "module 'pydot' has no attribute 'find_graphviz'".

A: Let's try pydot-ng.

train_f_enc method

Q: What is the purpose of 'env_model' in 'train_f_enc' method which gets called by 'fit' method? My guess is, it is to train the weights of 'f_enc' layer.

A: Yes, that's right.


Q: Why is the target output of 'env_model' - [[first digit of sum], [ carry of sum]]? Also, why does the target output not have 'output' As per my understanding the weights of 'f_enc' layer should be trained only in 'self.model'.

A: Yes, in the original paper, 'f_enc' is trained with other layers. It is better not to be trained separately.

The reason of that in my implementation is just difficulty to train the model. Especially it seemed to hard to train layers before LSTMs (like f_enc layer). f_enc weights often became some NaNs. (I don't know why... keras problem? or ??) So, I tried to train f_enc separately, and it seemed good (not best).

NOP program

Q: what's the purpose of NOP program?

A: I do not remember it much, but NOP (No Operation) is program_id = 0. I thought that in the early days of learning, the predicted value often becomes 0, and harmless NOPs that do not perform unnecessary movements will learn more efficiently. Although it is not certain whether it is effective...

weights = [[1.]]

Q: what's the purpose of weights = [[1.]] this initialization?

A: You mean weights = [[1.]] in AdditionNPIModel#convert_output(), don't you?

The weights means learning weights of [f_end, f_prog, f_args]. The first weights = [[1.]] means "f_end's weight=1". f_prog and f_args weights are set to 1 if the teacher returns valid values.

keras_npi's People

Contributors

mokemokechicken avatar

Watchers

Liang Ding 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.