Coder Social home page Coder Social logo

learning-tensorflowjs's Introduction

Interactive Linear Regression using Tensorflow.js

This project demonstrates interactive linear regression using TensorFlow.js and p5.js. The project creates a canvas and allows the user to add data points interactively. The program then uses these data points to train a linear regression model that predicts the output variable (y) from the input variable (x). The program also visualizes the loss function in real-time using a line chart.

Link to project: Interactive Linear Regression using Tensorflow.js

Mockup of the site

Getting Started

To run this project, you can either clone the repository or download the files as a ZIP archive.

Prerequisites

You need a web browser with JavaScript support to run this project.

Installing

No installation is required. Simply open the index.html file in a web browser to run the project.

How It's Made:

Tech used: HTML, CSS, JavaScript, Tensorflow.js, p5.js, Chart.js

The program uses TensorFlow.js to train a linear regression model that predicts the output variable (y) from the input variable (x). The model is trained using stochastic gradient descent (SGD) optimization to minimize the mean squared error loss function. The program also uses p5.js to create a canvas and to visualize the data points and the linear regression model.

The program initializes the model by setting the slope and y-intercept of the linear function randomly. As the user adds more data points, the program trains the model to improve its predictions. Chart.js is used to create a line chart that displays the loss function values during the interactive linear regression. The loss function measures how well the predicted values of the model match the actual values in the dataset, thanks to that, the program visualizes the loss function (how the loss function changes as the model trains) in real-time.

Lessons Learned:

Visualization is a powerful tool for understanding data and models. In this project, visualization was used to display the accuracy and loss values of the model during training, as well as the predictions of the model on test images.

Examples:

Take a look at these couple examples that I have in my own portfolio:

Locatobia - Guide for busy tourists: https://github.com/Frosenow/Locatobia

Image Processing in Python using CUDA with Numba: https://github.com/Frosenow/Numba-GPU-Image-Processing

Red Planet Scout - Images from Mars: https://github.com/Frosenow/RedPlanetScout---Mars-Photos-Gallery

learning-tensorflowjs's People

Contributors

frosenow avatar

Watchers

 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.