如何解决索引错误:索引 73922 超出轴 0 的范围,大小为 73920
我尝试构建FRNN的模型:
for i,owa_weights,k in [(1,strict(),1),(2,additive(),20)]:
# Create an instance of the FRNN classifier,construct the model,and query on the test set.
clf = FRNN(nn_search=nn_search,upper_weights=owa_weights,lower_weights=owa_weights,lower_k=k,upper_k=k)
cl = clf.construct(X_train,y)
scores = model(X_test)
但我收到一个错误:
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-81-4d508eeca158> in <module>()
7 # Create an instance of the FRNN classifier,and query on the test set.
8 clf = FRNN(nn_search=nn_search,upper_k=k)
----> 9 cl = clf.construct(X_train,y)
10 scores = model(X_test)
2 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]
IndexError: index 73922 is out of bounds for axis 0 with size 73920
X_train 的形状是 (73920,300) 然后我试着像这样运行:
cl = clf.construct(X_train[-2:73920],y)
但我收到一个错误:
IndexError: index 49 is out of bounds for axis 0 with size 2
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。