/** * Returns default capabilities of the classifier. * * @return the capabilities of this classifier */ public Capabilities getCapabilities() { Capabilities result = super.getCapabilities(); result.setMinimumNumberInstances(m_NumFolds); return result; }
public Capabilities getCapabilities() { Capabilities result = super.getCapabilities(); result.enableAllAttributes(); result.enableAllClasses(); // filter doesn't need class to be set result.enable(Capability.NO_CLASS); return result; }
/** * Creates and returns a copy of this object. * * @return a clone of this object */ public Object clone() { Capabilities result; result = new Capabilities(m_Owner); result.assign(this); return result; }
/** * Returns the Capabilities of this kernel. * * @return the capabilities of this object * @see Capabilities */ public Capabilities getCapabilities() { Capabilities result = super.getCapabilities(); result.enable(Capability.NUMERIC_ATTRIBUTES); result.enableAllClasses(); result.enable(Capability.MISSING_CLASS_VALUES); return result; }
/** * Returns the Capabilities of this clusterer. Derived clusterers have to override this method to * enable capabilities. * * @return the capabilities of this object * @see Capabilities */ @Override public Capabilities getCapabilities() { Capabilities result; result = new Capabilities(this); result.enableAll(); return result; }
/** * Returns default capabilities of the clusterer. * * @return the capabilities of this clusterer */ @Override public Capabilities getCapabilities() { Capabilities result = super.getCapabilities(); result.disableAll(); result.enable(Capability.NO_CLASS); // attributes result.enable(Capability.NUMERIC_ATTRIBUTES); return result; }
/** * Returns the Capabilities of this filter. Derived filters have to override this method to enable * capabilities. * * @return the capabilities of this object * @see Capabilities */ public Capabilities getCapabilities() { Capabilities result; result = new Capabilities(this); result.enableAll(); result.setMinimumNumberInstances(0); return result; }
/** * Returns default capabilities of the classifier. * * @return the capabilities of this classifier */ public Capabilities getCapabilities() { Capabilities result = super.getCapabilities(); // class result.disableAllClasses(); result.disableAllClassDependencies(); result.enable(Capability.NOMINAL_CLASS); return result; }
/** * Returns default capabilities of the classifier. * * @return the capabilities of this classifier */ public Capabilities getCapabilities() { Capabilities result = super.getCapabilities(); // attributes result.enable(Capability.NOMINAL_ATTRIBUTES); // class result.enable(Capability.NOMINAL_CLASS); return result; }
/** * Returns default capabilities of the classifier. * * @return the capabilities of this classifier */ public Capabilities getCapabilities() { Capabilities result = super.getCapabilities(); // class result.disableAllClasses(); result.disableAllClassDependencies(); if (super.getCapabilities().handles(Capability.BINARY_CLASS)) result.enable(Capability.BINARY_CLASS); return result; }
/** * Returns the Capabilities of this classifier. Maximally permissive capabilities are allowed by * default. Derived classifiers should override this method and first disable all capabilities and * then enable just those capabilities that make sense for the scheme. * * @return the capabilities of this object * @see Capabilities */ @Override public Capabilities getCapabilities() { Capabilities result = new Capabilities(this); result.enableAll(); // Do we want to effectively turn off the testWithFail // method in Capabilities to save runtime in buildClassifier()? result.setTestWithFailAlwaysSucceeds(getDoNotCheckCapabilities()); return result; }
/** * retrieves the data from the given Capabilities object * * @param c the capabilities object to initialize with */ public void assign(Capabilities c) { for (Capability cap : Capability.values()) { // capability if (c.handles(cap)) enable(cap); else disable(cap); // dependency if (c.hasDependency(cap)) enableDependency(cap); else disableDependency(cap); } setMinimumNumberInstances(c.getMinimumNumberInstances()); }
/** * Returns default capabilities of the classifier. * * @return the capabilities of this classifier */ public Capabilities getCapabilities() { Capabilities result = super.getCapabilities(); result.disableAll(); // attributes result.enable(Capability.NUMERIC_ATTRIBUTES); // class result.enable(Capability.NOMINAL_CLASS); result.enable(Capability.MISSING_CLASS_VALUES); return result; }
/** * performs an OR conjunction with the capabilities of the given Capabilities object and updates * itself * * @param c the capabilities to OR with */ public void or(Capabilities c) { for (Capability cap : Capability.values()) { // capability if (handles(cap) || c.handles(cap)) m_Capabilities.add(cap); else m_Capabilities.remove(cap); // dependency if (hasDependency(cap) || c.hasDependency(cap)) m_Dependencies.add(cap); else m_Dependencies.remove(cap); } if (c.getMinimumNumberInstances() < getMinimumNumberInstances()) setMinimumNumberInstances(c.getMinimumNumberInstances()); }
/** * Returns default capabilities of the classifier. * * @return the capabilities of this classifier */ public Capabilities getCapabilities() { Capabilities result = new Capabilities(this); // attributes result.enable(Capability.NOMINAL_ATTRIBUTES); result.enable(Capability.NUMERIC_ATTRIBUTES); result.enable(Capability.DATE_ATTRIBUTES); result.enable(Capability.MISSING_VALUES); // class result.enable(Capability.BINARY_CLASS); return result; }
/** * Returns the Capabilities of this filter, customized based on the data. I.e., if removes all * class capabilities, in case there's not class attribute present or removes the NO_CLASS * capability, in case that there's a class present. * * @param data the data to use for customization * @return the capabilities of this object, based on the data * @see #getCapabilities() */ public Capabilities getCapabilities(Instances data) { Capabilities result; Capabilities classes; Iterator iter; Capability cap; result = getCapabilities(); // no class? -> remove all class capabilites apart from NO_CLASS if (data.classIndex() == -1) { classes = result.getClassCapabilities(); iter = classes.capabilities(); while (iter.hasNext()) { cap = (Capability) iter.next(); if (cap != Capability.NO_CLASS) { result.disable(cap); result.disableDependency(cap); } } } // class? -> remove NO_CLASS else { result.disable(Capability.NO_CLASS); result.disableDependency(Capability.NO_CLASS); } return result; }
/** * performs an AND conjunction with the capabilities of the given Capabilities object and updates * itself * * @param c the capabilities to AND with */ public void and(Capabilities c) { for (Capability cap : Capability.values()) { // capability if (handles(cap) && c.handles(cap)) m_Capabilities.add(cap); else m_Capabilities.remove(cap); // dependency if (hasDependency(cap) && c.hasDependency(cap)) m_Dependencies.add(cap); else m_Dependencies.remove(cap); } // minimum number of instances that both handlers need at least to work if (c.getMinimumNumberInstances() > getMinimumNumberInstances()) setMinimumNumberInstances(c.getMinimumNumberInstances()); }
/** * Returns the Capabilities of this filter. * * @return the capabilities of this object * @see Capabilities */ @Override public Capabilities getCapabilities() { Capabilities result = super.getCapabilities(); result.disableAll(); // attributes result.enableAllAttributes(); result.enable(Capability.MISSING_VALUES); // class result.enable(Capability.NOMINAL_CLASS); return result; }
/** * Returns the Capabilities of this filter. * * @return the capabilities of this object * @see Capabilities */ @Override public Capabilities getCapabilities() { Capabilities result; if (getClassifier() == null) { result = super.getCapabilities(); result.disableAll(); } else { result = getClassifier().getCapabilities(); } result.setMinimumNumberInstances(0); return result; }
/** * Returns default capabilities of the classifier. * * @return the capabilities of this classifier */ public Capabilities getCapabilities() { Capabilities result; if (m_GroovyObject == null) { result = new Capabilities(this); result.disableAll(); } else { result = m_GroovyObject.getCapabilities(); } result.enableAllAttributeDependencies(); result.enableAllClassDependencies(); return result; }
/** * Returns default capabilities of the classifier. * * @return the capabilities of this classifier */ public Capabilities getCapabilities() { Capabilities result; if (m_Classifier != null) { result = m_Classifier.getCapabilities(); } else { result = super.getCapabilities(); } result.setMinimumNumberInstances(0); // set dependencies for (Capability cap : Capability.values()) result.enableDependency(cap); return result; }
/** * Returns default capabilities of the associator. * * @return the capabilities of this associator */ public Capabilities getCapabilities() { Capabilities result; if (getFilter() == null) { result = super.getCapabilities(); result.disableAll(); } else { result = getFilter().getCapabilities(); } result.enable(Capability.NO_CLASS); // set dependencies for (Capability cap : Capability.values()) result.enableDependency(cap); return result; }
public Capabilities getCapabilities() { Capabilities result = super.getCapabilities(); result.disableAll(); // attributes result.enable(Capability.NOMINAL_ATTRIBUTES); result.enable(Capability.NUMERIC_ATTRIBUTES); // class result.enable(Capability.NOMINAL_CLASS); result.enable(Capability.NUMERIC_CLASS); // instances result.setMinimumNumberInstances(1); return result; }
/** * loads the given dataset and prints the Capabilities necessary to process it. * * <p>Valid parameters: * * <p>-file filename <br> * the file to load * * <p>-c index the explicit index of the class attribute (default: none) * * @param args the commandline arguments * @throws Exception if something goes wrong */ public static void main(String[] args) throws Exception { String tmpStr; String filename; DataSource source; Instances data; int classIndex; Capabilities cap; Iterator iter; if (args.length == 0) { System.out.println( "\nUsage: " + Capabilities.class.getName() + " -file <dataset> [-c <class index>]\n"); return; } // get parameters tmpStr = Utils.getOption("file", args); if (tmpStr.length() == 0) throw new Exception("No file provided with option '-file'!"); else filename = tmpStr; tmpStr = Utils.getOption("c", args); if (tmpStr.length() != 0) { if (tmpStr.equals("first")) classIndex = 0; else if (tmpStr.equals("last")) classIndex = -2; // last else classIndex = Integer.parseInt(tmpStr) - 1; } else { classIndex = -3; // not set } // load data source = new DataSource(filename); if (classIndex == -3) data = source.getDataSet(); else if (classIndex == -2) data = source.getDataSet(source.getStructure().numAttributes() - 1); else data = source.getDataSet(classIndex); // determine and print capabilities cap = forInstances(data); System.out.println("File: " + filename); System.out.println( "Class index: " + ((data.classIndex() == -1) ? "not set" : "" + (data.classIndex() + 1))); System.out.println("Capabilities:"); iter = cap.capabilities(); while (iter.hasNext()) System.out.println("- " + iter.next()); }
/** * 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; }
/** * Returns default capabilities of the classifier. * * @return the capabilities of this classifier */ @Override public Capabilities getCapabilities() { Capabilities result = super.getCapabilities(); result.disableAll(); // attributes result.enable(Capability.STRING_ATTRIBUTES); result.enable(Capability.NOMINAL_ATTRIBUTES); result.enable(Capability.DATE_ATTRIBUTES); result.enable(Capability.NUMERIC_ATTRIBUTES); result.enable(Capability.MISSING_VALUES); result.enable(Capability.MISSING_CLASS_VALUES); result.enable(Capability.NOMINAL_CLASS); // instances result.setMinimumNumberInstances(0); return result; }
/** * 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; }
/** * Returns true if the currently set capabilities support at least all of the capabiliites of the * given Capabilities object (checks only the enum!) * * @param c the capabilities to support at least * @return true if all the requested capabilities are supported */ public boolean supports(Capabilities c) { boolean result; result = true; for (Capability cap : Capability.values()) { if (c.handles(cap) && !handles(cap)) { result = false; break; } } return result; }
/** * Returns true if the currently set capabilities support (or have a dependency) at least all of * the capabilities of the given Capabilities object (checks only the enum!) * * @param c the capabilities (or dependencies) to support at least * @return true if all the requested capabilities are supported (or at least have a dependency) */ public boolean supportsMaybe(Capabilities c) { boolean result; result = true; for (Capability cap : Capability.values()) { if (c.handles(cap) && !(handles(cap) || hasDependency(cap))) { result = false; break; } } return result; }
/** * Returns default capabilities of the classifier. * * @return the capabilities of this classifier */ public Capabilities getCapabilities() { Capabilities result = super.getCapabilities(); result.disableAll(); // attributes result.enable(Capability.NOMINAL_ATTRIBUTES); result.enable(Capability.NUMERIC_ATTRIBUTES); result.enable(Capability.DATE_ATTRIBUTES); result.enable(Capability.MISSING_VALUES); // class result.enable(Capability.NOMINAL_CLASS); if (m_evaluationMeasure != EVAL_ACCURACY && m_evaluationMeasure != EVAL_AUC) { result.enable(Capability.NUMERIC_CLASS); result.enable(Capability.DATE_CLASS); } result.enable(Capability.MISSING_CLASS_VALUES); return result; }