Metrics in H2O

H2O Model Metrics

Regression model.

copyright:
  1. 2016 H2O.ai
license:

Apache License Version 2.0 (see LICENSE for details)

class h2o.model.metrics_base.H2OAutoEncoderModelMetrics(metric_json, on=None, algo=u'')[source]

Bases: h2o.model.metrics_base.MetricsBase

class h2o.model.metrics_base.H2OBinomialModelMetrics(metric_json, on=None, algo=u'')[source]

Bases: h2o.model.metrics_base.MetricsBase

This class is essentially an API for the AUC object. This class contains methods for inspecting the AUC for different criteria. To input the different criteria, use the static variable criteria

F0point5(thresholds=None)[source]
Parameters:thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
Returns:The F0point5 for this set of metrics and thresholds.
F1(thresholds=None)[source]
Parameters:thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
Returns:The F1 for the given set of thresholds.
F2(thresholds=None)[source]
Parameters:thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
Returns:The F2 for this set of metrics and thresholds
accuracy(thresholds=None)[source]
Parameters:thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
Returns:The accuracy for this set of metrics and thresholds
confusion_matrix(metrics=None, thresholds=None)[source]

Get the confusion matrix for the specified metric

Parameters:
  • metrics – A string (or list of strings) in {“min_per_class_accuracy”, “absolute_mcc”, “tnr”, “fnr”, “fpr”, “tpr”, “precision”, “accuracy”, “f0point5”, “f2”, “f1”,”mean_per_class_accuracy”}
  • thresholds – A value (or list of values) between 0 and 1
Returns:

a list of ConfusionMatrix objects (if there are more than one to return), or a single ConfusionMatrix (if there is only one)

error(thresholds=None)[source]
Parameters:thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
Returns:The error for this set of metrics and thresholds.
fallout(thresholds=None)[source]
Parameters:thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
Returns:The fallout or False Positive Rate for this set of metrics and thresholds
find_idx_by_threshold(threshold)[source]

Retrieve the index in this metric’s threshold list at which the given threshold is located.

Parameters:threshold – Find the index of this input threshold.
Returns:Return the index or throw a ValueError if no such index can be found.
find_threshold_by_max_metric(metric)[source]
Parameters:metric – A string in {“min_per_class_accuracy”, “absolute_mcc”, “precision”, “recall”, “specificity”, “accuracy”, “f0point5”, “f2”, “f1”, “mean_per_class_accuracy”}
Returns:the threshold at which the given metric is maximum.
fnr(thresholds=None)[source]
Parameters:thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
Returns:The False Negative Rate
fpr(thresholds=None)[source]
Parameters:thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
Returns:The False Positive Rate
fprs

Return all false positive rates for all threshold values.

Returns:a list of false positive rates.
gains_lift()[source]

Retrieve the Gains/Lift table

max_per_class_error(thresholds=None)[source]
Parameters:thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
Returns:Return 1 - min_per_class_accuracy
mcc(thresholds=None)[source]
Parameters:thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
Returns:The absolute MCC (a value between 0 and 1, 0 being totally dissimilar, 1 being identical)
mean_per_class_error(thresholds=None)[source]
Parameters:thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
Returns:Return mean_per_class_error
metric(metric, thresholds=None)[source]
Parameters:
  • metric – The desired metric
  • thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
Returns:

The set of metrics for the list of thresholds

missrate(thresholds=None)[source]
Parameters:thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
Returns:THe missrate or False Negative Rate.
plot(type=u'roc', server=False)[source]

Produce the desired metric plot :param type: the type of metric plot (currently, only ROC supported) :param show: if False, the plot is not shown. matplotlib show method is blocking. :return: None

precision(thresholds=None)[source]
Parameters:thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
Returns:The precision for this set of metrics and thresholds.
recall(thresholds=None)[source]
Parameters:thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
Returns:Recall for this set of metrics and thresholds
sensitivity(thresholds=None)[source]
Parameters:thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
Returns:Sensitivity or True Positive Rate for this set of metrics and thresholds
specificity(thresholds=None)[source]
Parameters:thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
Returns:The specificity or True Negative Rate.
tnr(thresholds=None)[source]
Parameters:thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
Returns:The True Negative Rate
tpr(thresholds=None)[source]
Parameters:thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
Returns:The True Postive Rate
tprs

Return all true positive rates for all threshold values.

