0
$\begingroup$

So I was studying through some sites and saw a Linear regression problem where a company is attempting to find the correct amount to spend on marketing. The example had a small dataset with units sold and total expenditure historically. The example then shows a function with 3 variables: historic expenditure (list), units sold (list) and the desired number of units they wish to sell. The training data used the historic expense as the independent variable and the units sold as our dependent variable, which was fit with the LinearRegression model. In their example, the answer boiled down to (desired units sold - model.intercept_)/ model.coef_

so conceptually, I understand the intercept as the constant with the predictor variable @ 0, so it makes sense to subtract the constant value from our value with which we wish to predict on (our desired output of units sold) but I'm having a hard time understanding why we choose to divide that value by the model coefficients? I don't fully understand what the coefficients really mean (weights or something?). Any explanation with math would be helpful.

$\endgroup$

1 Answer 1

0
$\begingroup$

Since historic expense $E$ is an independent variable and unit sold $S$ is a dependent variable, the model should be like this

$S = m \times E + c$

where $m$ should be the model.coef_, and $c$ should be the model.intercept_.

So if you want to work back the $E$ based on a target $S$ given the model, you will do

$ \frac{S - c}{m} $

$\endgroup$
1
  • $\begingroup$ thank you, I was just getting confused what variable meant what at the end but I appreciate you for clearing it up for me in a succinct manner. Cheers! $\endgroup$ Feb 10 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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