2
$\begingroup$

I have done a machine learning regression task. I am confused by the correlations and regression coefficient. The correlations of the datasets are depicted using seaborn library heatmap:

sns.heatmap(usa_housing_price.corr(), annot=True, cmap='coolwarm')

The result is:
Correlations between features

The regression coefficients are as follows:

coef = pd.DataFrame(linear_model.coef_, X.columns)
coef.columns = ['Coefficients']
coef

The coefficients are:
Regression coefficients

My question is despite the "Avg. Area Income" is the most correlated feature with the "Price", it has less impact on "Price" in compare of other features?
How this tow parameter related to each other?

$\endgroup$
2
  • 1
    $\begingroup$ DId you scale the predictor variables before fitting? $\endgroup$ Commented Aug 6, 2018 at 10:56
  • $\begingroup$ No, I didn't scale them. $\endgroup$ Commented Aug 6, 2018 at 12:26

1 Answer 1

3
$\begingroup$

The pandas corr function uses Pearson correlation by default, which is the covariance of the variables divided by their standard deviations.

Because you did not normalise your variables, the coefficients in inverse ration to the scale of your variables.

the range of Avg. number of rooms is 1-5 whereas Avg. area income is in scale of ~100000.

looking at the coefficients: adding a room will increase the predicted price in 121,185, while increasing Avg. area income by 1 will increase the predicted price by 21.

$\endgroup$
1
  • 1
    $\begingroup$ Thanks, Yes I have normalized them using StandardScaler and it is as should be. $\endgroup$ Commented Aug 6, 2018 at 12:49

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.