duxuhao / Feature-Selection

Features selector based on the self selected-algorithm, loss function and validation method

Home Page:https://pypi.org/project/MLFeatureSelection/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sf = FS.Select(Sequence = False, Random = True, Cross = True)

onthehilluu opened this issue · comments

If setting Cross=True, an error occurs when testing examples.


AttributeError Traceback (most recent call last)
in
66 sf.clf = lgbm.LGBMRegressor(random_state=1, num_leaves =6, n_estimators=1000, max_depth=3, learning_rate = 0.2, n_jobs=8) #设定回归模型
67 sf.SetLogFile('record.log') #初始化日志文件
---> 68 sf.run(validate) #输入检验函数并开始运行
69
70

~/anaconda2/envs/mypython3/lib/python3.6/site-packages/MLFeatureSelection/sequence_selection.py in run(self, validate)
488 SampleMode = self._samplemode
489 )
--> 490 best_feature_comb = a.select()
491 #best_feature_comb = a._bestfeature
492 with open(self._logfile, 'a') as f:

~/anaconda2/envs/mypython3/lib/python3.6/site-packages/MLFeatureSelection/sequence_selection.py in select(self)
112 # only if the small cycle cross can construct better features,
113 # then start next small round, otherwise, go to medium cycle
--> 114 self._CrossTermSearch(self._bestfeature, self._bestfeature)
115 n = 0
116 if self._greedyscore == self._score:

~/anaconda2/envs/mypython3/lib/python3.6/site-packages/MLFeatureSelection/sequence_selection.py in _CrossTermSearch(self, col1, col2)
270 for c1 in col1:
271 for c2 in col2[::-1]:
--> 272 for oper in self._CrossMethod.keys():
273 print('{}/{}'.format(crosscount, len(self._CrossMethod.keys()) * len(col1) * len(col2[::-1])))
274 crosscount += 1

AttributeError: 'int' object has no attribute 'keys'