Java Code Examples for weka.core.Capabilities#handles()

The following examples show how to use weka.core.Capabilities#handles() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GaussianProcesses.java    From tsml with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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.enable(Capability.NUMERIC_CLASS);
  result.enable(Capability.DATE_CLASS);
  result.enable(Capability.MISSING_CLASS_VALUES);

  return result;
}
 
Example 2
Source File: SMOreg.java    From tsml with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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.enable(Capability.NUMERIC_CLASS);
  result.enable(Capability.DATE_CLASS);
  result.enable(Capability.MISSING_CLASS_VALUES);
  
  return result;
}
 
Example 3
Source File: SMO.java    From tsml with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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.enable(Capability.NOMINAL_CLASS);
  result.enable(Capability.MISSING_CLASS_VALUES);
  
  return result;
}
 
Example 4
Source File: YATSI.java    From collective-classification-weka-package with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns default capabilities of the classifier.
 *
 * @return      the capabilities of this classifier
 */
@Override
public Capabilities getCapabilities() {
  Capabilities result = super.getCapabilities();

  // class
  result.disableAllClasses();
  result.disableAllClassDependencies();
  Capabilities cls = getClassifier().getCapabilities();
  if (cls.handles(Capability.NOMINAL_CLASS))
    result.enable(Capability.NOMINAL_CLASS);
  else if (cls.handles(Capability.BINARY_CLASS))
    result.enable(Capability.BINARY_CLASS);
  else if (cls.handles(Capability.UNARY_CLASS))
    result.enable(Capability.UNARY_CLASS);
  result.disable(Capability.MISSING_CLASS_VALUES);
  
  return result;
}
 
Example 5
Source File: RacedIncrementalLogitBoost.java    From tsml with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Set the base learner.
 *
 * @param newClassifier 		the classifier to use.
 * @throws IllegalArgumentException 	if base classifier cannot handle numeric 
 * 					class
 */
public void setClassifier(Classifier newClassifier) {
  Capabilities cap = newClassifier.getCapabilities();
  
  if (!cap.handles(Capability.NUMERIC_CLASS))
    throw new IllegalArgumentException("Base classifier cannot handle numeric class!");
    
  super.setClassifier(newClassifier);
}
 
Example 6
Source File: MISMO.java    From tsml with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns the capabilities of this multi-instance classifier for the
 * relational data.
 *
 * @return            the capabilities of this object
 * @see               Capabilities
 */
public Capabilities getMultiInstanceCapabilities() {
  Capabilities result = ((MultiInstanceCapabilitiesHandler) getKernel()).getMultiInstanceCapabilities();
  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);
  
  return result;
}