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

weka.associations.FilteredAssociator Maven / Gradle / Ivy

/*
 *   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 .
 */

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

package weka.associations;

import java.util.Collections;
import java.util.Enumeration;
import java.util.Vector;

import weka.core.Capabilities;
import weka.core.Capabilities.Capability;
import weka.core.Instances;
import weka.core.Option;
import weka.core.OptionHandler;
import weka.core.RevisionUtils;
import weka.core.Utils;
import weka.filters.Filter;
import weka.filters.MultiFilter;

/**
 *  Class for running an arbitrary associator on data
 * that has been passed through an arbitrary filter. Like the associator, the
 * structure of the filter is based exclusively on the training data and test
 * instances will be processed by the filter without changing their structure.
 * 

* * * Valid options are: *

* *

 * -F <filter specification>
 *  Full class name of filter to use, followed
 *  by filter options.
 *  eg: "weka.filters.unsupervised.attribute.Remove -V -R 1,2"
 *  (default: weka.filters.MultiFilter with
 *  weka.filters.unsupervised.attribute.ReplaceMissingValues)
 * 
* *
 * -c <the class index>
 *  The class index.
 *  (default: -1, i.e. unset)
 * 
* *
 * -W
 *  Full name of base associator.
 *  (default: weka.associations.Apriori)
 * 
* *
 * Options specific to associator weka.associations.Apriori:
 * 
* *
 * -N <required number of rules output>
 *  The required number of rules. (default = 10)
 * 
* *
 * -T <0=confidence | 1=lift | 2=leverage | 3=Conviction>
 *  The metric type by which to rank rules. (default = confidence)
 * 
* *
 * -C <minimum metric score of a rule>
 *  The minimum confidence of a rule. (default = 0.9)
 * 
* *
 * -D <delta for minimum support>
 *  The delta by which the minimum support is decreased in
 *  each iteration. (default = 0.05)
 * 
* *
 * -U <upper bound for minimum support>
 *  Upper bound for minimum support. (default = 1.0)
 * 
* *
 * -M <lower bound for minimum support>
 *  The lower bound for the minimum support. (default = 0.1)
 * 
* *
 * -S <significance level>
 *  If used, rules are tested for significance at
 *  the given level. Slower. (default = no significance testing)
 * 
* *
 * -I
 *  If set the itemsets found are also output. (default = no)
 * 
* *
 * -R
 *  Remove columns that contain all missing values (default = no)
 * 
* *
 * -V
 *  Report progress iteratively. (default = no)
 * 
* *
 * -A
 *  If set class association rules are mined. (default = no)
 * 
* *
 * -c <the class index>
 *  The class index. (default = last)
 * 
* * * * @author Len Trigg ([email protected]) * @author FracPete (fracpete at waikato dot ac dot nz) * @version $Revision: 10172 $ */ public class FilteredAssociator extends SingleAssociatorEnhancer implements AssociationRulesProducer { /** for serialization */ static final long serialVersionUID = -4523450618538717400L; /** The filter */ protected Filter m_Filter; /** The instance structure of the filtered instances */ protected Instances m_FilteredInstances; /** The class index. */ protected int m_ClassIndex; /** * Default constructor. */ public FilteredAssociator() { m_Associator = new Apriori(); m_Filter = new MultiFilter(); ((MultiFilter) m_Filter) .setFilters(new Filter[] { new weka.filters.unsupervised.attribute.ReplaceMissingValues() }); m_ClassIndex = -1; } /** * Returns a string describing this Associator * * @return a description of the Associator suitable for displaying in the * explorer/experimenter gui */ public String globalInfo() { return "Class for running an arbitrary associator on data that has been passed " + "through an arbitrary filter. Like the associator, the structure of the filter " + "is based exclusively on the training data and test instances will be processed " + "by the filter without changing their structure."; } /** * String describing default associator. * * @return the default associator classname */ @Override protected String defaultAssociatorString() { return Apriori.class.getName(); } /** * 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