Skip to content

Commit

Permalink
Fix failed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maurever committed Jan 15, 2025
1 parent d19bd44 commit 5b99efe
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions h2o-algos/src/test/java/hex/knn/KNNTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ public void testIris() {
ModelMetricsMultinomial mm1 = (ModelMetricsMultinomial) knn._output._training_metrics;
Assert.assertEquals(mm.auc(), mm1.auc(), 0);

// test after KNN API will be ready
//knn.testJavaScoring(fr, preds, 0);

knn.testJavaScoring(fr, preds, 0);
} finally {
if (knn != null){
knn.delete();
Expand Down Expand Up @@ -103,6 +101,8 @@ public void testSimpleFrameEuclidean() {
distances = knn._output.getDistances();
Assert.assertNotNull(distances);

System.out.println(distances.toTwoDimTable());

Assert.assertEquals(distances.vec(0).at8(0), 1);
Assert.assertEquals(distances.vec(1).at(0), 0.0, 0);
Assert.assertEquals(distances.vec(2).at(0), 1.414, 10e-3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def make_tests(classifier):


failing = [
'H2OStackedEnsembleClassifier', 'H2OUpliftRandomForestClassifier' # needs a separate test (requires models as parameters)
'H2OStackedEnsembleClassifier', 'H2OUpliftRandomForestClassifier', 'H2OKnnClassifier' # needs a separate test (requires models as parameters)
]
classifiers = [cls for name, cls in inspect.getmembers(h2o.sklearn, inspect.isclass)
if name.endswith('Classifier') and name not in ['H2OAutoMLClassifier']+failing]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ def make_tests(classifier):
'H2OUpliftRandomForestEstimator', # generic part is not implemented yet
'H2ODecisionTreeEstimator', # generic part is not implemented yet
'H2OAdaBoostEstimator', # generic part is not implemented yet or test needs to be adjusted just for classification
'H2OKnnEstimator' # generic part is not implemented yet
]
estimators = [cls for name, cls in inspect.getmembers(h2o.sklearn, inspect.isclass)
if name.endswith('Estimator') and name not in ['H2OAutoMLEstimator'] + failing]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ def make_tests(classifier):
'H2OStackedEnsembleRegressor', # needs a separate test (requires models as parameters),
'H2OUpliftRandomForestRegressor', # does not support regression yet
'H2ODecisionTreeRegressor', # does not support regression yet
'H2OAdaBoostRegressor' # does not support regression yet
'H2OAdaBoostRegressor', # does not support regression yet
'H2OKnnRegressor' # does not support regression
]
regressors = [cls for name, cls in inspect.getmembers(h2o.sklearn, inspect.isclass)
if name.endswith('Regressor') and name not in ['H2OAutoMLRegressor']+failing]
Expand Down
2 changes: 1 addition & 1 deletion h2o-py/tests_rest_smoke/testdir_multi_jvm/test_rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
algos = ['coxph', 'kmeans', 'deeplearning', 'drf', 'glm', 'gbm', 'pca', 'naivebayes', 'glrm', 'svd', 'isotonicregression',
'psvm', 'aggregator', 'word2vec', 'stackedensemble', 'xgboost', 'isolationforest', 'gam',
'generic', 'targetencoder', 'rulefit', 'extendedisolationforest', 'anovaglm', 'modelselection',
'upliftdrf', 'infogram', 'dt', 'adaboost', 'hglm']
'upliftdrf', 'infogram', 'dt', 'adaboost', 'hglm', 'knn']

algo_additional_default_params = { 'grep' : { 'regex' : '.*' },
'kmeans' : { 'k' : 2 },
Expand Down
2 changes: 1 addition & 1 deletion h2o-r/tests/testdir_algos/knn/runit_knn_smoke.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ source("../../../scripts/h2o-r-test-setup.R")

knn.smoke <- function() {
iris.hex <- h2o.uploadFile( locate("smalldata/iris/iris.csv"))
iris.knn <- h2o.knn(x=1:4, training_frame=iris.hex, k = 3, distance="euclidean", seed = 1234)
iris.knn <- h2o.knn(x=1:4, y=5, training_frame=iris.hex, k=3 , distance="euclidean", seed=1234)

# Score test data with different default auc_type (previous was "NONE", so no AUC calculation)
perf <- h2o.performance(iris.knn, test.hex, auc_type="WEIGHTED_OVO")
Expand Down

0 comments on commit 5b99efe

Please sign in to comment.