All Downloads are FREE. Search and download functionalities are using the official Maven repository.

weka.core.FindWithCapabilities Maven / Gradle / Ivy

Go to download

The Waikato Environment for Knowledge Analysis (WEKA), a machine learning workbench. This is the stable version. Apart from bugfixes, this version does not receive any other updates.

There is a newer version: 3.8.6
Show newest version
/*
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see .
 */

/*
 * FindWithCapabilities.java
 * Copyright (C) 2006-2012 University of Waikato, Hamilton, New Zealand
 */

package weka.core;

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.Vector;

import weka.core.Capabilities.Capability;
import weka.gui.GenericPropertiesCreator;

/**
 * Locates all classes with certain capabilities. One should keep in mind, that
 * works only with the default capabilities of a scheme and doesn't take
 * dependencies into account. E.g., a meta-classifier that could have a base
 * classifier handling numeric classes, but by default uses one with a nominal
 * class, will never show up in a search for schemes that handle numeric
 * classes.
 * 

* * Valid options are: *

* *

 * All class and attribute options can be prefixed with 'not',
 * e.g., '-not-numeric-class'. This makes sure that the returned
 * schemes 'cannot' handle numeric classes.
 * 
* *
 * -num-instances <num>
 *  The minimum number of instances (default 1).
 * 
* *
 * -unary-class
 *  Must handle unray classes.
 * 
* *
 * -binary-class
 *  Must handle binary classes.
 * 
* *
 * -nominal-class
 *  Must handle nominal classes.
 * 
* *
 * -numeric-class
 *  Must handle numeric classes.
 * 
* *
 * -string-class
 *  Must handle string classes.
 * 
* *
 * -date-class
 *  Must handle date classes.
 * 
* *
 * -relational-class
 *  Must handle relational classes.
 * 
* *
 * -missing-class-values
 *  Must handle missing class values.
 * 
* *
 * -no-class
 *  Doesn't need a class.
 * 
* *
 * -unary-atts
 *  Must handle unary attributes.
 * 
* *
 * -binary-atts
 *  Must handle binary attributes.
 * 
* *
 * -nominal-atts
 *  Must handle nominal attributes.
 * 
* *
 * -numeric-atts
 *  Must handle numeric attributes.
 * 
* *
 * -string-atts
 *  Must handle string attributes.
 * 
* *
 * -date-atts
 *  Must handle date attributes.
 * 
* *
 * -relational-atts
 *  Must handle relational attributes.
 * 
* *
 * -missing-att-values
 *  Must handle missing attribute values.
 * 
* *
 * -only-multiinstance
 *  Must handle multi-instance data.
 * 
* *
 * -W <classname>
 *  The Capabilities handler to base the handling on.
 *  The other parameters can be used to override the ones
 *  determined from the handler. Additional parameters for
 *  handler can be passed on after the '--'.
 *  Either '-W' or '-t' can be used.
 * 
* *
 * -t <file>
 *  The dataset to base the capabilities on.
 *  The other parameters can be used to override the ones
 *  determined from the handler.
 *  Either '-t' or '-W' can be used.
 * 
* *
 * -c <num>
 *  The index of the class attribute, -1 for none.
 *  'first' and 'last' are also valid.
 *  Only in conjunction with option '-t'.
 * 
* *
 * -superclass
 *  Superclass to look for in the packages.
 * 
* *
 * -packages
 *  Comma-separated list of packages to search in.
 * 
* *
 * -generic
 *  Retrieves the package list from the GenericPropertiesCreator
 *  for the given superclass. (overrides -packages <list>).
 * 
* *
 * -misses
 *  Also prints the classname that didn't match the criteria.
 * 
* * * * @author fracpete (fracpete at waikato dot ac dot nz) * @version $Revision: 11004 $ * @see Capabilities * @see Capabilities.Capability * @see GenericPropertiesCreator */ public class FindWithCapabilities implements OptionHandler, CapabilitiesHandler, RevisionHandler { /** the capabilities to look for. */ protected Capabilities m_Capabilities = new Capabilities(this); /** the capabilities to look for to "not have". */ protected Capabilities m_NotCapabilities = new Capabilities(this); /** the packages to search in. */ protected Vector m_Packages = new Vector(); /** a capabilities handler to retrieve the capabilities from. */ protected CapabilitiesHandler m_Handler = null; /** a file the capabilities can be based on. */ protected String m_Filename = ""; /** the class index, in case the capabilities are based on a file. */ protected SingleIndex m_ClassIndex = new SingleIndex(); /** * the superclass from the GenericPropertiesCreator to retrieve the packages * from. */ protected String m_Superclass = ""; /** whether to use the GenericPropertiesCreator with the superclass. */ protected boolean m_GenericPropertiesCreator = false; /** the classes that matched. */ protected Vector m_Matches = new Vector(); /** the class that didn't match. */ protected Vector m_Misses = new Vector(); /** Whether capabilities should not be checked */ protected boolean m_DoNotCheckCapabilities = false; /** * Set whether not to check capabilities. * * @param doNotCheckCapabilities true if capabilities are not to be checked. */ public void setDoNotCheckCapabilities(boolean doNotCheckCapabilities) { m_DoNotCheckCapabilities = doNotCheckCapabilities; } /** * Get whether capabilities checking is turned off. * * @return true if capabilities checking is turned off. */ public boolean getDoNotCheckCapabilities() { return m_DoNotCheckCapabilities; } /** * Returns an enumeration describing the available options. * * @return an enumeration of all the available options. */ @Override public Enumeration




© 2015 - 2024 Weber Informatics LLC | Privacy Policy