Skip to content

Commit

Permalink
add test printout.
Browse files Browse the repository at this point in the history
  • Loading branch information
wendycwong committed Feb 10, 2024
1 parent 9a5bf25 commit 582c042
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def test(x, y, output_test, strip_part, algo_name, generic_algo_name, family):
glm.train(x=x, y=y, training_frame=airlines, validation_frame=airlines,)
with H2OTableDisplay.pandas_rendering_enabled(False), capture_output() as (original_output, _):
glm.show()
print("################# glm model output metrics")
print(original_output.getvalue())
original_model_filename = tempfile.mkdtemp()
original_model_filename = glm.download_mojo(original_model_filename)
Expand All @@ -30,6 +31,7 @@ def test(x, y, output_test, strip_part, algo_name, generic_algo_name, family):
assert generic_mojo_model_from_file is not None
with H2OTableDisplay.pandas_rendering_enabled(False), capture_output() as (generic_output, _):
generic_mojo_model_from_file.show()
print("################# generic model metrics")
print(generic_output.getvalue())
compare_params(glm, generic_mojo_model_from_file)

Expand Down Expand Up @@ -72,16 +74,19 @@ def test(x, y, output_test, strip_part, algo_name, generic_algo_name, family):
def mojo_model_test_binomial():
test(["Origin", "Dest"], "IsDepDelayed", compare_output, 'GLM Model: summary', 'ModelMetricsBinomialGLM: glm',
'ModelMetricsBinomialGLMGeneric: generic', 'binomial')
print("test for binomial is completed.")


def mojo_model_test_regression():
test(["Origin", "Dest"], "Distance", compare_output, 'GLM Model: summary', 'ModelMetricsRegressionGLM: glm',
'ModelMetricsRegressionGLMGeneric: generic', 'gaussian')
print("test for gaussian is completed.")


def mojo_model_test_multinomial():
test(["Origin", "Distance"], "Dest", compare_output, 'GLM Model: summary', 'ModelMetricsMultinomialGLM: glm',
'ModelMetricsMultinomialGLMGeneric: generic', 'multinomial')
print("test for multinomial is completed.")


def mojo_model_test_ordinal():
Expand Down

0 comments on commit 582c042

Please sign in to comment.