问题描述
处理完数据后,我得到了2组数据x and y
,然后进行了linear regression
运算,我得到R平方。
我现在想做的是检查是否可以通过删除数据集中的一些点来改善R平方。
我已经尝试过了,但R平方仍为0.94,这是原始的R平方。我不确定我是否正确使用了python的sklearn
x = numpy.array(x)
y = numpy.array(y)
x = x.reshape(-1,1)
#Spliting the dataset into Training set and Test Set
from sklearn.model_selection import train_test_split
x_train,x_test,y_train,y_test = train_test_split(x,y,test_size= 0.2,random_state=40)
#linnear Regression
from sklearn.linear_model import LinearRegression
regressor = LinearRegression()
regressor.fit(x_train,y_train)
y_pred = regressor.predict(x_test)
print(regressor.coef_)
print(regressor.intercept_)
print(regressor.score(x,y))
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)