Professional Documents
Culture Documents
Linear Regression On Iris Dataset: Sklearn - Linear - Model Sklearn - Model - Selection Sklearn - Metrics
Linear Regression On Iris Dataset: Sklearn - Linear - Model Sklearn - Model - Selection Sklearn - Metrics
Linear Regression On Iris Dataset: Sklearn - Linear - Model Sklearn - Model - Selection Sklearn - Metrics
In [39]:
In [40]:
In [41]:
x = iris.data # iris['data']
y = iris.target # iris['target']
In [42]:
iris['target_names']
Out[42]:
In [43]:
x_train,x_test,y_train,y_test=train_test_split(x,y,test_size=0.3,random_state=0)
In [44]:
Lin = LinearRegression()
In [45]:
Lin.fit(x_train,y_train)
Out[45]:
In [46]:
Out[46]:
In [47]:
Out[47]:
0.35017224206863307
In [48]:
Pred_y = Lin.predict(x_test)
In [49]:
acc = r2_score(y_test,Pred_y)
acc
Out[49]:
0.8998261101639005
In [50]:
Out[50]:
0.1978144333979198
In [37]:
#RMSE is a quadratic scoring rule that also measures the average magnitude of th
e error.
# The average squared difference between the estimated values and the actual val
ue
mean_squared_error(y_test,Pred_y)
Out[37]:
0.05886761921232515