adds get_feature_names_out() method and feature_names_in_ attribute - #372
Merged
Conversation
Collaborator
Author
|
Waiting for #369 to update selectors |
Collaborator
Author
|
If you fancy, feel free to add the |
Collaborator
Author
+ added checks for feature name output on tests
- store input features on fit - use transformed array to compare output of `get_feature_names` in tests
+ update tests as well
* Draft fix computing performance * lay-out * Remove assignment of y to pandas series * Enforce y has iloc attribute in shuffle feature selection * Remove unused argument in the test Co-authored-by: Gilles Verbockhaven <gilles.verbockhaven@ing.com>
* replaces imputation loop by dictionary within fillna * renamed private method * replaces np.where by pd.isna() in missing indicators * modified mode imputation to remove loop * updates wording in base imputer * removes redundant df copy * adds test for double mode error * reformats transform method of categorical imputer * adds whats new in this pr
* add new folder * create TargetMeanPredictor class and its outline * built more of TargetMeanPredictor class framework * add 3 init params * expand fit() method * add discretisers to fit() method * add 'numeric_var_startegy' param and cleaned up init() * create new init params * identify variable types * instatiate encoder and discretisers in fit() * instatiate and fit encoder and discretiser * add init params and check * create disc_mean_dict to store means for the bins of each numerical variable * add checks in predict() * create test_prediction directory and files * start creating first check * create df_pred() in conftest.py * create prediction init file and expand test_target_mean_predictor_fit() * fix bugs * fix bugs * create df_pred() to test TestMeanPredictor * bug: KeyError:None when slicing df_pred even though all variables exists w/in df. sucessfully printed sliced df using column names * resolve bug in fit(). code pass initial part of test_target_mean_predictor_fit * add df checks and bins to the discretisers * add fit params tests * add test for fit params * add test for fit params * create code for predict(). outstanding items to be discussed. * add functionality in fit() if self.variables is None and rearrange 2 lines of code in fit() * create _make_categorical_pipeline() * create _make_numerical_pipeline() * create _make_combine_pipeline() * incorporate pipeline methods into fit() * incorporate pipeline methods into fit() * edit bins check in init method * delete ignore_format param * delete ignore_format param * remove variables check in the beginning of fit() * clean fit() code * start refactoring predict() * refactor fit() and predict() * update MeanEncoder instantiations * update fit params test * create conftest_prediction and move df_pred() from conftest to conftest_prediction * fix docstring * refactor file * complete predict() * create df_pred_small() in conftest * refactor pipeline code * create test_target_mean_predictor_transformation() * start creating r2_score and clean code * create mean_accuracy_score() * edit df_pred_small() * refactor code * create test_r2_score_calculation_with_equal_distance() * refactor code * add binary-label feature to df_pred and df_pred_small * fix styler errors" * fix style errors * fix style errors * fix style errors * fix style errors * add 'regression=False' to DecisionTreeEncoder() in test_check_estimator_encoders.py * coalesce r_squared_score() and mean_accuracy_score() to create score() * clean code * add 'Height_cm' feature to dataframes * add test_predictor_with_all_numerical_variables() * clean code * add new tests * create test_error_if_df_contains_na_in_fit() and test_error_if_df_contains_na_in_transform() * create test_error_when_x_is_not_a_dataframe() * fix styler errors * add dataframe check * fix test code * create BaseTargetMeanPredictor class * add fit() and supporting methods to BaseTargetMeanPredictor class * add init() and predict() to TargetMeanRegressor * expand BaseTargetMeanEstimator docstring * expand docstrings * clean code * create TargetMeanClassifier class * revise precition __init__.py * create predict_proba for TargetMeanClassifier * change test_target_mean_prediction.py to test_target_mean_regressor.py * clean code on test_target_mean_prediction.py * resolve errors returned from test_target_mean_regressor.py * edit TargetMeanClassifier init * create TargetMeanClassifier class * fix error * changes wording init * refactors base perdictor, expands variable detection * refactors target mean regressor * finish refactoring code * final edits of docstrings * add numpy array check for y_pred in TargetMeanRegressor * add 2d numpy array check for 'prob' in TargetMeanClassifier * edit warning string * add 2-column numpy array check for 'log_prob' in TargetMeanClassifier * add numpy check to TargetMeanClassifier predict() * create test_raises_error_when_wrong_input_params() * create test_default_params() * delete test_incorrect_strategy_during_instantiation() * delete test_incorrect_bin_value_during_instantiation() * clean code in test_target_mean_regressor.py * create test_raises_error_when_not_fitting_a_df() using mark.parametrize * create test_raises_error_when_not_transforming_a_df() and clean test code * refactor code * clean text * create test_target_mean_classifier.py and add 2 tests * create test_attributes_upon_fitting() * refactor test_attributes_upon_fitting() for TargetMeanRegressor * fix error * fix bug on test files * fix regressors test errors except for Pipeline attribute. Cause is unclear given the results are identical. * add typehint to _find_categorical_and_numerical_variables() * fix _find_categorical_and_numerical_variables() * fix test_attributes_upon_fitting() error for regressor * fix test_attributes_upon_fitting() error for classifier * fix clsfr predict() * create test_classifier_prediction_results_with_all_numerical_variables() * edit df_pred_small * create test_classifier_results_with_all_categorical_variables() * create two clsfr tests * revise rgrsr test_raises_error_when_df_has_nan() * create clsfr test_error_if_df_contains_na_in_transform() * create clsfr test_raises_error_when_not_fitting_a_df() * fix style errors * create 2 tests for test_variable_manipulation * add 1 test and refactor code * create df_enc_categorical_and_numeric * create test_find_cat_and_num_vars_df_contains_num_and_cat() for test_variable_manipulation * create test for when user passes None, df contains numerical for test_variable_manipulation * create test for when user passes None, df contains categorical for test_variable_manipulation * create test for user passes empty list, function raises error for test_variable_manipulation * create 3 tests for test_variable_manipulation * fix bug in _find_categorical_and_numerical_variables() * try to debut test_error_find_cat_and_num_vars_datetime_var() * rename unit tests * fix style error * consolidating test__find_categorical_and_numeric. can a df be passed to @pytest.mark.parameterize? * consolidating test__find_categorical_and_numeric. can a df be passed to @pytest.mark.parameterize? * fix dataframe checks in BaseTargetMeanEstimator * revise dataframe checks. try sklearn check_X_y cause upstream errors b/c fcn returns numpy arrays which don't have dtypes * clean code for BaseTargetMeanEstimator and TargetMeanClassifier * change df_enc_categorical_and_numeric to df_vartypes * delete df_enc_categorical_and_numeric * expand test_classifier_results_with_all_categorical_variables() * update test_classifier_results_with_all_numerical_variables() and fix test_attributes_upon_fitting() * update test_regression_score_calculation_with_equal_frequency * create test_regressor_with_two_variables() * create 2 regressor tests * add 1 regressor test * fix TargetMeanClassifier fit() * create 2 tests for TargetMeanClassifier * refactor classifier test code * change 2 unit test names * updates encoding tests * updates variable manipulation * improves function to select num and cat vars * resets tests variable manipulation * finishes tests new var selection method * fixes codestyle in var manipulation files * renames folder and updates base predictor * reformats basepredictor * updates target mean classifier * updates target mean regressor * small fix * finishes general checks for all prediction classes * adds tests for classifier * first draft tests * finishes tests predictors * fixes bug * removed notebook * split predict method in transform and predict * deprecates pipeline attr and replaces by encoding dicst * refactors assignment * last touches to predictor classes * finishes target selection and tests * fix typos * updates user guide of select by target mean Co-authored-by: sana <sana@fraugster.com> Co-authored-by: Morgan-Sell <morganpsell@gmail.com>
solegalli
added a commit
that referenced
this pull request
Mar 29, 2022
…erformance, estimators and more (#372) * Added `get_feature_names` API to encoders + added checks for feature name output on tests * Corrected type hinting for `input_features` parameter * Simplify `get_feature_names` - store input features on fit - use transformed array to compare output of `get_feature_names` in tests * Update base transformer with new method + update tests as well * adds functionality to transformation module * adds functionality to discretization module * adds tests to estimator checks * adds func to base num transformer * fixes minor wordning * fixes minor wordning * fixes minor wordning * update discretisation transformers * update discretisation transformers * fixes all * updates discretisers * removes test from tree disc * update base categorical * updates tree encoder * updates encoders and tests * updates tests encoders * add tests ohe get names out * adds tests for errors * minor adjustment transformers * removes unnecessary docstrings workaround * update imputers and tests * test missing indicator get f names out * updates outliers * updates match variables * adds get_f_name_out to selectors * adds test get feature out selectors * adds tests for selectors * uncomments tests * aligns code line * blacks single feat perf * starts changes to sklearn wrapper * expands sklearn wrapper * expands test on allowed transformers * expands sklearn wrapper * finishes sklearn wrapper * fixes codestyle * rebases main after merging #360 * remove todo from time series * remove unwanted notebook * add get feature names to datetime transformer * fixes getfeatnames bug * add additional test datetime * adds first attempt in get feat names out creation * remove type hint from base transformer attribute * deprecates creation transformers * deprecates creators * reorganises common checks * fixes style * fixes typehint issues * refactors tags in encoders, adds comment in discreatiser base * removed 2 tests for encoders, they are now in general tests * edits estimator_checks docstrings and fixes minor bugs * changes wording in cyclicalfeatures adds fixme in creation init * remove get_feature_out func from deprecated creation transformers * add common checks to creation transformers * adds common tests to creation and datetime, sorts style issues * changes wording of estimatorchecks * changes wording in docstring base_creation * adds doc files for new creation classes * changes wording in mathfeatures * reorders df in datetime and changes wording in comments * reformulates get_feat_names_out missing indicator * creates abstraction of features_names_in * removed unused tag in matchvariables * removes duplicated df check from recursive selectors * creates abstraction for featurenamesin in selectors * changes wording sklearn wrapper * updates common tests wrapper * updates tests cyclicalfeatures * fixes style issues * updates relative features logic * updates cyclical features user guide * adds get feature names out demo * creates docs for new creation modules * updates readme and remaining links * adds link to example jupyter notebooks repo * adds all methods in docstrings * adds whats new * fixes error in select by target mean performance * fixes name contributor * fixes whitespace issue * updates sklearn version requirement * removes support for python 3.6 * Fixes CV split bug in SelectByShuffling (#384) * Draft fix computing performance * lay-out * Remove assignment of y to pandas series * Enforce y has iloc attribute in shuffle feature selection * Remove unused argument in the test Co-authored-by: Gilles Verbockhaven <gilles.verbockhaven@ing.com> * replaces imputation loop by dictionary within fillna (#391) * replaces imputation loop by dictionary within fillna * renamed private method * replaces np.where by pd.isna() in missing indicators * modified mode imputation to remove loop * updates wording in base imputer * removes redundant df copy * adds test for double mode error * reformats transform method of categorical imputer * adds whats new in this pr * improves select by target mean functionality (#390) * add new folder * create TargetMeanPredictor class and its outline * built more of TargetMeanPredictor class framework * add 3 init params * expand fit() method * add discretisers to fit() method * add 'numeric_var_startegy' param and cleaned up init() * create new init params * identify variable types * instatiate encoder and discretisers in fit() * instatiate and fit encoder and discretiser * add init params and check * create disc_mean_dict to store means for the bins of each numerical variable * add checks in predict() * create test_prediction directory and files * start creating first check * create df_pred() in conftest.py * create prediction init file and expand test_target_mean_predictor_fit() * fix bugs * fix bugs * create df_pred() to test TestMeanPredictor * bug: KeyError:None when slicing df_pred even though all variables exists w/in df. sucessfully printed sliced df using column names * resolve bug in fit(). code pass initial part of test_target_mean_predictor_fit * add df checks and bins to the discretisers * add fit params tests * add test for fit params * add test for fit params * create code for predict(). outstanding items to be discussed. * add functionality in fit() if self.variables is None and rearrange 2 lines of code in fit() * create _make_categorical_pipeline() * create _make_numerical_pipeline() * create _make_combine_pipeline() * incorporate pipeline methods into fit() * incorporate pipeline methods into fit() * edit bins check in init method * delete ignore_format param * delete ignore_format param * remove variables check in the beginning of fit() * clean fit() code * start refactoring predict() * refactor fit() and predict() * update MeanEncoder instantiations * update fit params test * create conftest_prediction and move df_pred() from conftest to conftest_prediction * fix docstring * refactor file * complete predict() * create df_pred_small() in conftest * refactor pipeline code * create test_target_mean_predictor_transformation() * start creating r2_score and clean code * create mean_accuracy_score() * edit df_pred_small() * refactor code * create test_r2_score_calculation_with_equal_distance() * refactor code * add binary-label feature to df_pred and df_pred_small * fix styler errors" * fix style errors * fix style errors * fix style errors * fix style errors * add 'regression=False' to DecisionTreeEncoder() in test_check_estimator_encoders.py * coalesce r_squared_score() and mean_accuracy_score() to create score() * clean code * add 'Height_cm' feature to dataframes * add test_predictor_with_all_numerical_variables() * clean code * add new tests * create test_error_if_df_contains_na_in_fit() and test_error_if_df_contains_na_in_transform() * create test_error_when_x_is_not_a_dataframe() * fix styler errors * add dataframe check * fix test code * create BaseTargetMeanPredictor class * add fit() and supporting methods to BaseTargetMeanPredictor class * add init() and predict() to TargetMeanRegressor * expand BaseTargetMeanEstimator docstring * expand docstrings * clean code * create TargetMeanClassifier class * revise precition __init__.py * create predict_proba for TargetMeanClassifier * change test_target_mean_prediction.py to test_target_mean_regressor.py * clean code on test_target_mean_prediction.py * resolve errors returned from test_target_mean_regressor.py * edit TargetMeanClassifier init * create TargetMeanClassifier class * fix error * changes wording init * refactors base perdictor, expands variable detection * refactors target mean regressor * finish refactoring code * final edits of docstrings * add numpy array check for y_pred in TargetMeanRegressor * add 2d numpy array check for 'prob' in TargetMeanClassifier * edit warning string * add 2-column numpy array check for 'log_prob' in TargetMeanClassifier * add numpy check to TargetMeanClassifier predict() * create test_raises_error_when_wrong_input_params() * create test_default_params() * delete test_incorrect_strategy_during_instantiation() * delete test_incorrect_bin_value_during_instantiation() * clean code in test_target_mean_regressor.py * create test_raises_error_when_not_fitting_a_df() using mark.parametrize * create test_raises_error_when_not_transforming_a_df() and clean test code * refactor code * clean text * create test_target_mean_classifier.py and add 2 tests * create test_attributes_upon_fitting() * refactor test_attributes_upon_fitting() for TargetMeanRegressor * fix error * fix bug on test files * fix regressors test errors except for Pipeline attribute. Cause is unclear given the results are identical. * add typehint to _find_categorical_and_numerical_variables() * fix _find_categorical_and_numerical_variables() * fix test_attributes_upon_fitting() error for regressor * fix test_attributes_upon_fitting() error for classifier * fix clsfr predict() * create test_classifier_prediction_results_with_all_numerical_variables() * edit df_pred_small * create test_classifier_results_with_all_categorical_variables() * create two clsfr tests * revise rgrsr test_raises_error_when_df_has_nan() * create clsfr test_error_if_df_contains_na_in_transform() * create clsfr test_raises_error_when_not_fitting_a_df() * fix style errors * create 2 tests for test_variable_manipulation * add 1 test and refactor code * create df_enc_categorical_and_numeric * create test_find_cat_and_num_vars_df_contains_num_and_cat() for test_variable_manipulation * create test for when user passes None, df contains numerical for test_variable_manipulation * create test for when user passes None, df contains categorical for test_variable_manipulation * create test for user passes empty list, function raises error for test_variable_manipulation * create 3 tests for test_variable_manipulation * fix bug in _find_categorical_and_numerical_variables() * try to debut test_error_find_cat_and_num_vars_datetime_var() * rename unit tests * fix style error * consolidating test__find_categorical_and_numeric. can a df be passed to @pytest.mark.parameterize? * consolidating test__find_categorical_and_numeric. can a df be passed to @pytest.mark.parameterize? * fix dataframe checks in BaseTargetMeanEstimator * revise dataframe checks. try sklearn check_X_y cause upstream errors b/c fcn returns numpy arrays which don't have dtypes * clean code for BaseTargetMeanEstimator and TargetMeanClassifier * change df_enc_categorical_and_numeric to df_vartypes * delete df_enc_categorical_and_numeric * expand test_classifier_results_with_all_categorical_variables() * update test_classifier_results_with_all_numerical_variables() and fix test_attributes_upon_fitting() * update test_regression_score_calculation_with_equal_frequency * create test_regressor_with_two_variables() * create 2 regressor tests * add 1 regressor test * fix TargetMeanClassifier fit() * create 2 tests for TargetMeanClassifier * refactor classifier test code * change 2 unit test names * updates encoding tests * updates variable manipulation * improves function to select num and cat vars * resets tests variable manipulation * finishes tests new var selection method * fixes codestyle in var manipulation files * renames folder and updates base predictor * reformats basepredictor * updates target mean classifier * updates target mean regressor * small fix * finishes general checks for all prediction classes * adds tests for classifier * first draft tests * finishes tests predictors * fixes bug * removed notebook * split predict method in transform and predict * deprecates pipeline attr and replaces by encoding dicst * refactors assignment * last touches to predictor classes * finishes target selection and tests * fix typos * updates user guide of select by target mean Co-authored-by: sana <sana@fraugster.com> Co-authored-by: Morgan-Sell <morganpsell@gmail.com> * edits to cyclical features user guide * updates and expands whats new * changes wording in mathfeatures * changes wording in relative features * finishes adding changes to whatsnew Co-authored-by: Alejandro Giacometti <alejandro.giacometti@gmail.com> Co-authored-by: gverbock <32060943+gverbock@users.noreply.github.com> Co-authored-by: Gilles Verbockhaven <gilles.verbockhaven@ing.com> Co-authored-by: sana <sana@fraugster.com> Co-authored-by: Morgan-Sell <morganpsell@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #298
closes #316
closes #317
closes #364
closes #366
closes #371
closes #374
Done
TODO
Also in this PR:
In #390, merged onto this branch:
closes #227
closes #238
closes #296
closes #334
closes #358
FYI @janrito @hectorpatino