Skip to content

Commit

Permalink
PUBDEV-8547 - do not interate over not yet filled scoreKeepers
Browse files Browse the repository at this point in the history
  • Loading branch information
valenad1 committed Nov 16, 2023
1 parent 9cbb8c8 commit a6e282f
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ private void buildIsolationTreeEnsemble() {
final boolean printout = (_parms._score_each_iteration || finalScoring || (sinceLastScore > _parms._score_interval && scored)) && !_parms._disable_training_metrics;
if (printout) {
_model._output._model_summary = createModelSummaryTable();
_model._output._scoring_history = createScoringHistoryTable();
_model._output._scoring_history = createScoringHistoryTable(tid+1);
LOG.info(_model.toString());
}
}
Expand Down Expand Up @@ -277,7 +277,7 @@ public TwoDimTable createModelSummaryTable() {
return table;
}

protected TwoDimTable createScoringHistoryTable() {
protected TwoDimTable createScoringHistoryTable(int ntreesTrained) {
List<String> colHeaders = new ArrayList<>();
List<String> colTypes = new ArrayList<>();
List<String> colFormat = new ArrayList<>();
Expand All @@ -293,7 +293,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++;
}
Expand All @@ -305,7 +305,7 @@ protected TwoDimTable createScoringHistoryTable() {
colFormat.toArray(new String[0]),
"");
int row = 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;
int col = 0;
DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
Expand Down

0 comments on commit a6e282f

Please sign in to comment.