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 Oct 30, 2023
1 parent 8ab84d7 commit 3a4defa
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand Down Expand Up @@ -276,7 +276,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 @@ -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++;
}
Expand All @@ -304,7 +304,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 3a4defa

Please sign in to comment.