git commit -m "Initial commit"
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import pandas as pd
|
||||
import matplotlib.pyplot as plt
|
||||
from sklearn import linear_model
|
||||
df = pd.read_csv(open("C:\\Users\\wenyan\\PycharmProjects\\Sklearn\\data\\房源.csv"))
|
||||
fig, ax = plt.subplots()
|
||||
ax.scatter(df["room"], df["total_price"])
|
||||
|
||||
lr = linear_model.LinearRegression(normalize=True)
|
||||
X = df["room"].values.reshape(len(df["room"]), 1)
|
||||
Y = df["total_price"].values.ravel()
|
||||
lr.fit(X, Y)
|
||||
ax.plot([1, 2, 3], lr.predict([[1], [2], [3]]), 'r')
|
||||
Reference in New Issue
Block a user