Skip to content

Commit

Permalink
Fixed errors with commits
Browse files Browse the repository at this point in the history
  • Loading branch information
pibizza committed Apr 6, 2022
1 parent 1091c17 commit 8efe298
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ public void testSegmentationMedianMiningTest() {
PMML4Result pmml4Result = evaluate(pmmlRuntime, inputData, MODEL_NAME);

assertThat(pmml4Result.getResultVariables().get(TARGET_FIELD)).isNotNull();
`pmml4Result.getResultVariables().get(TARGET_FIELD)).isEqualTo(result);
assertThat(pmml4Result.getResultVariables().get(TARGET_FIELD)).isEqualTo(result);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,73 +82,7 @@ public static Collection<Object[]> data() {
public void testSimpleScorecardCategorical() {
final Map<String, Object> inputData = new HashMap<>();
inputData.put("input1", input1);
inputData.put("input2", input2); * Copyright 2021 Red Hat, Inc. and/or its affiliates.
package org.kie.pmml.models.scorecard.tests;

import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

import static org.assertj.core.api.Assertions.assertThat;
import org.assertj.core.data.Percentage;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.kie.api.pmml.PMML4Result;
import org.kie.pmml.api.runtime.PMMLRuntime;
import org.kie.pmml.models.tests.AbstractPMMLTest;

@RunWith(Parameterized.class)
public class MultipleAirconditioningScorecardTest extends AbstractPMMLTest {
private static final String FILE_NAME = "MultipleScorecard.pmml";
private static final String MODEL_NAME = "Forecast Score";
private static final String TARGET_FIELD = "forecastScore";
private static PMMLRuntime pmmlRuntime;

private String period;
private String worldContinent;
private boolean precipitation;
private double humidity;
private double score;

public MultipleAirconditioningScorecardTest(String period, String worldContinent, boolean precipitation, double humidity,
double score) {
this.period = period;
this.worldContinent = worldContinent;
this.precipitation = precipitation;
this.humidity = humidity;
this.score = score;
}

@BeforeClass
public static void setupClass() {
pmmlRuntime = getPMMLRuntime(FILE_NAME);
}

@Parameterized.Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{
{"SPRING", "EUROPE", true, 25.0, 9.5},
{"SUMMER", "ASIA", true, 35.0, 10.0},
});
}

@Test
public void testAirconditioningScorecard() {
final Map<String, Object> inputData = new HashMap<>();
inputData.put("period", period);
inputData.put("worldcontinent", worldContinent);
inputData.put("precipitation", precipitation);
inputData.put("humidity", humidity);
PMML4Result pmml4Result = evaluate(pmmlRuntime, inputData, MODEL_NAME);

assertThat(pmml4Result.getResultVariables().get(TARGET_FIELD)).isNotNull();
assertThat((double) (pmml4Result.getResultVariables().get(TARGET_FIELD)))
.isCloseTo(score, Percentage.withPercentage(0.1));
}
}
inputData.put("input2", input2);

PMML4Result pmml4Result = evaluate(pmmlRuntime, inputData, MODEL_NAME);

Expand Down

0 comments on commit 8efe298

Please sign in to comment.