def _train(self, train_datas): train_data = concat(train_datas, axis=1) y, ff = build_target_safe(self.target, self.data) y = reindex_safe(y, train_data.index) arg = self.threshold_arg if arg is None: arg = self.n_keep cols = self.selector.select(train_data, y, arg) return cols
def build(self, data, prep_index=None, train_index=None): if prep_index is None: prep_index = data.index if train_index is None: train_index = data.index datas = [] fitted_features = [] for feature in self.features: feature_data, ff = feature.build(data, prep_index, train_index) datas.append(feature_data) fitted_features.append(ff) ff = FittedFeature(self, prep_index=prep_index, train_index=train_index, inner_fitted_features=fitted_features) ff.prepped_data = self.prepare([reindex_safe(d, prep_index) for d in datas]) ff.trained_data = self.train([reindex_safe(d, train_index) for d in datas]) feature_data = self._combine_apply(datas, ff) feature_data = self._prepend_feature_name_to_all_columns(feature_data) return feature_data, ff
def build(self, data, prep_index=None, train_index=None): if prep_index is None: prep_index = data.index if train_index is None: train_index = data.index datas = [] fitted_features = [] for feature in self.features: feature_data, ff = feature.build(data, prep_index, train_index) datas.append(feature_data) fitted_features.append(ff) ff = FittedFeature(self, prep_index=prep_index, train_index=train_index, inner_fitted_features=fitted_features) ff.prepped_data = self.prepare( [reindex_safe(d, prep_index) for d in datas]) ff.trained_data = self.train( [reindex_safe(d, train_index) for d in datas]) feature_data = self._combine_apply(datas, ff) feature_data = self._prepend_feature_name_to_all_columns(feature_data) return feature_data, ff