Python Random Forest warm_start=True在运行评分函数时给出值错误-操作数无法一起广播

Python Random Forest warm_start=True在运行评分函数时给出值错误-操作数无法一起广播,python,random-forest,broadcast,valueerror,Python,Random Forest,Broadcast,Valueerror,我正在实现一个随机森林预测作为我的ml模型的基线。由于我的X_train_split_xgb有形状(48195300),我需要进行批量训练(内存)。为此,我使用warm_start=True设置了randomforest,但当我启用此选项时,我在rf.predict(X_train_split_xgb行)中得到一个错误,即:ValueError:操作数不能与形状一起广播(48195210)(48195187)(48195210)。如果warm_start=False,我不会收到此错误,代码也会运

我正在实现一个随机森林预测作为我的ml模型的基线。由于我的X_train_split_xgb有形状(48195300),我需要进行批量训练(内存)。为此,我使用warm_start=True设置了randomforest,但当我启用此选项时,我在rf.predict(X_train_split_xgb行)中得到一个错误,即:ValueError:操作数不能与形状一起广播(48195210)(48195187)(48195210)。如果warm_start=False,我不会收到此错误,代码也会运行。有人知道我为什么会收到此值错误以及如何修复它吗?我已经尝试了很多东西。感谢您的帮助

X_批次具有形状(1000300)

y_批次的形状为1000

xgb有形状(48195300)

y_列_分割_xgb_编码的形状为48195

我甚至不知道它是如何试图将(48195210)(48195187)(48195210)一起广播的,210和187来自哪里

from sklearn.ensemble import RandomForestClassifier

errors = []
rf = RandomForestClassifier(n_estimators=5,  
                                     random_state=0,warm_start=True)


for X_batch, y_batch in get_batches(X_train_split_xgb,        y_train_split_xgb_encoded, 1000):

        # Run training and evaluate accuracy
        rf.fit(X_batch, y_batch)# warm_start=True
        print(X_batch.shape)
        print(rf.predict(X_train_split_xgb))
        print(rf.score(X_train_split_xgb, y_train_split_xgb_encoded))
        #pred = rf.predict(X_batch)
        #errors.append(MSE(y_batch, rf.predict(X_batch)))
        rf.n_estimators += 1
错误:

预期:代码在每次迭代中运行并给出分数。
实际:代码在loop2中停止运行,因此,当需要第二次进行预测/评分时。在rf.predict()中停止。

嗨,帕特里克,我遇到了完全相同的问题。你找到出路了吗?嗨,帕特里克,我遇到了完全相同的问题。你找到出路了吗?
ValueError: operands could not be broadcast together with shapes (48195,210)     (48195,187) (48195,210)