/** * Sets the options to the given values in the array. * * @param options The options to be set. */ public void setOptions(String[] options) throws Exception { setSize(OptionUtils.parse(options, "size", getDefaultSize())); setThreshold(OptionUtils.parse(options, "threshold", getDefaultThreshold())); super.setOptions(options); }
@Override public String toString() { return getModel(); }
/** * Returns the global information of the classifier. * * @return Global information of the classfier */ public String globalInfo() { return "MLC-BMaD - Multi-Label Classification using Boolean Matrix Decomposition. Transforms " + "the labels using a Boolean matrix decomposition, the first resulting matrix are " + "used as latent labels and a classifier is trained to predict them. The second matrix is " + "used in a multiplication to decompress the predicted latent labels.\n" + "For more information see:\n" + getTechnicalInformation(); }
/** * Returns an enumeration of the options. * * @return Enumeration of the options. */ public Enumeration listOptions() { Vector newVector = new Vector(); OptionUtils.addOption(newVector, sizeTipText(), ""+getDefaultSize(), "size"); OptionUtils.addOption(newVector, thresholdTipText(), ""+getDefaultThreshold(), "threshold"); OptionUtils.add(newVector, super.listOptions()); return OptionUtils.toEnumeration(newVector); }
/** * Returns an array with the options of the classifier. * * @return Array of options. */ public String[] getOptions(){ List<String> result = new ArrayList<>(); OptionUtils.add(result, "size", getSize()); OptionUtils.add(result, "threshold", getThreshold()); OptionUtils.add(result, super.getOptions()); return OptionUtils.toArray(result); }
@Override public Instances transformLabels(Instances D) throws Exception{ Instances features = this.extractPart(D, false); Instances labels = this.extractPart(D, true); BooleanMatrixDecomposition bmd = BooleanMatrixDecomposition.BEST_CONFIGURED(this.threshold); Tuple<Instances, Instances> res = bmd.decompose(labels, this.size); this.compressedMatrix = res._1; this.uppermatrix = res._2; Instances result= Instances.mergeInstances(compressedMatrix, features); result.setClassIndex(this.getSize()); return result; }
/** * Main method for testing. * @param args - Arguments passed from the command line **/ public static void main(String[] args) throws Exception{ AbstractMultiLabelClassifier.evaluation(new MLCBMaD(), args); } }
@Override public Instance transformInstance(Instance x) throws Exception{ Instances tmpInst = new Instances(x.dataset()); tmpInst.delete(); tmpInst.add(x); Instances features = this.extractPart(tmpInst, false); Instances pseudoLabels = new Instances(this.compressedMatrix); Instance tmpin = pseudoLabels.instance(0); pseudoLabels.delete(); pseudoLabels.add(tmpin); for ( int i = 0; i< pseudoLabels.classIndex(); i++) { pseudoLabels.instance(0).setMissing(i); } Instances newDataSet = Instances.mergeInstances(pseudoLabels, features); newDataSet.setClassIndex(this.size); return newDataSet.instance(0); }
/** * Returns an enumeration of the options. * * @return Enumeration of the options. */ public Enumeration listOptions() { Vector newVector = new Vector(); OptionUtils.addOption(newVector, sizeTipText(), ""+getDefaultSize(), "size"); OptionUtils.addOption(newVector, thresholdTipText(), ""+getDefaultThreshold(), "threshold"); OptionUtils.add(newVector, super.listOptions()); return OptionUtils.toEnumeration(newVector); }
/** * Returns an array with the options of the classifier. * * @return Array of options. */ public String[] getOptions(){ List<String> result = new ArrayList<>(); OptionUtils.add(result, "size", getSize()); OptionUtils.add(result, "threshold", getThreshold()); OptionUtils.add(result, super.getOptions()); return OptionUtils.toArray(result); }
@Override public Instances transformLabels(Instances D) throws Exception{ Instances features = this.extractPart(D, false); Instances labels = this.extractPart(D, true); BooleanMatrixDecomposition bmd = BooleanMatrixDecomposition.BEST_CONFIGURED(this.threshold); Tuple<Instances, Instances> res = bmd.decompose(labels, this.size); this.compressedMatrix = res._1; this.uppermatrix = res._2; Instances result= Instances.mergeInstances(compressedMatrix, features); result.setClassIndex(this.getSize()); return result; }
/** * Main method for testing. * @param args - Arguments passed from the command line **/ public static void main(String[] args) throws Exception{ AbstractMultiLabelClassifier.evaluation(new MLCBMaD(), args); } }
@Override public Instance transformInstance(Instance x) throws Exception{ Instances tmpInst = new Instances(x.dataset()); tmpInst.delete(); tmpInst.add(x); Instances features = this.extractPart(tmpInst, false); Instances pseudoLabels = new Instances(this.compressedMatrix); Instance tmpin = pseudoLabels.instance(0); pseudoLabels.delete(); pseudoLabels.add(tmpin); for ( int i = 0; i< pseudoLabels.classIndex(); i++) { pseudoLabels.instance(0).setMissing(i); } Instances newDataSet = Instances.mergeInstances(pseudoLabels, features); newDataSet.setClassIndex(this.size); return newDataSet.instance(0); }
/** * Sets the options to the given values in the array. * * @param options The options to be set. */ public void setOptions(String[] options) throws Exception { setSize(OptionUtils.parse(options, "size", getDefaultSize())); setThreshold(OptionUtils.parse(options, "threshold", getDefaultThreshold())); super.setOptions(options); }
@Override public String toString() { return getModel(); }
/** * Returns the global information of the classifier. * * @return Global information of the classfier */ public String globalInfo() { return "MLC-BMaD - Multi-Label Classification using Boolean Matrix Decomposition. Transforms " + "the labels using a Boolean matrix decomposition, the first resulting matrix are " + "used as latent labels and a classifier is trained to predict them. The second matrix is " + "used in a multiplication to decompress the predicted latent labels.\n" + "For more information see:\n" + getTechnicalInformation(); }