From 669aca2c3dbcccada006ea070217e6dd0f6e8150 Mon Sep 17 00:00:00 2001 From: Adam Valenta Date: Thu, 20 Jan 2022 18:23:28 +0100 Subject: [PATCH] PUBDEV-8547 - eif scoring history - always add final scoring to the history --- .../tree/isoforextended/ExtendedIsolationForest.java | 10 ++++++---- 1 file changed, 6 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 c208c149ec2f..a46bd618019e 100644 --- a/h2o-algos/src/main/java/hex/tree/isoforextended/ExtendedIsolationForest.java +++ b/h2o-algos/src/main/java/hex/tree/isoforextended/ExtendedIsolationForest.java @@ -184,14 +184,16 @@ private void buildIsolationTreeEnsemble() { isolationTreeStats.updateBy(isolationTree); boolean manualInterval = _parms._score_tree_interval > 0 && (tid +1) % _parms._score_tree_interval == 0; + boolean finalScoring = _parms._ntrees == (tid + 1); _model._output._scored_train[tid + 1] = new ScoreKeeper(); - if (_parms._score_each_iteration || manualInterval) { - ModelMetrics.MetricBuilder mb = new ScoreExtendedIsolationForestTask(_model).doAll(_train).getMetricsBuilder(); - _model._output._scored_train[tid + 1].fillFrom(mb.makeModelMetrics(_model, _parms.train(), null, null)); + if (_parms._score_each_iteration || manualInterval || finalScoring) { + ModelMetrics.MetricBuilder metricsBuilder = new ScoreExtendedIsolationForestTask(_model).doAll(_train).getMetricsBuilder(); + ModelMetrics modelMetrics = metricsBuilder.makeModelMetrics(_model, _parms.train(), null, null); + _model._output._training_metrics = modelMetrics; + _model._output._scored_train[tid + 1].fillFrom(modelMetrics); } } - _model._output._training_metrics = new ScoreExtendedIsolationForestTask(_model).doAll(_train).getMetricsBuilder().makeModelMetrics(_model, _parms.train(), null, null); _model._output._scoring_history = createScoringHistoryTable(); } }