Skip to content
Snippets Groups Projects
Commit ec7996bc authored by a.croix's avatar a.croix
Browse files

Add new Main function for new Dataset

parent 4f9392eb
No related branches found
No related tags found
No related merge requests found
Pipeline #3189 failed
package be.cylab.java.wowa.training;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
import java.util.logging.StreamHandler;
public class Icmcis {
public static void main(final String[] args) {
int population_size = Integer.parseInt(args[0]);
int crossover_rate = Integer.parseInt(args[1]);
int mutation_rate = Integer.parseInt(args[2]);
int max_generation_number = Integer.parseInt(args[3]);
int selection_method;
if (args[4].matches("RWS")) {
selection_method = TrainerParameters.SELECTION_METHOD_RWS;
} else if (args[4].matches("TOS")) {
selection_method = TrainerParameters.SELECTION_METHOD_TOS;
} else {
throw new IllegalArgumentException(
"Selection method must be RWS ar TOS");
}
int generation_population_method;
if (args[5].matches("RANDOM")) {
generation_population_method
= TrainerParameters.POPULATION_INITIALIZATION_RANDOM;
} else if (args[5].matches("QUASI_RANDOM")) {
generation_population_method
= TrainerParameters.POPULATION_INITIALIZATION_QUASI_RANDOM;
} else {
throw new IllegalArgumentException(
"Initialization must be RANDOM or QUASI_RANDOM");
}
String solution_type = args[6];
AbstractSolution sol_type = null;
if (solution_type.matches("DISTANCE")) {
sol_type = new SolutionDistance(16);
} else if (solution_type.matches("AUC")) {
sol_type = new SolutionAUC(16);
} else {
throw new IllegalArgumentException(
"Solution type must be Distance or AUC");
}
String data_file = "./ressources/ratio_train.csv";
String expected_file
= "./ressources/Label.csv";
Logger logger = Logger.getLogger(Trainer.class.getName());
logger.setLevel(Level.INFO);
StreamHandler handler = new StreamHandler(System.out,
new SimpleFormatter());
logger.addHandler(handler);
TrainerParameters parameters = new TrainerParameters(
logger, population_size,
crossover_rate,
mutation_rate,
max_generation_number,
selection_method,
generation_population_method);
Trainer trainer = new Trainer(parameters, sol_type);
AbstractSolution result = trainer.runCSV(data_file, expected_file);
System.out.println(result);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment