Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
return empty prediction interval if mojo response frame does not pres…
Browse files Browse the repository at this point in the history
…ent interval columns
  • Loading branch information
jih147 committed May 12, 2023
1 parent 3675a43 commit 5d552eb
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,20 @@ private void fillOutputRows(
*/
private void fillWithPredictionInterval(
MojoFrame mojoFrame, ScoreRequest scoreRequest, ScoreResponse scoreResponse) {
if (Boolean.TRUE.equals(scoreRequest.isRequestPredictionIntervals())
&& mojoFrame.getNcols() > 1) {
if (Boolean.TRUE.equals(scoreRequest.isRequestPredictionIntervals())) {
if (!supportPredictionInterval) {
throw new IllegalStateException(
"Unexpected error, prediction interval should be supported, but actually not");
}
int targetIdx = getTargetColIdx(Arrays.asList(mojoFrame.getColumnNames()));
PredictionInterval predictionInterval = new PredictionInterval();
predictionInterval.setFields(getPredictionIntervalFields(mojoFrame, targetIdx));
predictionInterval.setRows(getPredictionIntervalRows(mojoFrame, targetIdx));
scoreResponse.setPredictionIntervals(predictionInterval);
if (mojoFrame.getNcols() > 1) {
int targetIdx = getTargetColIdx(Arrays.asList(mojoFrame.getColumnNames()));
PredictionInterval predictionInterval = new PredictionInterval();
predictionInterval.setFields(getPredictionIntervalFields(mojoFrame, targetIdx));
predictionInterval.setRows(getPredictionIntervalRows(mojoFrame, targetIdx));
scoreResponse.setPredictionIntervals(predictionInterval);
} else {
scoreResponse.setPredictionIntervals(new PredictionInterval());
}
}
}

Expand Down

0 comments on commit 5d552eb

Please sign in to comment.