1
votes

I am trying to do a simple profit prediction of an organization in the future based on the past profit in JavaScript. My dataset will be the date as x-axis and the profit as y-axis. I am new to data analytics and basically I have zero knowledge in it and I not sure which prediction algorithm will be the most suitable.

I have done some researches here and here and found out that I can actually use the Linear Regression Prediction algorithm. However, from those examples, I only saw that the prediction algorithm is simply plotting a straight line based on the data to find out the regression value and it does not predict any value for the future at all.

I wonder if the algorithm mentioned above is applicable for my case?

Thanks!

2

2 Answers

1
votes

It depends a lot on the business and how much data you have. Does the past history follow a regular linear progression? If so then a linear model would make sense. Are there ups and downs? What explains those? Is it seasonal or some other cyclical? If so you need to take those into account. Are there specific periods with huge outliers that are very uncommon? Perhaps correcting (removing) those would yield better results.

There is no one-size-fits-all solution.

0
votes

The prediction has nothing to do with JavaScript or HTML. It's just using a regression function. How to fit your function to data granted is a realm of regression analysis. You can check the least squares method to clarify your understanding.

Choosing of regression function is another issue. It's related to realm your data come from. You have to be aware of restrictions on your output so you can take a function that will fit the business logic (for example, if you have your data cyclic by a year or a day or whatever, you may wrap sin() or cos() function over another one).

There is one more method to predict. It's related to machine learning and based on artificial neural networks. If you're interested doing this with JS, I can suggest you use brain.js - the simplest library to deal with neural networks in JS.