# H2O Binomial Scorer

**URL:** <https://forum.knime.com/t/h2o-binomial-scorer/18627>\
**Category:** KNIME Analytics Platform\
**Created:** [October 4, 2019, 12:29pm UTC](https://forum.knime.com/t/h2o-binomial-scorer/18627 "2019-10-04T12:29:53Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![malik](https://forum-cdn.knime.com/user_avatar/forum.knime.com/malik/32/606_2.png) [@malik](https://forum.knime.com/u/malik)\
**Post date:** [October 4, 2019, 12:29pm UTC](https://forum.knime.com/t/h2o-binomial-scorer/18627/1 "2019-10-04T12:29:54Z")

</div>

Hi  
I need to understand how does Binomial Scorere woks.  
If you look to the P(section.type=emergency) the value is higher than the one on the other column. However, the prediction column contains the value “elective”.

# [H2O Binomial Scorer](https://forum.knime.com/t/h2o-binomial-scorer-specificty/14670)

Using the regular scorer is actually referring to the two columns- the actual class label and the prediction labels. However, Binomial Scorer asks to provide the actually column and the probability column of the target class.  
The confusion matric of the Binomial Scorers is ![image](https://forum-cdn.knime.com/uploads/default/original/2X/e/ec378e3f04c5568df62de59d2affaf95c8bb3433.png)  
While for regular Scorer is :  
 ![image](https://forum-cdn.knime.com/uploads/default/original/2X/f/facebcdc5a4f2777b42b9152c453c305ed2cd599.png)  
So what is going here?

Best  
Malik

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [October 4, 2019, 12:38pm UTC](https://forum.knime.com/t/h2o-binomial-scorer/18627/2 "2019-10-04T12:38:08Z")

</div>

Could you provide us with an example? Otherwise it is hard to tell what might be going on here.

---

<div class="post-metadata">

**Author:** ![malik](https://forum-cdn.knime.com/user_avatar/forum.knime.com/malik/32/606_2.png) [@malik](https://forum.knime.com/u/malik)\
**Post date:** [October 4, 2019, 12:57pm UTC](https://forum.knime.com/t/h2o-binomial-scorer/18627/3 "2019-10-04T12:57:40Z")

</div>

OK  
Part of the Knime Workflow:  
 ![image](https://forum-cdn.knime.com/uploads/default/original/2X/2/2b5834ecc4020e0876a46d00089f5c85e2d8e50a.png)

Input Table -

 ![image](https://forum-cdn.knime.com/uploads/default/original/2X/6/6f9425e5297556a809f69bb747745419388d7c20.png)

Output of H2O Predictor (Classification)

 ![image](https://forum-cdn.knime.com/uploads/default/original/2X/d/d52fe24a0a61187caffaca2d468d50e0838e76db.png)  
Configure of H2O Binomial Scorer-  
 ![image](https://forum-cdn.knime.com/uploads/default/original/2X/f/faeafa44c4fd55b6f87325a8d696845536085c11.png)  
Output of H2O Binomial Scorer- Confusion Matrix  
 ![image](https://forum-cdn.knime.com/uploads/default/original/2X/5/5741a0b7c4fe9cdef551a2dff5a6eac14e8135d5.png)

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [October 4, 2019, 1:07pm UTC](https://forum.knime.com/t/h2o-binomial-scorer/18627/4 "2019-10-04T13:07:30Z")

</div>

If you could provide the workflow with the data it might be easier to judge what is going on. From what I see in the screenshots there seems to be a discrepancy between the score and the predicted output. Seems the H2O scorer is relying on the score and gives the case as _emergency_ while the prediction is _elective_.

Besides a bug the thing I could think of is some sort of threshold that has to be passed in order to make a prediction. If there were some assigned costs for misclassification or something.

Might be a case for the H2O people. Anyway it would be good to have an example that can be reproduced.

 ![image](https://forum-cdn.knime.com/uploads/default/original/2X/f/f9944acf452ff117f5ed2ab267d54a6fe65243f0.png)

---

<div class="post-metadata">

**Author:** ![SimonS](https://forum-cdn.knime.com/user_avatar/forum.knime.com/simons/32/3861_2.png) [@SimonS](https://forum.knime.com/u/SimonS)\
**Post date:** [October 4, 2019, 2:49pm UTC](https://forum.knime.com/t/h2o-binomial-scorer/18627/5 "2019-10-04T14:49:47Z")

</div>

Hi @malik and @mlauber71,

H2O optimizes the threshold that they will use for the prediction during the model learning. If you take a look at the output of the **H2O Random Forest Learner** node, you will find a flow variable called “Threshold”. This is the optimized threshold that will be used by the **H2O Binomial Scorer**. If you want to use a different threshold, you need to use either the **Scorer** node for 0.5 as threshold, or a **Rule Engine** node for a custom threshold.

I hope this clarifies it.

Regards,  
Simon

---

<div class="post-metadata">

**Author:** ![malik](https://forum-cdn.knime.com/user_avatar/forum.knime.com/malik/32/606_2.png) [@malik](https://forum.knime.com/u/malik)\
**Post date:** [October 4, 2019, 3:19pm UTC](https://forum.knime.com/t/h2o-binomial-scorer/18627/6 "2019-10-04T15:19:43Z")

</div>

You might doenload the workflow from

> **[Classification\_Random Forest usig H2O – malik](https://hub.knime.com/malik/spaces/Public/latest/Classification_RF_H2O)**
>
> Random Forest nased H2O- The workflow repated n times.

Input file \:  
[data\_clean\_malik\_26\_9\_209.xlsx](https://forum-cdn.knime.com/uploads/default/original/2X/5/53515a449f798b95518eb375afbd34147c2418e3.xlsx) (158.8 KB)

---

<div class="post-metadata">

**Author:** ![malik](https://forum-cdn.knime.com/user_avatar/forum.knime.com/malik/32/606_2.png) [@malik](https://forum.knime.com/u/malik)\
**Post date:** [October 4, 2019, 3:24pm UTC](https://forum.knime.com/t/h2o-binomial-scorer/18627/7 "2019-10-04T15:24:01Z")

</div>

> [@SimonS](#):
>
> H2O Binomial Scorer

So no way that we do that with the **H2O Binomial Scorer**?

Malik

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [October 4, 2019, 3:48pm UTC](https://forum.knime.com/t/h2o-binomial-scorer/18627/8 "2019-10-04T15:48:42Z")

</div>

You could use The Rule Engine and define the Threshold yourself. As @SimonS explained H2O.ai uses an optimized threshold so there is not a simple split at a score of 0.5.

![image](https://forum-cdn.knime.com/uploads/default/original/2X/1/1993836d6e9cd12400118a84b0c821b3f9ade75a.png)

The best Threshold/prediction very much depends on your business model and what you want to do with the results.

You could read more in these entries, especially about the ROC curve.

Models for 0/1 or Yes/No Targets

> [@Looking for options to evaluate a decision tree](https://forum.knime.com/t/looking-for-options-to-evaluate-a-decision-tree/11384/2):
>
> One ‘brutal’ way could be to convert the decision tree rules into SQL and then use the SQL code. Or use the ruleset to make some kind of If then rules. Not very elegant I have to admit. [kn\_example\_decision\_tree.knwf](https://forum-cdn.knime.com/uploads/default/original/2X/1/1132014ad9feb823a8ee8e8d5c9ce19ad8c13ba2.knwf) (510.8 KB)

Understand metrics like AUC and Gini (and use H2O.ai)

> [@Random Forest Model Not Working](https://forum.knime.com/t/random-forest-model-not-working/12738/3):
>
> I attached a working example of a Random Forest with H2O.ai nodes and a 0/1 Target from a [Kaggle competition](https://www.kaggle.com/c/bnp-paribas-cardif-claims-management/data) (please note the example only uses the first 1.000 lines, you should remove this restriction or use your own data for your own purpouses). In order to get an idea about the quality of you model you might want to read this article: I always advise not just to use a Scorer but rather a metric like Gini/AUC to see the relative quality of the model. In the end the ‘score’ is not a magic…

> [@Help choosing analytics algorithm](https://forum.knime.com/t/help-choosing-analytics-algorithm/11404/3):
>
> I think you could do two things. You could treat your outlier group as label/target (1/0 or TRUE/FALSE) and the rest of the data as explaining variables. You would have to remove the time column since this ‘leaks’ the information you want to find. You could then use an algorithm like Random Forest Learner \*1) that also gives you a list of the most important variables, the ones that make the outliers the outlier compared to the regular cases. You could also just use the time for each transaction…

---

<div class="post-metadata">

**Author:** ![malik](https://forum-cdn.knime.com/user_avatar/forum.knime.com/malik/32/606_2.png) [@malik](https://forum.knime.com/u/malik)\
**Post date:** [October 4, 2019, 7:46pm UTC](https://forum.knime.com/t/h2o-binomial-scorer/18627/9 "2019-10-04T19:46:08Z")

</div>

It should more simple to solve this issue. I notice that node H2O Binomial Scorer allow one to choose just INTEGER column as the Predicted column (target class) - So in my case i use the Actual column to be “section.type” and the target class is “elective” and the Prediction columns (target class) is the "P(section.type=elective)).  
 ![image](https://forum-cdn.knime.com/uploads/default/original/2X/c/cd12a7a4daa236040529daa48fbc490065276184.png)  
Now examine the output of the H2O Binomial Scorer -\>Confusion matrix  
 ![image](https://forum-cdn.knime.com/uploads/default/original/2X/f/f17e9c5172eb02ab58500db41f2ef32fb02f1ed4.png)  
the results seems correct.  
So i need just to calculate the specific from this table.  
I don’t know why H2O Binomial Scorer calculate all different measurement and not the specificity!!!

---

<div class="post-metadata">

**Author:** ![malik](https://forum-cdn.knime.com/user_avatar/forum.knime.com/malik/32/606_2.png) [@malik](https://forum.knime.com/u/malik)\
**Post date:** [October 4, 2019, 8:04pm UTC](https://forum.knime.com/t/h2o-binomial-scorer/18627/10 "2019-10-04T20:04:18Z")

</div>

This is my solution  
provide the neg class name

 ![image](https://forum-cdn.knime.com/uploads/default/original/2X/c/c6ca2335671b520fbdb7c745b16cd37b6d0b4175.png)

![image](https://forum-cdn.knime.com/uploads/default/original/2X/3/35df05085555e89ea21cd7e05440f92d602d579d.png)

in java snippet : return (1-$Error$);

Malik

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [April 4, 2020, 8:04am UTC](https://forum.knime.com/t/h2o-binomial-scorer/18627/11 "2020-04-04T08:04:19Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
