[英]AttributeError: module 'sklearn.linear_model' has no attribute 'linearRegression'?
import pandas as pd
import numpy as np
from sklearn.linear_model import LinearRegression
import math
rd=pd.read_csv('homeprices.csv')
a=rd.iloc[:-1]
median_bedrooms=math.floor(a.bedrooms.median())
median_bedrooms
rd.bedrooms=rd.bedrooms.fillna(median_bedrooms)
rd
reg=LinearRegression()
After this i'm getting an bellow error:在此之后,我收到以下错误:
AttributeError Traceback (most recent call last)
<ipython-input-25-a53be8969e13> in <module>
----> 1 reg=linear_model.linearRegression()
AttributeError: module 'sklearn.linear_model' has no attribute 'linearRegression'
How can i fix this bug now?我现在该如何修复这个错误?
I don't have enough reputation to comment, but in your traceback you have我没有足够的声誉发表评论,但在您的回溯中,您有
reg=linear_model.linearRegression()
This command does not appear anywhere in your question.此命令不会出现在您的问题中的任何位置。 Indeed, if this is what you wrote, it should be
LinearRegression
, not linearRegression
事实上,如果这是你写的,它应该是
LinearRegression
,而不是linearRegression
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.