Indexer错误:索引50552超出了大小为50552的轴0的界限

v1uwarro  于 2021-09-08  发布在  Java
关注(0)|答案(1)|浏览(350)

我正在尝试运行以下标签:

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]


如何解决这个问题?

eni9jsuy

eni9jsuy1#

试着像这样运行循环

for j in range(len(vector_names) - 1):
    # [..Your stuff...]

相关问题