Subscribe to DSC Newsletter

Constraint in a Linear Regression Algorithm

Hi ,

I am forecasting sales and the Investment needed. I need to modify the algorithm to limit the budget to a specified number and forecast sales based on that.

I am currently using a Linear Regression algorithm in R.

Thanks for the help.


Views: 324

Reply to This

Replies to This Discussion

Hello Hemanth,

It's unclear to me what your question is.  Can you please be more specific?


Hi Tim, Thanks for the reply. Let me summarize what I am trying to do.

Based on the Budget Allocated I should be able to predict sales. 

Statement 1 : I am able to predict sales based on liner regression but now I want to put in a constraint saying which country how much of budget I am allocating based on that the sales prediction should change.

How do I put a constraint like this.

Thanks for the help in advance.

Warm Regards,


Typical constrained regression models include ridge regression and Lasso regression, but they put constraints on the regression coefficients, and I don't think that's what you try to do here. If I understand correctly, you try to predict S (sales) as a function of budget B (and other metrics X such as competitor pricing, your pricing etc.) say S = f(B, X). Just run a regular regression model, and ignore all predicted values above some value of B -- your maximum allowed budget. Maybe I am missing something?



Or, is this really a Linear Programming problem?  Wanting to maximize total sales across countries, constrained by the total budget to be allocated across those countries?

Hi Hemanth,

General answer: feature engineering is one of the key components of good performance within shallow algorithms field.

More specific: for restricting any value, one of the classical approaches is to alter the problem from MAX to MIN. So you could switch from Y1(budget to allocate) & B(max budget) to Y2 = B-Y1 or even Y2 = (B-Y1)/B problem (normalized for linear regression) and train a new model F2(X), where X is you feature vector. Now, accordingly to Vincent's recommendation you should monitor and modify your predictions such that you have no negative values.

Hope it helps.

Hi Vincent ,Wayne and Danylo,

Thanks for your replies. Well I am new to Machine Learning and based on what i have learnt i felt it was a regression problem.

Let me define the problem statement a little more clear and illustrate with data. It would be helpful if you folks let me know once have i assume correctly that this is a linear regression problem if not what should i be using and can point me to any material that would help.

Based on this data It gives me how much of Sales can be made based on the discounts a sales person can give to a customer now . Now if the Sales person is given a discount budget let us say 5 $ for two weeks which of these options should the sales person go for for Product 1 and Product 2 so that the person makes the most sales with the least discount possible is what I am trying to optimize or recommend.

Thanks for your views and help in advance.


Reply to Discussion


Follow Us


  • Add Videos
  • View All


© 2018   Data Science Central   Powered by

Badges  |  Report an Issue  |  Privacy Policy  |  Terms of Service