-
Notifications
You must be signed in to change notification settings - Fork 37
IndexError: index 1 is out of bounds for axis 0 with size 1 #9
Copy link
Copy link
Open
Description
你好,我想问下,输入文件的格式是怎样的?我运行的时候出现以下bug,我猜测应该是输入特征的问题导致本来应该是二维输出最后变成了一维的。我的输入文件就是每行一条文本无空格,比如:
我是一个人。
哈哈哈哈哈。
那里有个苹果。
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-3-097136691c2f> in <module>
6 LoggingCallback(),
7 ConstantThresholdScheduler(),
----> 8 EarlyStopping(patience=2, min_delta=3)
9 ])
/usr/local/lib/python3.6/dist-packages/autophrasex/autophrase.py in mine(self, corpus_files, quality_phrase_files, N, epochs, callbacks, topk, filter_fn, **kwargs)
122
123 callback.on_epoch_reorganize_phrase_pools_begin(epoch, pos_pool, neg_pool)
--> 124 pos_pool, neg_pool = self._reorganize_phrase_pools(pos_pool, neg_pool, **kwargs)
125 callback.on_epoch_reorganize_phrase_pools_end(epoch, pos_pool, neg_pool)
126
/usr/local/lib/python3.6/dist-packages/autophrasex/autophrase.py in _reorganize_phrase_pools(self, pos_pool, neg_pool, **kwargs)
157 new_pos_pool.extend(deepcopy(pos_pool))
158
--> 159 pairs = self._predict_proba(neg_pool)
160 pairs = sorted(pairs, key=lambda x: x[1], reverse=True)
161 # print(pairs[:10])
/usr/local/lib/python3.6/dist-packages/autophrasex/autophrase.py in _predict_proba(self, phrases)
184 def _predict_proba(self, phrases):
185 features = [self._compose_feature(phrase) for phrase in phrases]
--> 186 pos_probs = [prob[1] for prob in self.classifier.predict_proba(features)]
187 pairs = [(phrase, prob) for phrase, prob in zip(phrases, pos_probs)]
188 return pairs
/usr/local/lib/python3.6/dist-packages/autophrasex/autophrase.py in <listcomp>(.0)
184 def _predict_proba(self, phrases):
185 features = [self._compose_feature(phrase) for phrase in phrases]
--> 186 pos_probs = [prob[1] for prob in self.classifier.predict_proba(features)]
187 pairs = [(phrase, prob) for phrase, prob in zip(phrases, pos_probs)]
188 return pairs
IndexError: index 1 is out of bounds for axis 0 with size 1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels