我在使用RandomForest fit函数时遇到了麻烦
这是我的训练集
P1 Tp1 IrrPOA Gz Drz2
0 0.0 7.7 0.0 -1.4 -0.3
1 0.0 7.7 0.0 -1.4 -0.3
2 ... ... ... ... ...
3 49.4 7.5 0.0 -1.4 -0.3
4 47.4 7.5 0.0 -1.4 -0.3
... (10k rows)
Run Code Online (Sandbox Code Playgroud)
感谢使用sklearn.ensemble RandomForest的所有其他变量,我想预测P1
colsRes = ['P1']
X_train = train.drop(colsRes, axis = 1)
Y_train = pd.DataFrame(train[colsRes])
rf = RandomForestClassifier(n_estimators=100)
rf.fit(X_train, Y_train)
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误:
ValueError: Unknown label type: array([[ 0. ],
[ 0. ],
[ 0. ],
...,
[ 49.4],
[ 47.4],
Run Code Online (Sandbox Code Playgroud)
我没有发现任何有关此标签错误的信息,我使用的是Python …