List of usage examples for weka.classifiers.trees J48 J48
J48
From source file:mulan.classifier.meta.MultiLabelMetaLearner.java
License:Open Source License
/** * Creates a new instance of {@link MultiLabelMetaLearner} with default * {@link LabelPowerset} multi-label classifier using J48 as the base * classifier./*from w w w. jav a2 s .co m*/ * @throws Exception */ public MultiLabelMetaLearner() throws Exception { this(new LabelPowerset(new J48())); }
From source file:mulan.classifier.meta.thresholding.ExampleBasedFMeasureOptimizer.java
License:Open Source License
/** * Default constructor */ public ExampleBasedFMeasureOptimizer() { this(new BinaryRelevance(new J48())); }
From source file:mulan.classifier.meta.thresholding.MLPTO.java
License:Open Source License
/** * Default constructor */ public MLPTO() { this(new BinaryRelevance(new J48()), new HammingLoss()); }
From source file:mulan.classifier.transformation.Pairwise.java
License:Open Source License
/** * Default constructor using J48 as underlying classifier */ public Pairwise() { this(new J48()); }
From source file:mulan.classifier.transformation.TransformationBasedMultiLabelLearner.java
License:Open Source License
/** * Creates a new instance of {@link TransformationBasedMultiLabelLearner} with default * {@link J48} base classifier./*from w w w. j a v a2s . c om*/ */ public TransformationBasedMultiLabelLearner() { this(new J48()); }
From source file:mulan.classifier.transformation.TwoStageClassifierChainArchitecture.java
License:Open Source License
/** * Default constructor using J48 as underlying classifier */ public TwoStageClassifierChainArchitecture() { super(new J48()); }
From source file:mulan.classifier.transformation.TwoStagePrunedClassifierChainArchitecture.java
License:Open Source License
/** * Default constructor using J48 as underlying classifier */ public TwoStagePrunedClassifierChainArchitecture() { super(new J48()); }
From source file:mulan.classifier.transformation.TwoStageVotingArchitecture.java
License:Open Source License
/** * Default constructor using J48 as underlying classifier */ public TwoStageVotingArchitecture() { super(new J48()); }
From source file:mulan.examples.GettingPredictionsOnUnlabeledData.java
License:Open Source License
/** * Executes this example//from www. j a v a 2 s.com * * @param args command-line arguments -arff, -xml and -unlabeled */ public static void main(String[] args) { try { String arffFilename = Utils.getOption("arff", args); String xmlFilename = Utils.getOption("xml", args); System.out.println("Loading the training data set..."); MultiLabelInstances trainingData = new MultiLabelInstances(arffFilename, xmlFilename); RAkEL model = new RAkEL(new LabelPowerset(new J48())); System.out.println("Building the model..."); model.build(trainingData); String unlabeledDataFilename = Utils.getOption("unlabeled", args); System.out.println("Loading the unlabeled data set..."); MultiLabelInstances unlabeledData = new MultiLabelInstances(unlabeledDataFilename, xmlFilename); int numInstances = unlabeledData.getNumInstances(); for (int instanceIndex = 0; instanceIndex < numInstances; instanceIndex++) { Instance instance = unlabeledData.getDataSet().instance(instanceIndex); MultiLabelOutput output = model.makePrediction(instance); if (output.hasBipartition()) { String bipartion = Arrays.toString(output.getBipartition()); System.out.println("Predicted bipartion: " + bipartion); } if (output.hasRanking()) { String ranking = Arrays.toString(output.getRanking()); System.out.println("Predicted ranking: " + ranking); } if (output.hasConfidences()) { String confidences = Arrays.toString(output.getConfidences()); System.out.println("Predicted confidences: " + confidences); } } } catch (InvalidDataFormatException e) { System.err.println(e.getMessage()); } catch (Exception ex) { Logger.getLogger(GettingPredictionsOnUnlabeledData.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:mulan.examples.StoringAndLoadingModels.java
License:Open Source License
public static void main(String[] args) { try {/*from w ww .jav a 2 s .co m*/ String trainingDataFilename = Utils.getOption("train", args); String testingDataFilename = Utils.getOption("test", args); String labelsFilename = Utils.getOption("labels", args); System.out.println("Loading the training data set..."); MultiLabelInstances trainingData = new MultiLabelInstances(trainingDataFilename, labelsFilename); System.out.println("Loading the testing data set..."); MultiLabelInstances testingData = new MultiLabelInstances(testingDataFilename, labelsFilename); BinaryRelevance learner1 = new BinaryRelevance(new J48()); String modelFilename = Utils.getOption("model", args); System.out.println("Building the model..."); learner1.build(trainingData); System.out.println("Storing the model..."); SerializationHelper.write(modelFilename, learner1); System.out.println("Loading the model..."); BinaryRelevance learner2; learner2 = (BinaryRelevance) (MultiLabelLearner) SerializationHelper.read(modelFilename); Evaluator evaluator = new Evaluator(); Evaluation evaluation; evaluation = evaluator.evaluate(learner2, testingData); System.out.println(evaluation); } catch (Exception ex) { Logger.getLogger(StoringAndLoadingModels.class.getName()).log(Level.SEVERE, null, ex); } }