List of usage examples for weka.classifiers.mi MISMO MISMO
MISMO
From source file:tutorial.exampleMIMLLabelPowerset.java
License:Open Source License
public static void main(String[] args) { try {//from w ww . j ava 2 s.co m // String arffFileNameTrain = Utils.getOption("f", args); // String xmlFileName = Utils.getOption("x", args); String arffFileNameTrain = "data" + File.separator + "miml_text_data_random_80train.arff"; String arffFileNameTest = "data" + File.separator + "miml_text_data_random_20test.arff"; String xmlFileName = "data" + File.separator + "miml_text_data.xml"; // Parameter checking if (arffFileNameTrain.isEmpty()) { System.out.println("Arff pathName must be specified."); showUse(); } if (arffFileNameTest.isEmpty()) { System.out.println("Arff pathName must be specified."); showUse(); } if (xmlFileName.isEmpty()) { System.out.println("Xml pathName must be specified."); showUse(); } // Loads the dataset System.out.println("Loading the dataset...."); MIMLInstances mimlTrain = new MIMLInstances(arffFileNameTrain, xmlFileName); MIMLInstances mimlTest = new MIMLInstances(arffFileNameTest, xmlFileName); Classifier baseLearner = new MISMO(); MIMLLabelPowerset MIMLLP = new MIMLLabelPowerset(baseLearner); MIMLLP.setDebug(true); MIMLLP.build(mimlTrain); // Evaluates a single instance Bag bag = mimlTrain.getBag(1); MultiLabelOutput prediction = MIMLLP.makePrediction(bag); System.out.println("\nPrediction on a single instance:\n\t" + prediction.toString()); // Performs a train-test evaluation Evaluator evalTT = new Evaluator(); System.out.println("\nPerforming train-test evaluation:\n"); Evaluation resultsTT = evalTT.evaluate(MIMLLP, mimlTest, mimlTrain); System.out.println("\nResults on train test evaluation:\n" + resultsTT); System.out.println("The program has finished."); } catch (IndexOutOfBoundsException ioobe) { System.err.println("Exception: Incorrect index of Bag"); } catch (Exception e) { e.printStackTrace(); } }