Returns:a list of true positive rates.
class h2o.model.metrics_base.H2OClusteringModelMetrics(metric_json, on=None, algo=u'')[source]

Bases: h2o.model.metrics_base.MetricsBase

betweenss()[source]
Returns:the Between Cluster Sum-of-Square Error, or None if not present.
tot_withinss()[source]
Returns:the Total Within Cluster Sum-of-Square Error, or None if not present.
totss()[source]
Returns:the Total Sum-of-Square Error to Grand Mean, or None if not present.
class h2o.model.metrics_base.H2ODimReductionModelMetrics(metric_json, on=None, algo=u'')[source]

Bases: h2o.model.metrics_base.MetricsBase

cat_err()[source]
Returns:the Number of Misclassified categories over non-missing categorical entries, or None if not present.
num_err()[source]
Returns:the Sum of Squared Error over non-missing numeric entries, or None if not present.
class h2o.model.metrics_base.H2OMultinomialModelMetrics(metric_json, on=None, algo=u'')[source]

Bases: h2o.model.metrics_base.MetricsBase

confusion_matrix()[source]

Returns a confusion matrix based of H2O’s default prediction threshold for a dataset

hit_ratio_table()[source]

Retrieve the Hit Ratios

class h2o.model.metrics_base.H2ORegressionModelMetrics(metric_json, on=None, algo=u'')[source]

Bases: h2o.model.metrics_base.MetricsBase

This class provides an API for inspecting the metrics returned by a regression model.

It is possible to retrieve the R^2 (1 - MSE/variance) and MSE

class h2o.model.metrics_base.MetricsBase(metric_json, on=None, algo=u'')[source]

Bases: h2o.utils.backward_compatibility.BackwardsCompatibleBase

A parent class to house common metrics available for the various Metrics types.

The methods here are available across different model categories, and so appear here.

aic()[source]
Returns:Retrieve the AIC for this set of metrics.
auc()[source]
Returns:Retrieve the AUC for this set of metrics.
gini()[source]

Gini coefficient.

logloss()[source]

Log loss.

mae()[source]
Returns:Retrieve the MAE for this set of metrics
classmethod make(kvs)[source]

Factory method to instantiate a MetricsBase object from the list of key-value pairs.

mean_per_class_error()[source]

Retrieve the mean per class error.

mean_residual_deviance()[source]
Returns:Retrieve the mean residual deviance for this set of metrics.
mse()[source]
Returns:Retrieve the MSE for this set of metrics
nobs()[source]
Returns:Retrieve the number of observations.
null_degrees_of_freedom()[source]
Returns:the null dof if the model has residual deviance, or None if no null dof.
null_deviance()[source]
Returns:the null deviance if the model has residual deviance, or None if no null deviance.
r2()[source]

The R^2 coefficient.

residual_degrees_of_freedom()[source]
Returns:the residual dof if the model has residual deviance, or None if no residual dof.
residual_deviance()[source]
Returns:the residual deviance if the model has residual deviance, or None if no residual deviance.
rmse()[source]
Returns:Retrieve the RMSE for this set of metrics
rmsle()[source]
Returns:Retrieve the RMSLE for this set of metrics
show()[source]

Display a short summary of the metrics. :return: None

H2O Grid Metrics

Classes for grid search.

copyright:
  1. 2016 H2O.ai
license:

Apache License Version 2.0 (see LICENSE for details)

class h2o.grid.metrics.H2OAutoEncoderGridSearch[source]

Bases: object

anomaly(test_data, per_feature=False)[source]

Obtain the reconstruction error for the input test_data.

Parameters:

test_data : H2OFrame

The dataset upon which the reconstruction error is computed.

per_feature
: bool

Whether to return the square reconstruction error per feature. Otherwise, return the mean square error.

Returns:

Return the reconstruction error.

class h2o.grid.metrics.H2OBinomialGridSearch[source]

Bases: object

F0point5(thresholds=None, train=False, valid=False, xval=False)[source]

Get the F0.5 for a set of thresholds. If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:
  • thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
  • train – If train is True, then return the F0point5 value for the training data.
  • valid – If valid is True, then return the F0point5 value for the validation data.
  • xval – If xval is True, then return the F0point5 value for the cross validation data.
Returns:

The F0point5 for this binomial model.

F1(thresholds=None, train=False, valid=False, xval=False)[source]

Get the F1 values for a set of thresholds for the models explored

If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”.

Parameters:

thresholds : list, optional

If None, then the thresholds in this set of metrics will be used.

