title: Python Catboost: Multiclass F1 score custom metric
body: <p>How do you find the F1-score for each class of a multiclass Catboost Classifier? I've already read through the <a href="https://catboost.ai/docs/concepts/python-reference_catboostclassifier.html" rel="nofollow noreferrer">documentation</a> and the <a href="https://github.com/catboost/catboost/issues/490" rel="nofollow noreferrer">github repo</a> 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 <code>custom_metric</code> parameter in <code>CatBoostClassifier()</code> but I don't know what arguments are acceptable for <code>custom_metric</code> when I want <code>F1</code> score for each class of my multiclass dataset.</p>
  
  <p>Suppose you have a toy dataset (from the documentation):</p>
  
  <pre><code>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,
  #           "eval_metric": "F1", # this doesn't work
            "verbose": False}
  
  model = CatBoostClassifier(**params)
  model.fit(train_pool, eval_set=validate_pool)
  </code></pre>