diff --git a/coverage.txt b/coverage.txt index 69fec64..ccb8b0d 100644 --- a/coverage.txt +++ b/coverage.txt @@ -32,10 +32,10 @@ pkg/vtreat/cross_plan.py 50 11 78% pkg/vtreat/stats_utils.py 82 3 96% pkg/vtreat/transform.py 17 4 76% pkg/vtreat/util.py 149 21 86% -pkg/vtreat/vtreat_api.py 285 57 80% -pkg/vtreat/vtreat_impl.py 650 86 87% +pkg/vtreat/vtreat_api.py 285 36 87% +pkg/vtreat/vtreat_impl.py 655 80 88% ----------------------------------------------- -TOTAL 1239 182 85% +TOTAL 1244 155 88% -============================= 28 passed in 19.27s ============================== +============================= 28 passed in 19.38s ============================== diff --git a/pkg/build/lib/vtreat/vtreat_api.py b/pkg/build/lib/vtreat/vtreat_api.py index c5d928e..58d4c0c 100644 --- a/pkg/build/lib/vtreat/vtreat_api.py +++ b/pkg/build/lib/vtreat/vtreat_api.py @@ -127,7 +127,10 @@ def transform(self, X): "possibly called transform on same data used to fit\n" + "(this causes over-fit, please use fit_transform() instead)") res = vtreat_impl.pre_prep_frame( - X, col_list=self.var_list_, cols_to_copy=self.cols_to_copy_, cat_cols=self.plan_['cat_list'] + X, + col_list=self.plan_['num_list'] + self.plan_['cat_list'], + cols_to_copy=self.cols_to_copy_, + cat_cols=self.plan_['cat_list'] ) res = vtreat_impl.perform_transform(x=res, transform=self, params=self.params_) res = vtreat_impl.limit_to_appropriate_columns(res=res, transform=self) @@ -274,7 +277,10 @@ def transform(self, X): "possibly called transform on same data used to fit\n" + "(this causes over-fit, please use fit_transform() instead)") X = vtreat_impl.pre_prep_frame( - X, col_list=self.var_list_, cols_to_copy=self.cols_to_copy_, cat_cols=self.plan_['cat_list'] + X, + col_list=self.plan_['num_list'] + self.plan_['cat_list'], + cols_to_copy=self.cols_to_copy_, + cat_cols=self.plan_['cat_list'] ) res = vtreat_impl.perform_transform(x=X, transform=self, params=self.params_) res = vtreat_impl.limit_to_appropriate_columns(res=res, transform=self) @@ -421,7 +427,10 @@ def transform(self, X): "possibly called transform on same data used to fit\n" + "(this causes over-fit, please use fit_transform() instead)") X = vtreat_impl.pre_prep_frame( - X, col_list=self.var_list_, cols_to_copy=self.cols_to_copy_, cat_cols=self.plan_['cat_list'] + X, + col_list=self.plan_['num_list'] + self.plan_['cat_list'], + cols_to_copy=self.cols_to_copy_, + cat_cols=self.plan_['cat_list'] ) res = vtreat_impl.perform_transform(x=X, transform=self, params=self.params_) res = vtreat_impl.limit_to_appropriate_columns(res=res, transform=self) @@ -558,7 +567,10 @@ def transform(self, X): if self.last_fit_x_id_ is None: raise ValueError("called transform on not yet fit treatment") X = vtreat_impl.pre_prep_frame( - X, col_list=self.var_list_, cols_to_copy=self.cols_to_copy_, cat_cols=self.plan_['cat_list'] + X, + col_list=self.plan_['num_list'] + self.plan_['cat_list'], + cols_to_copy=self.cols_to_copy_, + cat_cols=self.plan_['cat_list'] ) res = vtreat_impl.perform_transform(x=X, transform=self, params=self.params_) res = vtreat_impl.limit_to_appropriate_columns(res=res, transform=self) diff --git a/pkg/build/lib/vtreat/vtreat_impl.py b/pkg/build/lib/vtreat/vtreat_impl.py index 6a6925d..dcc006a 100644 --- a/pkg/build/lib/vtreat/vtreat_impl.py +++ b/pkg/build/lib/vtreat/vtreat_impl.py @@ -1091,7 +1091,12 @@ def predict_proba(self, X): def get_feature_names(self, input_features=None): if self.score_frame_ is None: raise ValueError("get_feature_names called on uninitialized vtreat transform") - if self.params_['filter_to_recommended']: + filter_to_recommended = False + try: + filter_to_recommended = self.params_['filter_to_recommended'] + except KeyError: + pass + if filter_to_recommended: new_vars = [self.score_frame_['variable'][i] for i in range(self.score_frame_.shape[0]) if self.score_frame_['has_range'][i] and self.score_frame_['recommended'][i] and (input_features is None or self.score_frame_['orig_variable'][i] in input_features)] diff --git a/pkg/dist/vtreat-0.5.0-py3-none-any.whl b/pkg/dist/vtreat-0.5.0-py3-none-any.whl index 6b7035b..9c0411b 100644 Binary files a/pkg/dist/vtreat-0.5.0-py3-none-any.whl and b/pkg/dist/vtreat-0.5.0-py3-none-any.whl differ diff --git a/pkg/dist/vtreat-0.5.0.tar.gz b/pkg/dist/vtreat-0.5.0.tar.gz index 6521dea..02bf186 100644 Binary files a/pkg/dist/vtreat-0.5.0.tar.gz and b/pkg/dist/vtreat-0.5.0.tar.gz differ