December 17th, 2020

New Improvements in H2O 3.32.0.2

RSS icon RSS Category: H2O Release, XGBoost

There is a new minor release of H2O that introduces two useful improvements to our XGBoost integration: interaction constraints and feature interactions.

Interaction Constraints

Feature interaction constraints allow users to decide which variables are allowed to interact and which are not.

Potential benefits:

  • Better predictive performance from focusing on interactions that work – whether through domain-specific knowledge or algorithms that rank interactions
  • Less noise in predictions; better generalization
  • More control given to the user on what the model can fit. For example, the user may want to exclude some interactions even if they perform well due to regulatory constraints

(Source: https://xgboost.readthedocs.io/en/latest/tutorials/feature_interaction_constraint.html)

The H2O documentation is available here.

XGBFI-like Tool for Revealing Feature Interactions

We have implemented ranks of features and feature interactions by various measures in XGBFI style. Thanks to this tool, H2O provides insights into higher-order interactions between features in trees all in a user-friendly manner. Additionally, leaf statistics and split value histograms are provided. The measures used are either one of:

Gain implies the relative contribution of the corresponding feature to the model calculated by taking each feature’s contribution for each tree in the model. A higher value of this metric when compared to another feature implies it is more important for generating a prediction.

Cover is a metric to measure the number of observations affected by the split. Counted over the specific feature it measures the relative quantity of observations concerned by a feature.

Frequency (FScore) is the number of times a feature is used in all generated trees. Please note that it does not take the tree-depth nor tree-index of splits a feature occurs into consideration, neither the amount of possible splits of a feature. Hence, it is often suboptimal measure for importance or their averaged / weighed / ranked alternatives.

The H2O documentation is available here.

Example

The Jupyter notebook demo with all example codes presented below is available here.

Train XGBoostEstimator with interaction_constraints parameter:

# start h2o
import h2o
h2o.init()
 
from h2o.estimators.xgboost import *
# check if the H2O XGBoostEstimator is available
assert H2OXGBoostEstimator.available() is True
 
# import data
data = h2o.import_file(path = "../../smalldata/logreg/prostate.csv")
 
x = list(range(1, data.ncol-2))
y = data.names[len(data.names) - 1]
 
ntree = 5
 
h2o_params = {
    'eta': 0.3,
    'max_depth': 3, 
    'ntrees': ntree,
    'tree_method': 'hist'
}
 
# define interactions as a list of list of names of colums
# the lists defines allowed interaction
# the interactions of each column with itself are always allowed
# so you cannot specified list with one column e.g. ["PSA"]
h2o_params["interaction_constraints"] = [["CAPSULE", "AGE"], ["PSA", "DPROS"]]
 
# train h2o XGBoost model
h2o_model = H2OXGBoostEstimator(**h2o_params)
h2o_model.train(x=x, y=y, training_frame=data)

The result:

Display feature interactions:

# calculate multi-level feature interactions
h2o_model.feature_interaction()

Credits

This new H2O release is brought to you by Veronika Maurerova, Zuzana Olajcova, and Hannah Tillman.

How to Get Started?

Download H2O-3 from here and follow the steps in this example notebook. You can also check out our training center for both self-paced tutorials and instructor-led courses.

About the Author

Veronika Maurerova

Veronika is Software Engineer. She likes everything about Machine Learning and Artificial Intelligence. She finished master studies at Czech Technical University in Prague in 2017. Within master thesis, she cooperated with the Police of the Czech Republic. The goal was to prepare and analyze Czech crime data and build a predictive model. During studies at CTU, she had a part-time job in Ataccama software company as a Java Software Engineer. After she finished her studies, she had worked as a Machine Learning Engineer in Czech startup SEQENGI for nearly a year. In her spare time, she plays frisbee, travels, hikes, plays the ukulele, learns how to cook or bake something new, enjoys gardening and a much more.'

Leave a Reply

+
Enhancing H2O Model Validation App with h2oGPT Integration

As machine learning practitioners, we’re always on the lookout for innovative ways to streamline and

May 17, 2023 - by Parul Pandey
+
Building a Manufacturing Product Defect Classification Model and Application using H2O Hydrogen Torch, H2O MLOps, and H2O Wave

Primary Authors: Nishaanthini Gnanavel and Genevieve Richards Effective product quality control is of utmost importance in

May 15, 2023 - by Shivam Bansal
AI for Good hackathon
+
Insights from AI for Good Hackathon: Using Machine Learning to Tackle Pollution

At H2O.ai, we believe technology can be a force for good, and we're committed to

May 10, 2023 - by Parul Pandey and Shivam Bansal
H2O democratizing LLMs
+
Democratization of LLMs

Every organization needs to own its GPT as simply as we need to own our

May 8, 2023 - by Sri Ambati
h2oGPT blog header
+
Building the World’s Best Open-Source Large Language Model: H2O.ai’s Journey

At H2O.ai, we pride ourselves on developing world-class Machine Learning, Deep Learning, and AI platforms.

May 3, 2023 - by Arno Candel
LLM blog header
+
Effortless Fine-Tuning of Large Language Models with Open-Source H2O LLM Studio

While the pace at which Large Language Models (LLMs) have been driving breakthroughs is remarkable,

May 1, 2023 - by Parul Pandey

Request a Demo

Explore how to Make, Operate and Innovate with the H2O AI Cloud today

Learn More