/** * Returns the commandline string for the object. * * @param obj the object to generate the commandline for * @return the commandline * @see Utils#toCommandLine(Object) */ public static String toCommandLine(Object obj) { return Utils.toCommandLine(obj); }
/** * Returns the commandline string for the object. * * @param obj the object to generate the commandline for * @return the commandline * @see Utils#toCommandLine(Object) */ public static String toCommandLine(Object obj) { return Utils.toCommandLine(obj); }
/** * Returns the container setup as string. * * @return the string */ @Override public String toString() { if (m_Handler != null) return m_File.getAbsolutePath() + "\t" + Utils.toCommandLine(m_Handler); else return m_File.getAbsolutePath() + "\t"; }
/** * Adds the OptionHandler to the options. * * @param options the current list of options to extend * @param option the option (without the leading dash) * @param value the current value */ public static void add(List<String> options, String option, OptionHandler value) { options.add("-" + option); options.add("" + Utils.toCommandLine(value)); }
/** * Adds the OptionHandler to the options. * * @param options the current list of options to extend * @param option the option (without the leading dash) * @param value the current value */ public static void add(List<String> options, String option, OptionHandler value) { options.add("-" + option); options.add("" + Utils.toCommandLine(value)); }
/** * Returns the container setup as string. * * @return the string */ @Override public String toString() { if (m_Handler != null) return m_File.getAbsolutePath() + "\t" + Utils.toCommandLine(m_Handler); else return m_File.getAbsolutePath() + "\t"; }
/** * Returns the statistics as string. * * @return the statistics */ public String toString() { StringBuilder result = new StringBuilder(); result.append("Classifier=").append(Utils.toCommandLine(m_Classifier)).append(","); result.append("Relation=").append(m_Relation).append(","); result.append(super.toString()); return result.toString(); } }
/** * Returns the statistics as string. * * @return the statistics */ public String toString() { StringBuilder result = new StringBuilder(); result.append("Classifier=").append(Utils.toCommandLine(m_Classifier)).append(","); result.append("Relation=").append(m_Relation).append(","); result.append(super.toString()); return result.toString(); } }
/** * Gets the current settings of the Classifier. * * @return an array of strings suitable for passing to setOptions */ @Override public String[] getOptions() { List<String> options = new ArrayList<String>(Arrays.asList(super.getOptions())); for (StopwordsHandler handler: m_Stopwords) { options.add("-stopwords"); options.add(Utils.toCommandLine(handler)); } return options.toArray(new String[options.size()]); }
/** * Gets the current settings of the Classifier. * * @return an array of strings suitable for passing to setOptions */ @Override public String[] getOptions() { List<String> options = new ArrayList<String>(Arrays.asList(super.getOptions())); for (StopwordsHandler handler: m_Stopwords) { options.add("-stopwords"); options.add(Utils.toCommandLine(handler)); } return options.toArray(new String[options.size()]); }
/** * Returns a string description of the model. * * @return the model */ public String toString() { StringBuilder result; result = new StringBuilder(); result.append(getClass().getSimpleName()).append("\n"); result.append(getClass().getSimpleName().replaceAll(".", "=")).append("\n\n"); result.append("Force resample with weights: " + getForceResampleWithWeights() + "\n"); result.append("Base classifier:\n"); result.append("- command-line: " + Utils.toCommandLine(m_Classifier) + "\n"); result.append("- handles instance weights: " + (m_Classifier instanceof WeightedInstancesHandler) + "\n\n"); result.append(m_Classifier.toString()); return result.toString(); }
/** * Returns a string description of the model. * * @return the model */ public String toString() { StringBuilder result; result = new StringBuilder(); result.append(getClass().getSimpleName()).append("\n"); result.append(getClass().getSimpleName().replaceAll(".", "=")).append("\n\n"); result.append("Force resample with weights: " + getForceResampleWithWeights() + "\n"); result.append("Base classifier:\n"); result.append("- command-line: " + Utils.toCommandLine(m_Classifier) + "\n"); result.append("- handles instance weights: " + (m_Classifier instanceof WeightedInstancesHandler) + "\n\n"); result.append(m_Classifier.toString()); return result.toString(); }
@Override public void actionPerformed(ActionEvent e) { String cmdline = Utils.toCommandLine(getClassifier(history, index)); GUIHelper.copyToClipboard(cmdline); } };
@Override public void actionPerformed(ActionEvent e) { String cmdline = Utils.toCommandLine(getClassifier(history, index)); GUIHelper.copyToClipboard(cmdline); } };
/** * Retrieves the statis for the specified combination of classifier and dataset. * * @param classifier the classifier to check * @param dataset the dataset to check * @return the stats, null if not available */ public List<EvaluationStatistics> retrieve(MultiLabelClassifier classifier, Instances dataset) { List<EvaluationStatistics> result; String cls; String rel; result = new ArrayList<>(); cls = Utils.toCommandLine(classifier); rel = dataset.relationName(); for (EvaluationStatistics stat: m_Statistics) { if (stat.getCommandLine().equals(cls) && stat.getRelation().equals(rel)) result.add(stat); } return result; }
@Override public void nextIteration(IterationNotificationEvent e) { System.err.println("[ITERATION] " + Utils.toCommandLine(e.getClassifier()) + " --> " + e.getDataset().relationName()); } });
/** * Retrieves the statis for the specified combination of classifier and dataset. * * @param classifier the classifier to check * @param dataset the dataset to check * @return the stats, null if not available */ public List<EvaluationStatistics> retrieve(MultiLabelClassifier classifier, Instances dataset) { List<EvaluationStatistics> result; String cls; String rel; result = new ArrayList<>(); cls = Utils.toCommandLine(classifier); rel = dataset.relationName(); for (EvaluationStatistics stat: m_Statistics) { if (stat.getCommandLine().equals(cls) && stat.getRelation().equals(rel)) result.add(stat); } return result; }
/** * Checks whether the specified combination of classifier and dataset is required for evaluation * or already present from previous evaluation. * * @param classifier the classifier to check * @param dataset the dataset to check * @return true if it needs evaluating */ public boolean requires(MultiLabelClassifier classifier, Instances dataset) { boolean result; String cls; String rel; result = true; cls = Utils.toCommandLine(classifier); rel = dataset.relationName(); for (EvaluationStatistics stat: m_Statistics) { if (stat.getCommandLine().equals(cls) && stat.getRelation().equals(rel)) { result = false; break; } } return result; } /**
protected List<EvaluationStatistics> doCall() throws Exception { List<EvaluationStatistics> result = new ArrayList<>(); log("Executing fold #" + index + "..."); try { Result res = Evaluation.evaluateModel(current, train, test, m_Threshold, m_Verbosity); EvaluationStatistics stats = new EvaluationStatistics(classifier, dataset, res); stats.put(KEY_FOLD, index); result.add(stats); } catch (Exception e) { handleException( "Failed to evaluate dataset '" + dataset.relationName() + "' with classifier: " + Utils.toCommandLine(classifier), e); } log("...finished fold #" + index); return result; } };
protected List<EvaluationStatistics> doCall() throws Exception { List<EvaluationStatistics> result = new ArrayList<>(); log("Executing fold #" + index + "..."); try { Result res = Evaluation.evaluateModel(current, train, test, m_Threshold, m_Verbosity); EvaluationStatistics stats = new EvaluationStatistics(classifier, dataset, res); stats.put(KEY_FOLD, index); result.add(stats); } catch (Exception e) { handleException( "Failed to evaluate dataset '" + dataset.relationName() + "' with classifier: " + Utils.toCommandLine(classifier), e); } log("...finished fold #" + index); return result; } };