Друзья, всем привет!
Разбираюсь в библиотеке CatBoost, разбираю пример с sum_models:
from catboost import CatBoostClassifier, Pool, sum_models
from catboost.datasets import amazon
import numpy as np
from sklearn.model_selection import train_test_split
train_df, _ = amazon()
y = train_df.ACTION
X = train_df.drop('ACTION', axis=1)
categorical_features_indices = np.where(X.dtypes != np.float)[0]
X_train, X_validation, y_train, y_validation = train_test_split(X,
y,
train_size=0.8,
random_state=42)
train_pool = Pool(X_train,
y_train,
cat_features=categorical_features_indices)
validate_pool = Pool(X_validation,
y_validation,
cat_features=categorical_features_indices)
models = []
for i in range(5):
model = CatBoostClassifier(iterations=100,
random_seed=i)
model.fit(train_pool,
eval_set=validate_pool)
models.append(model)
models_avrg = sum_models(models,
weights=[1.0/len(models)] * len(models))
Почему models_avrg становится catboost.core.CatBoost at 0x1c9000726a0 и теряет метод predict_proba?
Как преобразовать в catboost.core.CatBoostClassifier at 0x1c90006a978 ?