Skip to content

Commit

Permalink
GH-15809: fix printing metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
syzonyuliia-h2o authored and wendycwong committed Feb 5, 2024
1 parent b2318c8 commit c8f0487
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions h2o-py/h2o/model/metrics_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
:copyright: (c) 2016 H2O.ai
:license: Apache License Version 2.0 (see LICENSE for details)
"""
import math
from collections import OrderedDict

from h2o.display import H2ODisplay, display, repr_def, format_to_html, format_to_multiline
Expand Down Expand Up @@ -151,11 +152,12 @@ def _str_items(self, verbosity=None):
"Null deviance: {}".format(self.null_deviance()),
"Residual deviance: {}".format(self.residual_deviance()),
])
if is_type(self.aic(), numeric) and self.aic() != 0:
items.append("AIC: {}".format(self.aic()))
if is_type(self.loglikelihood(), numeric) and self.loglikelihood() != 0:
items.append("Loglikelihood: {}".format(self.loglikelihood()))


if is_type(self.aic(), numeric) and not math.isnan(self.aic()) and self.aic() != 0:
items.append("AIC: {}".format(self.aic()))
if is_type(self.loglikelihood(), numeric) and not math.isnan(self.aic()) and self.loglikelihood() != 0:
items.append("Loglikelihood: {}".format(self.loglikelihood()))

items.extend(self._str_items_custom())
return items

Expand Down

0 comments on commit c8f0487

Please sign in to comment.