/** * Returns the metric for the given tag. * * @param tag the tag to get the metric for * @param classLabel the class label index for which to return metric (if applicable) * @return the metric */ public double getMetric(Tag tag, int classLabel) { return getMetric(tag.getID(), classLabel); }
/** * Returns a description of the property value as java source. * * @return a value of type 'String' */ public String getJavaInitializationString() { SelectedTag s = (SelectedTag)getValue(); Tag [] tags = s.getTags(); String result = "new SelectedTag(" + s.getSelectedTag().getID() + ", {\n"; for (int i = 0; i < tags.length; i++) { result += "new Tag(" + tags[i].getID() + ",\"" + tags[i].getReadable() + "\")"; if (i < tags.length - 1) { result += ','; } result += '\n'; } return result + "})"; }
HashSet<String> IDStr = new HashSet<String>(); for (int i = 0; i < tags.length; i++) { Integer newID = new Integer(tags[i].getID()); if (!ID.contains(newID)) { ID.add(newID); throw new IllegalArgumentException("The IDs are not unique: " + newID + "!"); String IDstring = tags[i].getIDStr(); if (!IDStr.contains(IDstring)) { IDStr.add(IDstring); if (tags[i].getID() == tagID) { m_Selected = i; m_Tags = tags;
/** * returns a string that can be used in the listOption methods to list all * the available options, i.e., "\t\tID = Text\n" for each option * * @param tags the tags to create the string for * @return a string explaining the tags */ public static String toOptionSynopsis(Tag[] tags) { String result; int i; result = ""; for (i = 0; i < tags.length; i++) { result += "\t\t" + tags[i].getIDStr() + " = " + tags[i].getReadable() + "\n"; } return result; }
/** * Gets an enumeration describing the available options. * * @return an enumeration of all the available options. */ @Override public Enumeration<Option> listOptions() { Vector<Option> result; String desc; SelectedTag tag; int i; result = new Vector<Option>(); desc = ""; for (i = 0; i < TAGS_GUI.length; i++) { tag = new SelectedTag(TAGS_GUI[i].getID(), TAGS_GUI); desc += "\t" + tag.getSelectedTag().getIDStr() + " = " + tag.getSelectedTag().getReadable() + "\n"; } result.addElement(new Option("\tDetermines the layout of the GUI:\n" + desc + "\t(default: " + new SelectedTag(GUI_MDI, TAGS_GUI) + ")", "gui", 1, "-gui " + Tag.toOptionList(TAGS_GUI))); return result.elements(); }
public String[] getMetricNamesForRule() { String[] metricNames = new String[TAGS_SELECTION.length]; for (int i = 0; i < TAGS_SELECTION.length; i++) { metricNames[i] = TAGS_SELECTION[i].getReadable(); } return metricNames; }
/** * Gets the currently set performance evaluation measure used for selecting * attributes for the decision table * * @return the performance evaluation measure */ public SelectedTag getEvaluationMeasure() { return new SelectedTag(m_evaluationMeasure.getIDStr(), TAGS_EVALUATION); }
/** * Returns an enumeration describing the available options. * * @return an enumeration of all the available options. */ @Override public Enumeration<Option> listOptions() { Vector<Option> result = new Vector<Option>(); result.addElement(new Option( "\tFull path to serialized classifier to include.\n" + "\tMay be specified multiple times to include\n" + "\tmultiple serialized classifiers. Note: it does\n" + "\tnot make sense to use pre-built classifiers in\n" + "\ta cross-validation.", "P", 1, "-P <path to serialized " + "classifier>")); result.addElement(new Option("\tThe combination rule to use\n" + "\t(default: AVG)", "R", 1, "-R " + Tag.toOptionList(TAGS_RULES))); result.addElement(new Option( "\tSuppress the printing of the individual models in the output", "do-not-print", 0, "-do-not-print")); result.addAll(Collections.list(super.listOptions())); return result.elements(); }
/** * returns the selected tag in string representation * * @return the selected tag as string */ public String toString() { return getSelectedTag().toString(); }
/** * Gets an enumeration describing the available options. * * @return an enumeration of all the available options. */ @Override public Enumeration<Option> listOptions() { Vector<Option> result; String desc; SelectedTag tag; int i; result = new Vector<Option>(); desc = ""; for (i = 0; i < TAGS_GUI.length; i++) { tag = new SelectedTag(TAGS_GUI[i].getID(), TAGS_GUI); desc += "\t" + tag.getSelectedTag().getIDStr() + " = " + tag.getSelectedTag().getReadable() + "\n"; } result.addElement(new Option("\tDetermines the layout of the GUI:\n" + desc + "\t(default: " + new SelectedTag(GUI_MDI, TAGS_GUI) + ")", "gui", 1, "-gui " + Tag.toOptionList(TAGS_GUI))); return result.elements(); }
public String[] getMetricNamesForRule() { String[] metricNames = new String[TAGS_SELECTION.length]; for (int i = 0; i < TAGS_SELECTION.length; i++) { metricNames[i] = TAGS_SELECTION[i].getReadable(); } return metricNames; }
/** * returns a string that can be used in the listOption methods to list all * the available options, i.e., "\t\tID = Text\n" for each option * * @param tags the tags to create the string for * @return a string explaining the tags */ public static String toOptionSynopsis(Tag[] tags) { String result; int i; result = ""; for (i = 0; i < tags.length; i++) { result += "\t\t" + tags[i].getIDStr() + " = " + tags[i].getReadable() + "\n"; } return result; }
/** * Gets the currently set performance evaluation measure used for selecting * attributes for the decision table * * @return the performance evaluation measure */ public SelectedTag getEvaluationMeasure() { return new SelectedTag(m_evaluationMeasure.getIDStr(), TAGS_EVALUATION); }
/** * Returns an enumeration describing the available options. * * @return an enumeration of all the available options. */ @Override public Enumeration<Option> listOptions() { Vector<Option> result = new Vector<Option>(); result.addElement(new Option( "\tFull path to serialized classifier to include.\n" + "\tMay be specified multiple times to include\n" + "\tmultiple serialized classifiers. Note: it does\n" + "\tnot make sense to use pre-built classifiers in\n" + "\ta cross-validation.", "P", 1, "-P <path to serialized " + "classifier>")); result.addElement(new Option("\tThe combination rule to use\n" + "\t(default: AVG)", "R", 1, "-R " + Tag.toOptionList(TAGS_RULES))); result.addElement(new Option( "\tSuppress the printing of the individual models in the output", "do-not-print", 0, "-do-not-print")); result.addAll(Collections.list(super.listOptions())); return result.elements(); }
/** * returns the selected tag in string representation * * @return the selected tag as string */ public String toString() { return getSelectedTag().toString(); }
/** * Returns an enumeration describing the available options. * * @return an enumeration of all the available options. */ @Override public Enumeration<Option> listOptions() { Vector<Option> result = new Vector<Option>(); result.addElement(new Option( "\tSpecify list of attributes to process.\n" + "\t(default: select all nominal attributes)", "R", 1, "-R <index1,index2-index4,...>")); result.addElement(new Option( "\tInverts the matching sense of the selection.", "V", 0, "-V")); String desc = ""; for (Tag element : TAGS_SORTTYPE) { SelectedTag tag = new SelectedTag(element.getID(), TAGS_SORTTYPE); desc += "\t" + tag.getSelectedTag().getIDStr() + " = " + tag.getSelectedTag().getReadable() + "\n"; } result.addElement(new Option("\tDetermines the type of sorting:\n" + desc + "\t(default: " + new SelectedTag(SORT_CASESENSITIVE, TAGS_SORTTYPE) + ")", "S", 1, "-S " + Tag.toOptionList(TAGS_SORTTYPE))); result.addAll(Collections.list(super.listOptions())); return result.elements(); }
/** * Set the loss function to use. * * @param function the loss function to use. */ public void setLossFunction(SelectedTag function) { if (function.getTags() == TAGS_SELECTION) { m_loss = function.getSelectedTag().getID(); } }
/** * generates a table string for all the performances in the space and returns * that. * * @param space the current space to align the performances to * @param performances the performances to align * @param type the type of performance * @return the table string */ public String logPerformances(Space space, Vector<Performance> performances, Tag type) { StringBuffer result; int i; result = new StringBuffer(type.getReadable() + ":\n"); result.append(space.toString()); result.append("\n"); for (i = 0; i < performances.size(); i++) { result.append(performances.get(i).getPerformance(type.getID())); result.append("\n"); } result.append("\n"); return result.toString(); }