Open chris-cutting opened 3 months ago
I am also have the same problem:
File ~/Projects/piord-data-analysis/venv-eda/lib/python3.10/site-packages/pycaret/classification/oop.py:854, in ClassificationExperiment.setup(self, data, data_func, target, index, train_size, test_data, ordinal_features, numeric_features, categorical_features, date_features, text_features, ignore_features, keep_features, preprocess, create_date_columns, imputation_type, numeric_imputation, categorical_imputation, iterative_imputation_iters, numeric_iterative_imputer, categorical_iterative_imputer, text_features_method, max_encoding_ohe, encoding_method, rare_to_value, rare_value, polynomial_features, polynomial_degree, low_variance_threshold, group_features, drop_groups, remove_multicollinearity, multicollinearity_threshold, bin_numeric_features, remove_outliers, outliers_method, outliers_threshold, fix_imbalance, fix_imbalance_method, transformation, transformation_method, normalize, normalize_method, pca, pca_method, pca_components, feature_selection, feature_selection_method, feature_selection_estimator, n_features_to_select, custom_pipeline, custom_pipeline_position, data_split_shuffle, data_split_stratify, fold_strategy, fold, fold_shuffle, fold_groups, n_jobs, use_gpu, html, session_id, system_log, log_experiment, experiment_name, experiment_custom_tags, log_plots, log_profile, log_data, engine, verbose, memory, profile, profile_kwargs) 852 # Balance the classes in the target column 853 if fix_imbalance: --> 854 self._balance(fix_imbalance_method, session_id) 856 # Power transform the data to be more Gaussian-like 857 if transformation:
File ~/Projects/piord-data-analysis/venv-eda/lib/python3.10/site-packages/pycaret/internal/preprocess/preprocessor.py:867, in Preprocessor._balance(self, fix_imbalance_method, session_id) 863 balance_estimator = FixImbalancer( 864 strategiesfix_imbalance_method 865 ) 866 except TypeError: --> 867 balance_estimator = FixImbalancer(strategies[fix_imbalance_method]()) 868 elif not hasattr(fix_imbalance_method, "fit_resample"): 869 raise TypeError( 870 "Invalid value for the fix_imbalance_method parameter. " 871 "The provided value must be a imblearn estimator, got " 872 f"{fix_imbalance_method.class._name}." 873 )
TypeError: SMOTENC.init() missing 1 required positional argument: 'categorical_features'
pycaret version checks
[X] I have checked that this issue has not already been reported here.
[X] I have confirmed this bug exists on the latest version of pycaret.
[X] I have confirmed this bug exists on the master branch of pycaret (pip install -U git+https://github.com/pycaret/pycaret.git@master).
Issue Description
To use SMOTENC to fix imbalance, one has to provide the list of categorical features. But PyCaret does not seem to understand :
_Invalid value for the strategy parameter, got smotenc(categoricalfeatures=[1,3,4,5,6,9]). Choose from: condensednearestneighbour, editednearestneighborus, repeatededitednearestneighbours, allknn, instancehardnessthreshold, nearmiss, neighbourhoodcleaningrule, onesidedselection, randomundersampler, tomeklinks, randomoversampler, smote, smotenc, smoten, adasyn, borderlinesmote, kmeanssmote, svmsmote, smoteenn, smotetomek.
Reproducible Example
Expected Behavior
I would expect SMOTENC to be applied to the data to have additional points from the minority class.
Actual Results
Installed Versions
System: python: 3.10.0 (tags/v3.10.0:b494f59, Oct 4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)] executable: c:\Users\ChristineCutting\AppData\Local\Programs\Python\Python310\python.exe machine: Windows-10-10.0.22631-SP0
PyCaret required dependencies: pip: 24.0 setuptools: 57.4.0 pycaret: 3.2.0 IPython: 8.21.0 ipywidgets: 8.1.2 tqdm: 4.66.2 numpy: 1.25.2 pandas: 1.5.3 jinja2: 3.1.3 scipy: 1.10.1 joblib: 1.3.2 sklearn: 1.2.2 pyod: 1.1.3 imblearn: 0.12.0 category_encoders: 2.6.3 lightgbm: 4.3.0 numba: 0.58.1 requests: 2.31.0 matplotlib: 3.6.0 scikitplot: 0.3.7 yellowbrick: 1.5 plotly: 5.19.0 plotly-resampler: Not installed kaleido: 0.2.1 schemdraw: 0.15 statsmodels: 0.14.1 sktime: 0.21.1 tbats: 1.1.3 pmdarima: 2.0.4 psutil: 5.9.8 markupsafe: 2.1.5 pickle5: Not installed cloudpickle: 3.0.0 deprecation: 2.1.0 xxhash: 3.4.1 wurlitzer: Not installed
PyCaret optional dependencies: shap: 0.44.1 interpret: 0.5.1 umap: 0.5.5 ydata_profiling: 4.6.4 explainerdashboard: 0.4.5 autoviz: Not installed fairlearn: 0.7.0 deepchecks: Not installed xgboost: Not installed catboost: Not installed kmodes: Not installed mlxtend: Not installed statsforecast: Not installed tune_sklearn: Not installed ray: Not installed hyperopt: Not installed optuna: Not installed skopt: Not installed mlflow: Not installed gradio: Not installed fastapi: Not installed uvicorn: Not installed m2cgen: Not installed evidently: Not installed fugue: Not installed streamlit: Not installed prophet: Not installed