title: Implementing custom stopping metrics to optimize during training in H2O model directly from R
body: <p>I'm trying to implement the <a href="https://github.com/yanyachen/MLmetrics/blob/master/R/Classification.R" rel="noreferrer"><code>FBeta_Score()</code></a> of the <code>MLmetrics</code> <a href="https://cran.r-project.org/web/packages/MLmetrics/index.html" rel="noreferrer">R package</a>:</p>
  
  <pre><code>FBeta_Score &lt;- function(y_true, y_pred, positive = NULL, beta = 1) {
     Confusion_DF &lt;- ConfusionDF(y_pred, y_true)
     if (is.null(positive) == TRUE) 
     positive &lt;- as.character(Confusion_DF[1,1])
     Precision &lt;- Precision(y_true, y_pred, positive)
     Recall &lt;- Recall(y_true, y_pred, positive)
     Fbeta_Score &lt;- (1 + beta^2) * (Precision * Recall) / (beta^2 * Precision + 
     Recall)
     return(Fbeta_Score)
   }
  </code></pre>
  
  <p>in the <a href="http://docs.h2o.ai/h2o/latest-stable/h2o-docs/data-science/drf.html" rel="noreferrer">H2O distributed random forest model</a> and I want to optimize it during the training phase using the <code>custom_metric_func</code> option.
  The help documentation of the <code>h2o.randomForest()</code> function says: </p>
  
  <blockquote>
    <p>Reference to custom evaluation function, format:
    'language:keyName=funcName'</p>
  </blockquote>
  
  <p>But I don't understand how to use it directly from R and what I should specify in the <code>stopping_metric</code> option. </p>
  
  <p>Any help would be appreciated!</p>