Brain.js: Brain.JS to be used for regression

Created on 5 Apr 2018  路  3Comments  路  Source: BrainJS/brain.js

Hi,

From the documentation and examples I see that brain.js is perfect fro classification. My question is to know if we can use brain for regression? Meaning that only one output is needed but not in the range of [0 - 1]. The out put could be a float from -10.5 till 50.5 as example...

Thanks in advance

Most helpful comment

I use it already for regression - you just have to scale the output. For example, I use it to predict the time an event will start given various factors (scheduled start time vs actual start time, etc). So I train it using a 24 hour time scale expressed 0-1, so, { input: [ /* scheduled time as 0-1, other factors */ ], output: { predicted_starttime: 0.645833333333 } - and if you multiply 0.645833333333 by 24, you'll find that it's 15:30:00.

So, just determine your range for your output, divide your desired output by the range (subtracting the base as appropriate), then invert the conversion for extracting the preduction.

In my case, to get a prediction, I do something like:

const predictedStartTime = net.run(inputData).predicted_starttime * 24;

Hope that helps!

All 3 comments

I use it already for regression - you just have to scale the output. For example, I use it to predict the time an event will start given various factors (scheduled start time vs actual start time, etc). So I train it using a 24 hour time scale expressed 0-1, so, { input: [ /* scheduled time as 0-1, other factors */ ], output: { predicted_starttime: 0.645833333333 } - and if you multiply 0.645833333333 by 24, you'll find that it's 15:30:00.

So, just determine your range for your output, divide your desired output by the range (subtracting the base as appropriate), then invert the conversion for extracting the preduction.

In my case, to get a prediction, I do something like:

const predictedStartTime = net.run(inputData).predicted_starttime * 24;

Hope that helps!

@josiahbryan I look forward to seeing results from this. Very knowledgeable reply.

@josiahbryan Thanks for the helpful guide.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

omer54463 picture omer54463  路  6Comments

SCMorgan picture SCMorgan  路  3Comments

ximik753 picture ximik753  路  3Comments

lynxionxs picture lynxionxs  路  5Comments

tyt34 picture tyt34  路  5Comments