我正在使用sklearn进行Logistic回归,并且具有以下内容:
print(X)
[[4.6142807 0. 0. ... 0. 0. 0. ]
[7.9282722 0. 0. ... 0. 0. 0. ]
[4.6142807 0. 0. ... 0. 0. 0. ]
...
[0. 0. 0. ... 0. 0. 0. ]
[0. 0. 0. ... 0. 0. 0. ]
[4.6142807 0. 0. ... 0. 0. 0. ]]
print(Y)
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1]
logr = LogisticRegressionCV(max_iter=1000, cv=5)
logr.fit(X, Y)
print('cross_val_score', cross_val_score(logr, X, Y, cv=5, scoring='accuracy'))
但是我得到了错误
ValueError: This solver needs samples of at least 2 classes in the data, but the data contains only one class: 0