train
: bool, optional

If True, return the F1 value for the training data.

valid
: bool, optional

If True, return the F1 value for the validation data.

xval
: bool, optional

If True, return the F1 value for each of the cross-validated splits.

Returns:

Dictionary of model keys to F1 values

F2(thresholds=None, train=False, valid=False, xval=False)[source]

Get the F2 for a set of thresholds. If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:
  • thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
  • train – If train is True, then return the F2 value for the training data.
  • valid – If valid is True, then return the F2 value for the validation data.
  • xval – If xval is True, then return the F2 value for the cross validation data.
Returns:

Dictionary of model keys to F2 values.

accuracy(thresholds=None, train=False, valid=False, xval=False)[source]

Get the accuracy for a set of thresholds. If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:
  • thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
  • train – If train is True, then return the accuracy value for the training data.
  • valid – If valid is True, then return the accuracy value for the validation data.
  • xval – If xval is True, then return the accuracy value for the cross validation data.
Returns:

The accuracy for this binomial model.

confusion_matrix(metrics=None, thresholds=None, train=False, valid=False, xval=False)[source]

Get the confusion matrix for the specified metrics/thresholds If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:
  • metrics – A string (or list of strings) in {“min_per_class_accuracy”, “absolute_mcc”, “tnr”, “fnr”, “fpr”, “tpr”, “precision”, “accuracy”, “f0point5”, “f2”, “f1”}
  • thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
  • train – If train is True, then return the confusion matrix value for the training data.
  • valid – If valid is True, then return the confusion matrix value for the validation data.
  • xval – If xval is True, then return the confusion matrix value for the cross validation data.
Returns:

The confusion matrix for this binomial model.

error(thresholds=None, train=False, valid=False, xval=False)[source]

Get the error for a set of thresholds. If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:
  • thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
  • train – If train is True, then return the error value for the training data.
  • valid – If valid is True, then return the error value for the validation data.
  • xval – If xval is True, then return the error value for the cross validation data.
Returns:

The error for this binomial model.

fallout(thresholds=None, train=False, valid=False, xval=False)[source]

Get the Fallout (AKA False Positive Rate) for a set of thresholds. If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:
  • thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
  • train – If train is True, then return the fallout value for the training data.
  • valid – If valid is True, then return the fallout value for the validation data.
  • xval – If xval is True, then return the fallout value for the cross validation data.
Returns:

The fallout for this binomial model.

find_idx_by_threshold(threshold, train=False, valid=False, xval=False)[source]

Retrieve the index in this metric’s threshold list at which the given threshold is located. If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:
  • train – If train is True, then return the idx_by_threshold for the training data.
  • valid – If valid is True, then return the idx_by_threshold for the validation data.
  • xval – If xval is True, then return the idx_by_threshold for the cross validation data.
Returns:

The idx_by_threshold for this binomial model.

find_threshold_by_max_metric(metric, train=False, valid=False, xval=False)[source]

If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:
  • train – If train is True, then return the threshold_by_max_metric value for the training data.
  • valid – If valid is True, then return the threshold_by_max_metric value for the validation data.
  • xval – If xval is True, then return the threshold_by_max_metric value for the cross validation data.
Returns:

The threshold_by_max_metric for this binomial model.

fnr(thresholds=None, train=False, valid=False, xval=False)[source]

Get the False Negative Rates for a set of thresholds. If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:
  • thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
  • train – If train is True, then return the fnr value for the training data.
  • valid – If valid is True, then return the fnr value for the validation data.
  • xval – If xval is True, then return the fnr value for the cross validation data.
Returns:

The fnr for this binomial model.

fpr(thresholds=None, train=False, valid=False, xval=False)[source]

Get the False Positive Rates for a set of thresholds. If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:
  • thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
  • train – If train is True, then return the fpr value for the training data.
  • valid – If valid is True, then return the fpr value for the validation data.
  • xval – If xval is True, then return the fpr value for the cross validation data.
Returns:

The fpr for this binomial model.

max_per_class_error(thresholds=None, train=False, valid=False, xval=False)[source]

Get the max per class error for a set of thresholds. If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:
  • thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
  • train – If train is True, then return the max_per_class_error value for the training data.
  • valid – If valid is True, then return the max_per_class_error value for the validation data.
  • xval – If xval is True, then return the max_per_class_error value for the cross validation data.
Returns:

The max_per_class_error for this binomial model.

