weka.clusterers.AbstractClusterer Java Examples

The following examples show how to use weka.clusterers.AbstractClusterer. 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: ClassificationViaClustering.java    From tsml with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Parses the options for this object. <p/>
 *
 <!-- options-start -->
 * Valid options are: <p/>
 * 
 * <pre> -D
 *  If set, classifier is run in debug mode and
 *  may output additional info to the console</pre>
 * 
 * <pre> -W
 *  Full name of clusterer.
 *  (default: weka.clusterers.SimpleKMeans)</pre>
 * 
 * <pre> 
 * Options specific to clusterer weka.clusterers.SimpleKMeans:
 * </pre>
 * 
 * <pre> -N &lt;num&gt;
 *  number of clusters.
 *  (default 2).</pre>
 * 
 * <pre> -V
 *  Display std. deviations for centroids.
 * </pre>
 * 
 * <pre> -M
 *  Replace missing values with mean/mode.
 * </pre>
 * 
 * <pre> -S &lt;num&gt;
 *  Random number seed.
 *  (default 10)</pre>
 * 
 <!-- options-end -->
 *
 * @param options	the options to use
 * @throws Exception	if setting of options fails
 */
public void setOptions(String[] options) throws Exception {
  String	tmpStr;

  super.setOptions(options);

  tmpStr = Utils.getOption('W', options);
  if (tmpStr.length() > 0) { 
    // This is just to set the classifier in case the option 
    // parsing fails.
    setClusterer(AbstractClusterer.forName(tmpStr, null));
    setClusterer(AbstractClusterer.forName(tmpStr, Utils.partitionOptions(options)));
  }
  else {
    // This is just to set the classifier in case the option 
    // parsing fails.
    setClusterer(AbstractClusterer.forName(defaultClustererString(), null));
    setClusterer(AbstractClusterer.forName(defaultClustererString(), Utils.partitionOptions(options)));
  }
}