【发布时间】:2018-01-10 13:47:32
【问题描述】:
我在使用 LassoCV() 回归器和分组交叉验证对象时遇到了一些奇怪的错误。
更具体地说,有数据框df 和目标列y,我想执行 LeaveOneGroupOut() 交叉验证。如果我运行以下命令:
df = np.random.rand(100,50)
y = np.random.rand(100)
logo = LeaveOneGroupOut()
groups = np.random.randint(0,10,100)
lassoCV = linear_model.LassoCV(eps=0.0001, n_alphas=400, max_iter=200000, cv=logo, normalize=False, random_state=9) `
跑步:
lassoCV.fit(df,y)
导致错误:ValueError: The 'groups' parameter should not be None.
如果我跑:
lassoCV.fit(df,y,groups)
我收到错误:TypeError: fit() takes 3 positional arguments but 4 were given。
在我看来,第二种选择是可行的方法。我执行错了吗?或者这是 scikit-learn 中的错误?
【问题讨论】:
标签: python machine-learning scikit-learn regression internal