u++の備忘録

CatBoostのテキストカラム指定機能を試す

CatBoostの(カテゴリカラム指定ならぬ)テキストカラム指定機能を試してみました。本記事の内容は、discussion*1に投稿済です。

Kaggle「Real or Not? NLP with Disaster Tweets」*2コンペのデータセットを利用しました。

f:id:upura:20200303195115p:plain

target_col = 'target'
text_cols = ['text']
categorical_cols = ['keyword', 'location']

train_pool = Pool(
    X_tr, 
    y_tr, 
    cat_features=categorical_cols,
    text_features=text_cols,
    feature_names=list(X_tr)
)

生の文章が入ったカラムを指定できるので、サクッとベンチマークを作るには便利だと感じました。

5 foldでの性能をテキストカラムの有無で比較すると、次の表の通りとなりました。正答率(ACC)は、閾値を0.5として算出しています。

with text feature without text feature
Public LB 0.79141 0.73006
Local AUC 0.8590 0.7909
Local ACC 0.7985 0.7358

実装したNotebookも公開済です。