Advertisement
vishneva_olga

Untitled

Jun 21st, 2024 (edited)
440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.60 KB | None | 0 0
  1. preprocessor = ColumnTransformer(
  2.     transformers=[
  3.         ('scaler', StandardScaler(), numerical_features) # масштабируем численные признаки
  4.     ],
  5.     remainder='passthrough'  # остальные признаки остаются без изменений
  6. )
  7.  
  8. # Создание пайплайна
  9. cbc_pipeline = Pipeline([
  10.     ('preprocessor', preprocessor),
  11.     #('imputer', SimpleImputer(strategy='median')),
  12.     ('clf', CatBoostClassifier(random_seed=STATE,
  13.                                      cat_features=categorical_features,
  14.                                      eval_metric='F1',
  15.                                      auto_class_weights='Balanced',
  16.                                      verbose=100))
  17.   ]
  18. )
  19.  
  20. # Обучение модели
  21. cbc_pipeline.fit(X_train, y_train)
  22.  
  23.  
  24. Ошибка:
  25. CatBoostError                             Traceback (most recent call last)
  26. <ipython-input-51-4f605af09d07> in <cell line: 22>()
  27.      20
  28.      21 # Обучение модели
  29. ---> 22 cbc_pipeline.fit(X_train, y_train)
  30.  
  31. 7 frames
  32. /usr/local/lib/python3.10/dist-packages/catboost/core.py in _get_features_indices(features, feature_names)
  33.     323         for f in features:
  34.     324             if isinstance(f, STRING_TYPES):
  35. --> 325                 raise CatBoostError("features parameter contains string value '{}' but feature names "
  36.     326                                     "for a dataset are not specified".format(f))
  37.     327     return features
  38.  
  39. CatBoostError: features parameter contains string value 'пол' but feature names for a dataset are not specified
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement