âšī¸ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | FAIL | download_stamp > now() - 6 MONTH | 8.5 months ago |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://stackoverflow.com/questions/61354410/python-catboost-multiclass-f1-score-custom-metric |
| Last Crawled | 2025-07-26 04:16:26 (8 months ago) |
| First Indexed | 2020-06-19 05:19:27 (5 years ago) |
| HTTP Status Code | 200 |
| Meta Title | Python Catboost: Multiclass F1 score custom metric - Stack Overflow |
| Meta Description | null |
| Meta Canonical | null |
| Boilerpipe Text | How do you find the F1-score for each class of a multiclass Catboost Classifier? I've already read through the documentation and the github repo where someone asks the same question. However, I am unable to figure out the codesmithing to achieve this. I understand that I must use the custom_metric parameter in CatBoostClassifier() but I don't know what arguments are acceptable for custom_metric when I want F1 score for each class of my multiclass dataset. Suppose you have a toy dataset (from the documentation): from catboost import Pool
cat_features = [ 0 , 1 , 2 ]
data = [[ "a" , "b" , 1 , 4 , 5 , 6 ],
[ "a" , "b" , 4 , 5 , 6 , 7 ],
[ "c" , "d" , 30 , 40 , 50 , 60 ]]
label = [ 0 , 1 , 2 ]
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(data, labels, test_size= 0.2 )
train_pool = Pool(X_train, y_train, cat_features=categorical_features_indices)
validate_pool = Pool(X_test, y_test, cat_features=categorical_features_indices)
params = { "loss_function" : "MultiClass" ,
"depth" : symmetric_tree_depth,
"num_trees" : 500 ,
"verbose" : False }
model = CatBoostClassifier(**params)
model.fit(train_pool, eval_set=validate_pool)
|
| Markdown | null |
| Readable Markdown | null |
| Shard | 169 (laksa) |
| Root Hash | 714406497480128969 |
| Unparsed URL | com,stackoverflow!/questions/61354410/python-catboost-multiclass-f1-score-custom-metric s443 |