Пример #1
0
  /**
   * initializes the capabilities for the given owner
   *
   * @param owner the object that produced this Capabilities instance
   */
  public Capabilities(CapabilitiesHandler owner) {
    super();

    setOwner(owner);
    m_Capabilities = new HashSet<Capability>();
    m_Dependencies = new HashSet<Capability>();

    // load properties
    if (PROPERTIES == null) {
      try {
        PROPERTIES = Utils.readProperties(PROPERTIES_FILE);
      } catch (Exception e) {
        e.printStackTrace();
        PROPERTIES = new Properties();
      }
    }

    m_Test = Boolean.parseBoolean(PROPERTIES.getProperty("Test", "true"));
    m_InstancesTest =
        Boolean.parseBoolean(PROPERTIES.getProperty("InstancesTest", "true")) && m_Test;
    m_AttributeTest =
        Boolean.parseBoolean(PROPERTIES.getProperty("AttributeTest", "true")) && m_Test;
    m_MissingValuesTest =
        Boolean.parseBoolean(PROPERTIES.getProperty("MissingValuesTest", "true")) && m_Test;
    m_MissingClassValuesTest =
        Boolean.parseBoolean(PROPERTIES.getProperty("MissingClassValuesTest", "true")) && m_Test;
    m_MinimumNumberInstancesTest =
        Boolean.parseBoolean(PROPERTIES.getProperty("MinimumNumberInstancesTest", "true"))
            && m_Test;
  }
  /**
   * Returns combined capabilities of the base classifiers, i.e., the capabilities all of them have
   * in common.
   *
   * @return the capabilities of the base classifiers
   */
  public Capabilities getCapabilities() {
    Capabilities result;
    int i;

    if (getClassifiers().length == 0) {
      result = new Capabilities(this);
      result.disableAll();
    } else {
      result = (Capabilities) getClassifier(0).getCapabilities().clone();
      for (i = 1; i < getClassifiers().length; i++) result.and(getClassifier(i).getCapabilities());
    }

    // set dependencies
    for (Capability cap : Capability.values()) result.enableDependency(cap);

    result.setOwner(this);

    return result;
  }
Пример #3
0
  /**
   * Returns default capabilities of the classifier.
   *
   * @return the capabilities of this classifier
   */
  public Capabilities getCapabilities() {
    Capabilities result = getKernel().getCapabilities();
    result.setOwner(this);

    // attribute
    result.enableAllAttributeDependencies();
    // with NominalToBinary we can also handle nominal attributes, but only
    // if the kernel can handle numeric attributes
    if (result.handles(Capability.NUMERIC_ATTRIBUTES)) result.enable(Capability.NOMINAL_ATTRIBUTES);
    result.enable(Capability.MISSING_VALUES);

    // class
    result.disableAllClasses();
    result.disableAllClassDependencies();
    result.disable(Capability.NO_CLASS);
    result.enable(Capability.NUMERIC_CLASS);
    result.enable(Capability.DATE_CLASS);
    result.enable(Capability.MISSING_CLASS_VALUES);

    return result;
  }
Пример #4
0
  /**
   * Returns default capabilities of the classifier.
   *
   * @return the capabilities of this classifier
   */
  public Capabilities getCapabilities() {
    Capabilities result;

    try {
      if (!m_reducedErrorPruning)
        result =
            new C45PruneableClassifierTree(
                    null, !m_unpruned, m_CF, m_subtreeRaising, !m_noCleanup, m_collapseTree)
                .getCapabilities();
      else
        result =
            new PruneableClassifierTree(null, !m_unpruned, m_numFolds, !m_noCleanup, m_Seed)
                .getCapabilities();
    } catch (Exception e) {
      result = new Capabilities(this);
      result.disableAll();
    }

    result.setOwner(this);

    return result;
  }