So, I'm kinda new to machine learning and I was trying to predict the monthly sales of a business using a set of features and using a sliding window of the past sales of 12 months.

I used some algorithms to do it, including linear/polynomial regression, lasso/elastic and SVR. I got the best results with elastic regression resulting in the following result: Elastic

As it shows, the model fit the mean of the curve somewhat well, but I would like it to fit the variance as well. So, I've been searching what technique or feature to use could better fit my data, but I still found nothing precise.

Would someone knows what could I do to to take the variance of the system into account?

Thanks in advance!


1 Answer 1


Your model actually looks pretty good. What it sounds like you are asking to do is to overfit your model. I would not recommend that you do that. You can do that by finding more variables that you can input into the model, fitting extra polynomial terms or anything else like that, fitting a neural network will potentially do it for you too. However, you generally want to smooth your predictions out, like what you have.

One thing that you could try is to add an autocorrelation term. That might cause your model to behave as you intend. With negative autocorrelation your predicted values will have a tendency to bounce back and forth around the mean. But I wouldn't recommend doing that, your performance will probably suffer, just judging by the graph that you provided.

  • $\begingroup$ How would one add an autocorrelation term? $\endgroup$
    – K3---rnc
    Commented Apr 18, 2017 at 8:39
  • $\begingroup$ I've seen that is possible to add autocorrelation terms in ARIMA models, but is it possible to do it in any model? $\endgroup$
    – Lucas
    Commented Apr 18, 2017 at 12:36
  • $\begingroup$ In an ARIMA model you have something like y(t)=Xb+ay(t-1)+e, specifically this will result in an ARIMAX (1,0,0) model, where a is the correlation coefficient on the autoregressive term. You can think of this as a special case for a linear function of X. You can think of any model as y=f(X)+e where f(X) is your model. So to add an autocorrelation term you have y(t)=f(X)+ay(t-1)+e. $\endgroup$
    – Ryan
    Commented Apr 19, 2017 at 20:39
  • $\begingroup$ Just add your lagged dependent variable as a regressor in your regression problem is the short practicable answer. $\endgroup$
    – Ryan
    Commented Apr 19, 2017 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.