# Relationship between correlations and model coefficients

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:

The regression coefficients are as follows:

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


The coefficients are:

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?

• DId you scale the predictor variables before fitting? – user0 Aug 6 '18 at 10:56
• No, I didn't scale them. – Ali Majed HA Aug 6 '18 at 12:26

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.

• Thanks, Yes I have normalized them using StandardScaler and it is as should be. – Ali Majed HA Aug 6 '18 at 12:49