国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

Day2_Simple_Linear_Regression

tangr206 / 1011人閱讀

Simple Linear Regression

Step 1: Data Preprocessing
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

dataset = pd.read_csv("studentscores.csv")
X = dataset.iloc[ : ,   : 1 ].values
Y = dataset.iloc[ : , 1 ].values

from sklearn.cross_validation import train_test_split
X_train, X_test, Y_train, Y_test = train_test_split( X, Y, test_size = 1/4, random_state = 0) 
Step 2: Fitting Simple Linear Regression Model to the training set
from sklearn.linear_model import LinearRegression
regressor = LinearRegression()
regressor = regressor.fit(X_train, Y_train)

# Step 3: Predecting the Result

Y_pred = regressor.predict(X_test)

# Step 4: Visualization
## Visualising the Training results

plt.scatter(X_train , Y_train, color = "red")
plt.plot(X_train , regressor.predict(X_train), color ="blue")

## Visualizing the test results

plt.scatter(X_test , Y_test, color = "red")
plt.plot(X_test , regressor.predict(X_test), color ="blue")

文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。

轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/42277.html

相關文章

發表評論

0條評論

最新活動
閱讀需要支付1元查看
<