-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add custom metric to leaderboard * Verify sorting by custom metric * Make sure the custom metrics share the same names * Fix custom metric calculation in CV (#15576) * GH-15565: Add custom metric to automl [nocheck] (#15577) * Fix custom metric calculation in CV (prototype) * Allow custom_metric_func in automl * Return NaN for models that don't support custom metric * Revert change used to ensure existing metric * GH-15559: Add custom metric to SE [nocheck] (#15579) * Fix custom metric calculation in CV (prototype) * Allow custom_metric_func in automl * Return NaN for models that don't support custom metric * Revert change used to ensure existing metric * Add custom metric to SE * Mention SE support of the custom metric func in docs * Use directly model metrics in leaderboard This change is motivated by an issue with SE level-one validation frame that is ephemeral and can not be checksummed.
- Loading branch information
1 parent
a6b6c88
commit 5288084
Showing
18 changed files
with
216 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
h2o-py/tests/testdir_algos/automl/pyunit_automl_supports_custom_metric.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import os | ||
import sys | ||
|
||
sys.path.insert(1, os.path.join("..", "..", "..")) | ||
import h2o | ||
from h2o.automl import H2OAutoML | ||
from tests import pyunit_utils as pu, dataset_prostate, CustomMaeFunc | ||
|
||
|
||
def test_automl_custom_metric(): | ||
def custom_mae_mm(): | ||
return h2o.upload_custom_metric(CustomMaeFunc, func_name="mae", func_file="mm_mae.py") | ||
|
||
ftrain, fvalid, _ = dataset_prostate() | ||
ftrain = ftrain.rbind(fvalid) | ||
ftrain = h2o.H2OFrame(ftrain.as_data_frame(), "my_training_frame") | ||
aml = H2OAutoML(max_models=20, custom_metric_func=custom_mae_mm(), sort_metric="custom") | ||
aml.train(y="AGE", training_frame=ftrain) | ||
|
||
for sd in ["train", "valid", "xval", "AUTO"]: | ||
print(sd + "\n" + ("=" * len(sd))) | ||
ldb = h2o.make_leaderboard(aml, scoring_data="xval").as_data_frame() | ||
print(f"MAE==Custom: {((ldb.mae == ldb.custom) | ldb.custom.isna()).all()}") | ||
print(ldb) | ||
assert ((ldb.mae == ldb.custom) | ldb.custom.isna()).all() and (~ldb.custom.isna()).any() | ||
|
||
|
||
pu.run_tests([ | ||
test_automl_custom_metric, | ||
]) |
Oops, something went wrong.