Newer
Older
package io.gitlab.chaver.minimax.cli;
import org.junit.jupiter.api.Test;
import picocli.CommandLine;
import java.io.File;
import static org.junit.jupiter.api.Assertions.*;
class LearnFunctionAndRankCliTest {
@Test
void test() throws Exception {
String rulesPath = "results/rules/iris";
String trainingPercentage = "0.26";
String resPath = File.createTempFile("rules", "").getAbsolutePath();
String measures = "phi:kruskal:yuleQ";
String seed = "1234";
String[] args = {"-d", rulesPath, "--train", trainingPercentage, "-r", resPath, "-m", measures,
"--seed", seed};
new CommandLine(new SplitTrainingTestCli()).execute(args);
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
String oracleName = "owa";
String learningAlgorithm = "kappalab";
String learnResPath = File.createTempFile("learn", "").getAbsolutePath();
args = new String[]{"-d", rulesPath, "-r", learnResPath, "-m", measures,
"--seed", seed, "-o", oracleName, "-l", learningAlgorithm, "--tt", resPath};
int exitCode = new CommandLine(new LearnFunctionAndRankCli()).execute(args);
assertEquals(0, exitCode);
}
@Test
void test2() throws Exception {
String rulesPath = "results/rules/iris";
String trainingPercentage = "0.26";
String resPath = File.createTempFile("rules", "").getAbsolutePath();
String measures = "phi:kruskal:yuleQ";
String seed = "1234";
String[] args = {"-d", rulesPath, "--train", trainingPercentage, "-r", resPath, "-m", measures,
"--seed", seed};
new CommandLine(new SplitTrainingTestCli()).execute(args);
String oracleName = "chiSquared";
String learningAlgorithm = "kappalab";
String learnResPath = File.createTempFile("learn", "").getAbsolutePath();
args = new String[]{"-d", rulesPath, "-r", learnResPath, "-m", measures,
"--seed", seed, "-o", oracleName, "-l", learningAlgorithm, "--tt", resPath};
int exitCode = new CommandLine(new LearnFunctionAndRankCli()).execute(args);
assertEquals(0, exitCode);
}
@Test
void test3() throws Exception {
String rulesPath = "results/rules/iris";
String trainingPercentage = "0.26";
String resPath = File.createTempFile("rules", "").getAbsolutePath();
String measures = "phi:kruskal:yuleQ";
String seed = "1234";
String[] args = {"-d", rulesPath, "--train", trainingPercentage, "-r", resPath, "-m", measures,
"--seed", seed};
new CommandLine(new SplitTrainingTestCli()).execute(args);
String oracleName = "choquetPearson";
String learningAlgorithm = "kappalab";
String learnResPath = File.createTempFile("learn", "").getAbsolutePath();
args = new String[]{"-d", rulesPath, "-r", learnResPath, "-m", measures,
"--seed", seed, "-o", oracleName, "-l", learningAlgorithm, "--tt", resPath};
int exitCode = new CommandLine(new LearnFunctionAndRankCli()).execute(args);
assertEquals(0, exitCode);