When I try to perform regression analysis in Python, I get an error when I proceed as per the site I refer to.Please tell me the solution.
error message
AttributeError
'LinearRegression' object has no attribute 'pledict'
source code
import pandas as pd
import matplotlib.pyplot asplt
import time
from sklearn.linear_model import LinearRegression
import seaborn
df = pd.read_csv("path of csv")
time.sleep(0.5)
x = df [['x']]
y = df [['y']]
model=LinearRegression()
model.fit(x,y)
plt.plot(x,y,'o')
plt.plot(x,model.pledict(x))<<<Error here
plt.show()
Additional
Rewrite the same amount and
in the same place.
AttributeError
'DataFrame' object has no attribute 'model' appears
The spelling is different.
plt.plot(x,model.pledict(x))<<<Error here
plt.plot(x,model.predict(x))<<<Error here
© 2024 OneMinuteCode. All rights reserved.