Giter Club home page Giter Club logo

polynomial-regression's Introduction

Polynomial Regression

This tool allows fitting degree n polynomials to 2D data with some control over the hyperparameters used.

Usage

  1. npm install

  2. npm start

  3. Head to localhost:3000 if you aren't taken there automatically.


React js

React was chosen as the view because it is was described as the tool of choice, so it made sense to get as familiar with it as possible. It provided an easy way to build fast views in a painless way for the developer.

Materialize CSS

Materialize CSS was used to speed up the visual design process. This provided a way to create a good user experience in the shortest time possible.

File structure

Files were split into categories based on their function, with the core files such as the entry point index.js at the root directory.

Polynomials

Polynomial coefficients are encoded as values, stored in Tensors. This concept is abstracted with the Polynomial class. This was done to avoid code duplication and to abstract the individual TensorFlow API calls to the higher level concept of evaluating a point.

A factory pattern was chosen to create common Polynomial objects. This reduced code complexity.

Points are evaluated functionally. This combined with the coefficient tensors stored in an array allows arbitrary order polynomials to be used.

JavaScript Standard Style

JavaScript Standard Style was chosen because it has minimal impact on the developer.

TensorFlow.js

The CPU version of TensorFlow.js was used because this project is a lightweight demo and is optimised for compatibility rather than raw performance. In the case of training larger models, the Linux GPU TensorFlow.js is preferred for large performance gains on CUDA enabled Linux systems.

Operations involving evaluating the data were kept as tensor ops where possible to take advantage vast parallelism and to avoid inefficiencies related to moving data in and out of the TensorFlow session.

Data synthesis

For a degree n polynomial, training data is generated by creating a set of n + 1 normally-distributed coefficient values, and evaluating k points where k is the number of training samples desired. All sampling is done within the TensorFlow session to take full advantage of vast parallelism. To simulate noise, another set of k normally distributed values are sampled and added to y values. The y values are then normalized.

Training

Coefficient values are found through gradient descent on the training data.

The optimization can be customized by:

  • Selecting from a range of TensorFlow optimizers
  • Adjusting the number of iterations
  • Adjust the learning rate

polynomial-regression's People

Contributors

jdsaund avatar

Watchers

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