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
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.
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 multiply0.645833333333by24, you'll find that it's15: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!