Git Product home page Git Product logo

eql's Introduction

GitHub release (latest by date) PyPI - License GitHub issues

Introduction:

A tensorflow implementation of the Equation Learner Neural Network based model: Imgur

Functionality:

Installation:

pip:

pip install EQL-NN

or from github:

git clone https://github.com/KristofPusztai/EQL.git

Navigate to cloned directory and run setup.py

sudo python setup.py install

Creating and training a model:

from EQL.model import EQL
EQLmodel = EQL(num_layers = 2, dim=5, v = [1,1]) # num_layers -> hidden_layers, dim -> dimension of input, v -> number of binary inputs
x = tf.random_normal_initializer()(shape=(100, 5))
y = tf.random_normal_initializer()(shape=(100, 1))

EQLmodel.build_and_compile(self, metrics=None, loss_weights=None, weighted_metrics=None,
                           run_eagerly=None, kernel_regularizer=None,
                           w_init='random_normal', b_init='random_normal, exclude=None) # exclude specifies activation function exclusions in layers
                           
EQLmodel.fit(x, y, lmbda, t0=100, t1=0, t2=0, initial_epoch=0, verbose=0, batch_size=None, callbacks=None,
        validation_split=0.0, validation_data=None, shuffle=True, class_weight=None,
        sample_weight=None, steps_per_epoch=None,
        validation_steps=None, validation_batch_size=None, validation_freq=1,
        max_queue_size=10, workers=1, use_multiprocessing=False, atol=0.01)

Prediction:

EQLmodel.predict(x, batch_size=None, verbose=0, steps=None, 
                 callbacks=None, max_queue_size=10,
                 workers=1, use_multiprocessing=False)

Note: use tensor input for maximum computational efficiency

Model Information:

There are a variety of methods for understanding what is going on in your model.

EQLmodel.summary() # Provides tensorflow summary
EQLmodel.count_params() # Provides # trainable params
EQLmodel.get_weights(layer) #returns array of layer values
EQLmodel.set_weights(layer, weights) #sets weights of specified layer

EQLmodel.evaluate(x=None, y=None, batch_size=None, verbose=1,
                  sample_weight=None, steps=None,
                  callbacks=None, max_queue_size=10, 
                  workers=1, use_multiprocessing=False,
                  return_dict=False)
# Returns the loss value & metrics values for the model

Can also access the tensorflow model directly to use other TensorFlow functions such as saving:

EQLmodel.model.save('path/to/save')

Implementation Notes:

Training regiment is interpretted as debiased LASSO:

  • T0 epochs are normal training, no regularization
  • T1 epochs are L1 regularized training, continuing where T0 ended
  • T2 epochs are L0 (weights with values close to 0, |w| < atol, are rounded to 0 and left untrained) regularized training, continuing from T1

Check out the jupyter notebook for examples on learning sinusoidal functions: https://github.com/KristofPusztai/EQL/blob/master/Jupyter%20Notebooks/EQLtest.ipynb

eql's People

Contributors

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