diff --git a/common/transform/src/main/java/ai/h2o/mojos/deploy/common/transform/MojoFrameToScoreResponseConverter.java b/common/transform/src/main/java/ai/h2o/mojos/deploy/common/transform/MojoFrameToScoreResponseConverter.java index 92a6856d..5be163da 100644 --- a/common/transform/src/main/java/ai/h2o/mojos/deploy/common/transform/MojoFrameToScoreResponseConverter.java +++ b/common/transform/src/main/java/ai/h2o/mojos/deploy/common/transform/MojoFrameToScoreResponseConverter.java @@ -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()); + } } }