我有这个管道,其中X_train
和y_train
都是两个数组,具有相同的行数(所有整数和浮点数,y_train为二进制,值分别为1和0)。当我运行它时,一切似乎都进行得很顺利。这是代码:
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
from sklearn.impute import KNNImputer
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import cross_val_score, KFold
seed = 7
kfold = KFold(n_splits=10)
pipe = Pipeline([
('Scaler', StandardScaler()),
("Imputer", KNNImputer()),
('ML', RandomForestClassifier(max_depth=3))])
results = cross_val_score(pipe, X_train, y_train, cv=kfold, scoring="roc_auc")
当我尝试打印结果时,它会给我以下信息:
print(results)
array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1.])
它给出了10个值1的数组。
答案 0 :(得分:0)