0

I got the data from datasets and imported its working fine.

But when I try to compile this code below:

from pycaret.classification import ClassificationExperiment
s = ClassificationExperiment()
s.setup(data, target = 'Class variable', session_id = 123)

Atfer I got this error "AttributeError: module 'pycaret' has no attribute 'utils'":


Number of times pregnant    Plasma glucose concentration a 2 hours in an oral glucose tolerance test    Diastolic blood pressure (mm Hg)    Triceps skin fold thickness (mm)    2-Hour serum insulin (mu U/ml)  Body mass index (weight in kg/(height in m)^2)  Diabetes pedigree function  Age (years) Class variable
0   6   148 72  35  0   33.6    0.627   50  1
1   1   85  66  29  0   26.6    0.351   31  0
2   8   183 64  0   0   23.3    0.672   32  1
3   1   89  66  23  94  28.1    0.167   21  0
4   0   137 40  35  168 43.1    2.288   33  1
Output exceeds the size limit. Open the full output data in a text editor
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[33], line 3
      1 from pycaret.classification import ClassificationExperiment
      2 s = ClassificationExperiment()
----> 3 s.setup(data, target = 'Class variable', session_id = 123)

File ~/.local/lib/python3.10/site-packages/pycaret/classification/oop.py:781, 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, group_names, 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)
    764 self._prepare_folds(
    765     fold_strategy=fold_strategy,
    766     fold=fold,
    767     fold_shuffle=fold_shuffle,
    768     fold_groups=fold_groups,
    769 )
    771 self._prepare_column_types(
    772     ordinal_features=ordinal_features,
    773     numeric_features=numeric_features,
   (...)
    778     keep_features=keep_features,
    779 )
--> 781 self._set_exp_model_engines(
    782     container_default_engines=get_container_default_engines(),
    783     engine=engine,
    784 )
    786 # Preprocessing ============================================ >>
...
File ~/.local/lib/python3.10/site-packages/pycaret/containers/base_container.py:64, in BaseContainer.get_class_name(self)
     63 def get_class_name(self):
---> 64     return pycaret.utils.generic.get_class_name(self.class_def)

AttributeError: module 'pycaret' has no attribute 'utils'

I excepted this output:

output image

0 Answers0