首页 > 解决方案 > CatBoost 训练后特征信息

问题描述

我想了解在训练 CatBoost 模型后如何访问有关数值和分类特征的信息。为了举例,这里有一些玩具代码:

import pandas as pd
from catboost import CatBoostClassifier, Pool

train_pool = Pool(pd.DataFrame({'size': [1,1,2,1],
                                'shape': ['square','square','square', 'circle']}),
                  [1,1,0,1],
                  feature_names = ['size','shape'],
                  cat_features= ['shape'])

model = CatBoostClassifier(iterations=2,
                           cat_features = ['shape'],
                           ctr_leaf_count_limit=1)

model.fit(train_pool, plot=False)

我现在想在model对象上运行一个函数以获得以下内容:

这里需要强调的是,我只想对model对象进行操作。显然,可以通过在训练数据上运行函数来获得其中的一些细节。我的动机是双重确保我完全理解模型输入的训练范围,以及它在预处理中可能对它们做什么。

标签: pythonmachine-learningfeature-engineeringcatboost

解决方案


推荐阅读