use of org.optaplanner.core.api.score.buildin.simplebigdecimal.SimpleBigDecimalScore in project kogito-apps by kiegroup.
the class LimeImpactScoreCalculatorTest method testNonZeroScore.
@Test
void testNonZeroScore() throws ExecutionException, InterruptedException, TimeoutException {
PredictionProvider model = TestUtils.getDummyTextClassifier();
LimeImpactScoreCalculator scoreCalculator = new LimeImpactScoreCalculator();
LimeConfig config = new LimeConfig();
List<Feature> features = List.of(FeatureFactory.newFulltextFeature("text", "money so they say is the root of all evil today"));
PredictionInput input = new PredictionInput(features);
List<PredictionOutput> predictionOutputs = model.predictAsync(List.of(input)).get(Config.DEFAULT_ASYNC_TIMEOUT, Config.DEFAULT_ASYNC_TIMEUNIT);
assertThat(predictionOutputs).isNotNull();
assertThat(predictionOutputs.size()).isEqualTo(1);
PredictionOutput output = predictionOutputs.get(0);
Prediction prediction = new SimplePrediction(input, output);
List<Prediction> predictions = List.of(prediction);
List<LimeConfigEntity> entities = LimeConfigEntityFactory.createEncodingEntities(config);
LimeConfigSolution solution = new LimeConfigSolution(config, predictions, entities, model);
SimpleBigDecimalScore score = scoreCalculator.calculateScore(solution);
assertThat(score).isNotNull();
assertThat(score.getScore()).isNotNull().isNotEqualTo(BigDecimal.valueOf(0));
}
use of org.optaplanner.core.api.score.buildin.simplebigdecimal.SimpleBigDecimalScore in project kogito-apps by kiegroup.
the class LimeStabilityScoreCalculatorTest method testScoreWithEmptyPredictions.
@Test
void testScoreWithEmptyPredictions() {
LimeStabilityScoreCalculator scoreCalculator = new LimeStabilityScoreCalculator();
LimeConfig config = new LimeConfig();
List<Prediction> predictions = Collections.emptyList();
List<LimeConfigEntity> entities = Collections.emptyList();
PredictionProvider model = TestUtils.getDummyTextClassifier();
LimeConfigSolution solution = new LimeConfigSolution(config, predictions, entities, model);
SimpleBigDecimalScore score = scoreCalculator.calculateScore(solution);
assertThat(score).isNotNull();
assertThat(score.getScore()).isNotNull();
assertThat(score.getScore()).isEqualTo(BigDecimal.valueOf(0));
}
use of org.optaplanner.core.api.score.buildin.simplebigdecimal.SimpleBigDecimalScore in project kogito-apps by kiegroup.
the class LimeImpactScoreCalculatorTest method testScoreWithEmptyPredictions.
@Test
void testScoreWithEmptyPredictions() {
LimeImpactScoreCalculator scoreCalculator = new LimeImpactScoreCalculator();
LimeConfig config = new LimeConfig();
List<Prediction> predictions = Collections.emptyList();
List<LimeConfigEntity> entities = Collections.emptyList();
PredictionProvider model = TestUtils.getDummyTextClassifier();
LimeConfigSolution solution = new LimeConfigSolution(config, predictions, entities, model);
SimpleBigDecimalScore score = scoreCalculator.calculateScore(solution);
assertThat(score).isNotNull();
assertThat(score.getScore()).isNotNull().isEqualTo(BigDecimal.valueOf(0));
}
use of org.optaplanner.core.api.score.buildin.simplebigdecimal.SimpleBigDecimalScore in project kogito-apps by kiegroup.
the class LimeCombinedScoreCalculatorTest method testNonZeroScore.
@Test
void testNonZeroScore() throws ExecutionException, InterruptedException, TimeoutException {
PredictionProvider model = TestUtils.getDummyTextClassifier();
LimeCombinedScoreCalculator scoreCalculator = new LimeCombinedScoreCalculator();
LimeConfig config = new LimeConfig();
List<Feature> features = List.of(FeatureFactory.newFulltextFeature("text", "money so they say is the root of all evil today"));
PredictionInput input = new PredictionInput(features);
List<PredictionOutput> predictionOutputs = model.predictAsync(List.of(input)).get(Config.DEFAULT_ASYNC_TIMEOUT, Config.DEFAULT_ASYNC_TIMEUNIT);
assertThat(predictionOutputs).isNotNull();
assertThat(predictionOutputs.size()).isEqualTo(1);
PredictionOutput output = predictionOutputs.get(0);
Prediction prediction = new SimplePrediction(input, output);
List<Prediction> predictions = List.of(prediction);
List<LimeConfigEntity> entities = LimeConfigEntityFactory.createEncodingEntities(config);
LimeConfigSolution solution = new LimeConfigSolution(config, predictions, entities, model);
SimpleBigDecimalScore score = scoreCalculator.calculateScore(solution);
assertThat(score).isNotNull();
assertThat(score.getScore()).isNotNull().isNotEqualTo(BigDecimal.valueOf(0));
}
use of org.optaplanner.core.api.score.buildin.simplebigdecimal.SimpleBigDecimalScore in project kogito-apps by kiegroup.
the class LimeCombinedScoreCalculatorTest method testScoreWithEmptyPredictions.
@Test
void testScoreWithEmptyPredictions() {
LimeCombinedScoreCalculator scoreCalculator = new LimeCombinedScoreCalculator();
LimeConfig config = new LimeConfig();
List<Prediction> predictions = Collections.emptyList();
List<LimeConfigEntity> entities = Collections.emptyList();
PredictionProvider model = TestUtils.getDummyTextClassifier();
LimeConfigSolution solution = new LimeConfigSolution(config, predictions, entities, model);
SimpleBigDecimalScore score = scoreCalculator.calculateScore(solution);
assertThat(score).isNotNull();
assertThat(score.getScore()).isNotNull().isEqualTo(BigDecimal.valueOf(0));
}
Aggregations