我正在尝试运行 Predicted_labels:
def test_ensemble_labels(train_data, y, test_data, vector_names, NNeighbours, lower, upper):
y_pred = []
for j in range(len(vector_names)):
y_pred.append(frnn_owa_method(train_data, y, test_data, vector_names[j], NNeighbours[j], lower, upper)[1])
# Use voting function to obtain the ensembled label - we used mean
y_pred_res = np.mean(y_pred, axis=0)
return y_pred_res
predicted_labels = test_ensemble_labels(train_data, data['Label'], test_data, ["Vector_d2v"], [19], additive(), additive())
但我收到一个错误:
4 frames
/content/frlearn/neighbours/classifiers.py in <listcomp>(.0)
24 def construct(self, X, y) -> Model:
25 model: FuzzyRoughEnsemble.Model = super().construct(X, y)
---> 26 Cs = [X[np.where(y == c)] for c in model.classes]
27 model.upper_approximations = self.upper_approximator and [self.upper_approximator.construct(C) for C in Cs]
28 co_Cs = [X[np.where(y != c)] for c in model.classes]
如何解决这个问题?
答案 0 :(得分:0)
尝试像这样运行循环
for j in range(len(vector_names) - 1):
# [..Your stuff...]