In my data set 2 features C1
and C2
are highly correlated. I did the following steps. Could you please let me know if it is correct and make sense? do you have a better approach?
First I used the linear model to find the fitted line: C1=a*C2+b
from sklearn import linear_model
reg=linear_model.LinearRegression()
y_reg=data1['C1']
x_reg=data1['C2']
reg.fit(x_reg2,y_reg2)
a=reg.coef_
b=reg.intercept_
print(a,b)
After finding a and b I removed C1
and C2
from the dataset and added a new Variable: new=a*C1+b
My next question is how I can understand if this line is good?