From 3a4defa84f35b93d594ef055d0bdf1435e834835 Mon Sep 17 00:00:00 2001 From: Adam Valenta Date: Thu, 3 Mar 2022 19:23:03 +0100 Subject: [PATCH] PUBDEV-8547 - do not interate over not yet filled scoreKeepers --- .../hex/tree/isoforextended/ExtendedIsolationForest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/h2o-algos/src/main/java/hex/tree/isoforextended/ExtendedIsolationForest.java b/h2o-algos/src/main/java/hex/tree/isoforextended/ExtendedIsolationForest.java index c740f0a88817..002a6cf1a0d6 100644 --- a/h2o-algos/src/main/java/hex/tree/isoforextended/ExtendedIsolationForest.java +++ b/h2o-algos/src/main/java/hex/tree/isoforextended/ExtendedIsolationForest.java @@ -209,7 +209,7 @@ private void buildIsolationTreeEnsemble() { final boolean printout = (_parms._score_each_iteration || finalScoring || (sinceLastScore > _parms._score_interval && scored)); if (printout) { _model._output._model_summary = createModelSummaryTable(); - _model._output._scoring_history = createScoringHistoryTable(); + _model._output._scoring_history = createScoringHistoryTable(tid+1); LOG.info(_model.toString()); } } @@ -276,7 +276,7 @@ public TwoDimTable createModelSummaryTable() { return table; } - protected TwoDimTable createScoringHistoryTable() { + protected TwoDimTable createScoringHistoryTable(int ntreesTrained) { List colHeaders = new ArrayList<>(); List colTypes = new ArrayList<>(); List colFormat = new ArrayList<>(); @@ -292,7 +292,7 @@ protected TwoDimTable createScoringHistoryTable() { ScoreKeeper[] sks = _model._output._scored_train; int rows = 0; - for (int i = 0; i < sks.length; i++) { + for (int i = 0; i <= ntreesTrained; i++) { if (i != 0 && sks[i] != null && Double.isNaN(sks[i]._anomaly_score) || sks[i] == null) continue; rows++; } @@ -304,7 +304,7 @@ protected TwoDimTable createScoringHistoryTable() { colFormat.toArray(new String[0]), ""); int row = 0; - for( int i = 0; i