0
我用sklearn邏輯迴歸,並希望看到帕拉姆C,因爲我的模型似乎overfitting.So我這樣做:蟒蛇追加錯誤索引1超出範圍爲0軸大小爲1
weightes,params = [],[]
for c in np.arange(-5,5):
lr = LogisticRegression(C=10**c,random_state=0,n_jobs=-1)
lr.fit(trainDataX,trainDataY)
weightes.append(lr.coef_[1])
params.append(10**c)
但我得到:
IndexError Traceback (most recent call last)
<ipython-input-30-2b13dbdd7faf> in <module>()
4 lr = LogisticRegression(C=10**c,random_state=0,n_jobs=-1)
5 lr.fit(trainDataX,trainDataY)
----> 6 weightes.append(lr.coef_[1])
7 params.append(10**c)
IndexError: index 1 is out of bounds for axis 0 with size 1
我真的想知道爲什麼,以及如何解決這個.....