我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用sklearn.feature_selection()。
def _validate_feature_selection(self): '''Validate the "feature_selection" section of config''' feature_selection = self.feature_selection = self.config.get('feature_selection') or {} if not feature_selection: return True self._validate_type(feature_selection, 'feature_selection', dict) for k, s in feature_selection.items(): self._validate_type(k, 'feature_selection:{}'.format(k), str) self._validate_type(s, 'feature_selection:{}'.format(s), dict) selection = s.get('method') if selection and selection not in dir(skfeat): raise ValueError('{} is not in dir(sklearn.feature_selection)'.format(selection)) feature_selection[k] = s self.feature_selection = feature_selection