Hi guys!

After been working some days learning about the MEAN stack and how to deploy easily into a cloud platform, I bring to you my first Machine Learning Web App!!!!

https://floating-forest-89086.herokuapp.com

One

Linear Regression App

A linear regression model represent the relationship between a independent variable and an dependent variable y. This relationship is can be expressed as f(x).

In order to determine that model, a training set is needed to ‘train’ the model. This training set is composed of observations or ‘real data’. Once we have trained the model, it will be able to predict values of the variable y given values of x.

App Pipeline

  • The user introduces the training set manually. This data will be sent to the backend in order to train the linear regression model.
  • Once the model is obtained, it will be sent to the browser. This model will be displayed to the user as: f(x) = ax + b
  • The user introduces new values of to predict the f(x).

Execution

In order to train our model, introduce the training set. The Add button will save the given pair (x,y)

Two.PNG

Once you have introduced several pairs with x,y values, the ‘Obtain Model’ button generates the Linear Regression Model using the given training set.

Three.PNG

The obtained model is displayed and now you can predict new values of for any x values introduced.

Four.PNG

Conclusions

  • A Web Application that uses Machine Learning for predicting values can be developed easily using JavaScript/NodeJs.
  • Web Applications are user friendly and can be executed everywhere!
  • We can add more functionality (polynomial regression, multivariate regression) using existing libraries.
  • Linear Regression Model is trained in the server side. Once obtained, all further predictions are executed on the browser/client side.

FAQ

What programming languages are you using?

This application was developed using  JavaScript. I used ExpressJs for the back-end/server side and AngularJs for the front-end/client side.

How did you implement Machine Learning with JavaScript?

I used the libraries developed by this project: https://github.com/mljs/ml. In future entries I’ll use other components of this project to create other apps!

How can I download it?

Simple, you can clone my repository!

How can I make it work on my local computer?

Easy! Just install NodeJs and npm. Execute npm install and once your dependencies are downloaded, just execute npm start. The app will come up and you can access to it in localhost:8000.

I want to deploy my own version of this app, how can I do that?

I recommend to use Heroku. This platform allows to deploy your application to their cloud for free! Of course, there are several limitations but it will allow you to develop prototypes easily!

Are you going to release a 2.0 version? It looks you can improve it A LOT!

Yes, I’m working on the 2.0 version by now. It will include some plots and some user validations. Also, you will be able to select the polynomial degree of your model. I was just really excited about this and wanted to share it ASAP.

Advertisements