mcc(thresholds=None, train=False, valid=False, xval=False)[source]

Get the mcc for a set of thresholds. If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:
  • thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
  • train – If train is True, then return the mcc value for the training data.
  • valid – If valid is True, then return the mcc value for the validation data.
  • xval – If xval is True, then return the mcc value for the cross validation data.
Returns:

The mcc for this binomial model.

mean_per_class_error(thresholds=None, train=False, valid=False, xval=False)[source]

Get the mean per class error for a set of thresholds. If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:
  • thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
  • train – If train is True, then return the mean_per_class_error value for the training data.
  • valid – If valid is True, then return the mean_per_class_error value for the validation data.
  • xval – If xval is True, then return the mean_per_class_error value for the cross validation data.
Returns:

The mean_per_class_error for this binomial model.

metric(metric, thresholds=None, train=False, valid=False, xval=False)[source]

Get the metric value for a set of thresholds. If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:
  • train – If train is True, then return the metrics for the training data.
  • valid – If valid is True, then return the metrics for the validation data.
  • xval – If xval is True, then return the metrics for the cross validation data.
Returns:

The metrics for this binomial model.

missrate(thresholds=None, train=False, valid=False, xval=False)[source]

Get the miss rate (AKA False Negative Rate) for a set of thresholds. If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:
  • thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
  • train – If train is True, then return the missrate value for the training data.
  • valid – If valid is True, then return the missrate value for the validation data.
  • xval – If xval is True, then return the missrate value for the cross validation data.
Returns:

The missrate for this binomial model.

precision(thresholds=None, train=False, valid=False, xval=False)[source]

Get the precision for a set of thresholds. If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:
  • thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
  • train – If train is True, then return the precision value for the training data.
  • valid – If valid is True, then return the precision value for the validation data.
  • xval – If xval is True, then return the precision value for the cross validation data.
Returns:

The precision for this binomial model.

recall(thresholds=None, train=False, valid=False, xval=False)[source]

Get the Recall (AKA True Positive Rate) for a set of thresholds. If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:
  • thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
  • train – If train is True, then return the recall value for the training data.
  • valid – If valid is True, then return the recall value for the validation data.
  • xval – If xval is True, then return the recall value for the cross validation data.
Returns:

The recall for this binomial model.

roc(train=False, valid=False, xval=False)[source]

Return the coordinates of the ROC curve for a given set of data, as a two-tuple containing the false positive rates as a list and true positive rates as a list. If all are False (default), then return is the training data. If more than one ROC curve is requested, the data is returned as a dictionary of two-tuples. :param train: If train is true, then return the ROC coordinates for the training data. :param valid: If valid is true, then return the ROC coordinates for the validation data. :param xval: If xval is true, then return the ROC coordinates for the cross validation data. :return rocs_cooridinates: the true cooridinates of the roc curve.

sensitivity(thresholds=None, train=False, valid=False, xval=False)[source]

Get the sensitivity (AKA True Positive Rate or Recall) for a set of thresholds. If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:
  • thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
  • train – If train is True, then return the sensitivity value for the training data.
  • valid – If valid is True, then return the sensitivity value for the validation data.
  • xval – If xval is True, then return the sensitivity value for the cross validation data.
Returns:

The sensitivity for this binomial model.

specificity(thresholds=None, train=False, valid=False, xval=False)[source]

Get the specificity (AKA True Negative Rate) for a set of thresholds. If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:
  • thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
  • train – If train is True, then return the specificity value for the training data.
  • valid – If valid is True, then return the specificity value for the validation data.
  • xval – If xval is True, then return the specificity value for the cross validation data.
Returns:

The specificity for this binomial model.

tnr(thresholds=None, train=False, valid=False, xval=False)[source]

Get the True Negative Rate for a set of thresholds. If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:
  • thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
  • train – If train is True, then return the tnr value for the training data.
  • valid – If valid is True, then return the tnr value for the validation data.
  • xval – If xval is True, then return the tnr value for the cross validation data.
Returns:

The F1 for this binomial model.

tpr(thresholds=None, train=False, valid=False, xval=False)[source]

Get the True Positive Rate for a set of thresholds. If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:
  • thresholds – thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds in this set of metrics will be used.
  • train – If train is True, then return the tpr value for the training data.
  • valid – If valid is True, then return the tpr value for the validation data.
  • xval – If xval is True, then return the tpr value for the cross validation data.
Returns:

The tpr for this binomial model.

