/**
   * internal function for determining the class distribution for an instance, will be overridden by
   * derived classes. <br>
   * Here we just retrieve the class value for the given instance that was calculated during
   * building our classifier. It just returns "1" for the class that was predicted, no real
   * distribution. Note: the ReplaceMissingValues filter is applied to a copy of the given instance.
   *
   * @param instance the instance to get the distribution for
   * @return the distribution for the given instance
   * @see Classifier#distributionForInstance(Instance)
   * @see ReplaceMissingValues
   * @throws Exception if something goes wrong
   */
  protected double[] getDistribution(Instance instance) throws Exception {
    double[] result;
    int i;

    result = new double[instance.numClasses()];
    for (i = 0; i < result.length; i++) result[i] = 0.0;

    i = Arrays.binarySearch(m_LabeledTestset, instance, new InstanceComparator(false));
    if (i >= 0) {
      result[(int) m_LabeledTestset[i].classValue()] = 1.0;
    } else {
      CollectiveHelper.writeToTempFile("train.txt", m_TrainsetNew.toString());
      CollectiveHelper.writeToTempFile("test.txt", m_TestsetNew.toString());
      throw new Exception(
          "Cannot find test instance: "
              + instance
              + "\n -> pos="
              + i
              + " = "
              + m_LabeledTestset[StrictMath.abs(i)]);
    }

    return result;
  }
  /**
   * generates a filename with a certain suffix for the logQuality method
   *
   * @param suffix the suffix
   * @return the generated filename
   * @see #logQuality(int,int)
   */
  protected String createFilename(String suffix) {
    String result;

    result =
        this.getClass().getName()
            + "-"
            + CollectiveHelper.generateMD5(Utils.joinOptions(this.getOptions()))
            + "-"
            + (m_Trainset == null
                ? "null"
                : m_Trainset.relationName().replaceAll("-weka\\.filters\\..*", ""))
            + "-R"
            + getNumRestarts()
            + "-I"
            + getNumIterations()
            + "-E"
            + m_EvaluationType
            + "-C"
            + m_ComparisonType
            + suffix;

    return result;
  }
 /**
  * Returns the tip text for this property
  *
  * @return tip text for this property suitable for displaying in the explorer/experimenter gui
  */
 public String logTipText() {
   return "Whether to log internal data to the tmp directory ("
       + CollectiveHelper.getTempPath()
       + ").";
 }