class h2o.grid.metrics.H2OClusteringGridSearch[source]

Bases: object

betweenss(train=False, valid=False, xval=False)[source]

Get the between cluster sum of squares.

If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”.

Parameters:

train : bool, optional

If True, then return the between cluster sum of squares value for the training data.

valid
: bool, optional

If True, then return the between cluster sum of squares value for the validation data.

xval
: bool, optional

If True, then return the between cluster sum of squares value for each of the cross-validated splits.

Returns:

Returns the between sum of squares values for the specified key(s).

centers()[source]
Returns:The centers for the KMeans model.
centers_std()[source]
Returns:The standardized centers for the kmeans model.
centroid_stats(train=False, valid=False, xval=False)[source]

Get the centroid statistics for each cluster.

If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”.

Parameters:

train : bool, optional

If True, then return the centroid statistics for the training data.

valid
: bool, optional

If True, then return the centroid statistics for the validation data.

xval
: bool, optional

If True, then return the centroid statistics for each of the cross-validated splits.

Returns:

Returns the centroid statistics for the specified key(s).

num_iterations()[source]

Get the number of iterations that it took to converge or reach max iterations.

Returns:The number of iterations (integer).
size(train=False, valid=False, xval=False)[source]

Get the sizes of each cluster.

If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:

train : bool, optional

If True, then return cluster sizes for the training data.

valid
: bool, optional

If True, then return the cluster sizes for the validation data.

xval
: bool, optional

If True, then return the cluster sizes for each of the cross-validated splits.

Returns:

Returns the cluster sizes for the specified key(s).

tot_withinss(train=False, valid=False, xval=False)[source]

Get the total within cluster sum of squares.

If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”.

Parameters:

train : bool, optional

If True, then return the total within cluster sum of squares value for the training data.

valid
: bool, optional

If True, then return the total within cluster sum of squares value for the validation data.

xval
: bool, optional

If True, then return the total within cluster sum of squares value for each of the cross-validated splits.

Returns:

Returns the total within cluster sum of squares values for the specified key(s).

totss(train=False, valid=False, xval=False)[source]

Get the total sum of squares.

If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”.

Parameters:

train : bool, optional

If True, then return the total sum of squares value for the training data.

valid
: bool, optional

If True, then return the total sum of squares value for the validation data.

xval
: bool, optional

If True, then return the total sum of squares value for each of the cross-validated splits.

Returns:

Returns the total sum of squares values for the specified key(s).

withinss(train=False, valid=False, xval=False)[source]

Get the within cluster sum of squares for each cluster.

If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”.

Parameters:

train : bool, optional

If True, then return the within cluster sum of squares value for the training data.

valid
: bool, optional

If True, then return the within cluster sum of squares value for the validation data.

xval
: bool, optional

If True, then return the within cluster sum of squares value for each of the cross-validated splits.

Returns:

Returns the total sum of squares values for the specified key(s).

class h2o.grid.metrics.H2ODimReductionGridSearch[source]

Bases: object

archetypes()[source]
Returns:the archetypes (Y) of the GLRM model.
final_step()[source]

Get the final step size from the GLRM model.

Returns:final step size (double)
num_iterations()[source]

Get the number of iterations that it took to converge or reach max iterations.

Returns:number of iterations (integer)
objective()[source]

Get the final value of the objective function from the GLRM model.

Returns:final objective value (double)
class h2o.grid.metrics.H2OMultinomialGridSearch[source]

Bases: object

confusion_matrix(data)[source]

Returns a confusion matrix based of H2O’s default prediction threshold for a dataset

hit_ratio_table(train=False, valid=False, xval=False)[source]

Retrieve the Hit Ratios

If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:
  • train – If train is True, then return the R^2 value for the training data.
  • valid – If valid is True, then return the R^2 value for the validation data.
  • xval – If xval is True, then return the R^2 value for the cross validation data.
Returns:

The R^2 for this regression model.

mean_per_class_error(train=False, valid=False, xval=False)[source]

Get the mean per class error. If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are “train”, “valid”, and “xval”

Parameters:
  • train – If train is True, then return the mean_per_class_error value for the training data.
  • valid – If valid is True, then return the mean_per_class_error value for the validation data.
  • xval – If xval is True, then return the mean_per_class_error value for the cross validation data.
Returns:

The mean_per_class_error for this binomial model.

class h2o.grid.metrics.H2ORegressionGridSearch[source]

Bases: object