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

weka.classifiers.functions.SMOreg Maven / Gradle / Ivy

Go to download

The Waikato Environment for Knowledge Analysis (WEKA), a machine learning workbench. This version represents the developer version, the "bleeding edge" of development, you could say. New functionality gets added to this version.

There is a newer version: 3.9.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 .
 */

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

package weka.classifiers.functions;

import weka.classifiers.AbstractClassifier;
import weka.classifiers.functions.supportVector.Kernel;
import weka.classifiers.functions.supportVector.PolyKernel;
import weka.classifiers.functions.supportVector.RegOptimizer;
import weka.classifiers.functions.supportVector.RegSMOImproved;
import weka.core.AdditionalMeasureProducer;
import weka.core.Capabilities;
import weka.core.Capabilities.Capability;
import weka.core.Instance;
import weka.core.Instances;
import weka.core.Option;
import weka.core.OptionHandler;
import weka.core.RevisionUtils;
import weka.core.SelectedTag;
import weka.core.Tag;
import weka.core.TechnicalInformation;
import weka.core.TechnicalInformation.Field;
import weka.core.TechnicalInformation.Type;
import weka.core.TechnicalInformationHandler;
import weka.core.Utils;
import weka.core.WeightedInstancesHandler;
import weka.filters.Filter;
import weka.filters.unsupervised.attribute.NominalToBinary;
import weka.filters.unsupervised.attribute.Normalize;
import weka.filters.unsupervised.attribute.ReplaceMissingValues;
import weka.filters.unsupervised.attribute.Standardize;

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

/** 
 
 * SMOreg implements the support vector machine for regression. The parameters can be learned using various algorithms. The algorithm is selected by setting the RegOptimizer. The most popular algorithm (RegSMOImproved) is due to Shevade, Keerthi et al and this is the default RegOptimizer.
*
* For more information see:
*
* S.K. Shevade, S.S. Keerthi, C. Bhattacharyya, K.R.K. Murthy: Improvements to the SMO Algorithm for SVM Regression. In: IEEE Transactions on Neural Networks, 1999.
*
* A.J. Smola, B. Schoelkopf (1998). A tutorial on support vector regression. *

* * BibTeX: *

 * @inproceedings{Shevade1999,
 *    author = {S.K. Shevade and S.S. Keerthi and C. Bhattacharyya and K.R.K. Murthy},
 *    booktitle = {IEEE Transactions on Neural Networks},
 *    title = {Improvements to the SMO Algorithm for SVM Regression},
 *    year = {1999},
 *    PS = {http://guppy.mpe.nus.edu.sg/\~mpessk/svm/ieee_smo_reg.ps.gz}
 * }
 * 
 * @techreport{Smola1998,
 *    author = {A.J. Smola and B. Schoelkopf},
 *    note = {NeuroCOLT2 Technical Report NC2-TR-1998-030},
 *    title = {A tutorial on support vector regression},
 *    year = {1998}
 * }
 * 
*

* * Valid options are:

* *

 -C <double>
 *  The complexity constant C.
 *  (default 1)
* *
 -N
 *  Whether to 0=normalize/1=standardize/2=neither.
 *  (default 0=normalize)
* *
 -I <classname and parameters>
 *  Optimizer class used for solving quadratic optimization problem
 *  (default weka.classifiers.functions.supportVector.RegSMOImproved)
* *
 -K <classname and parameters>
 *  The Kernel to use.
 *  (default: weka.classifiers.functions.supportVector.PolyKernel)
* *
 
 * Options specific to optimizer ('-I') weka.classifiers.functions.supportVector.RegSMOImproved:
 * 
* *
 -T <double>
 *  The tolerance parameter for checking the stopping criterion.
 *  (default 0.001)
* *
 -V
 *  Use variant 1 of the algorithm when true, otherwise use variant 2.
 *  (default true)
* *
 -P <double>
 *  The epsilon for round-off error.
 *  (default 1.0e-12)
* *
 -L <double>
 *  The epsilon parameter in epsilon-insensitive loss function.
 *  (default 1.0e-3)
* *
 -W <double>
 *  The random number seed.
 *  (default 1)
* *
 
 * Options specific to kernel ('-K') weka.classifiers.functions.supportVector.PolyKernel:
 * 
* *
 -D
 *  Enables debugging output (if available) to be printed.
 *  (default: off)
* *
 -no-checks
 *  Turns off all checks - use with caution!
 *  (default: checks on)
* *
 -C <num>
 *  The size of the cache (a prime number), 0 for full cache and 
 *  -1 to turn it off.
 *  (default: 250007)
* *
 -E <num>
 *  The Exponent to use.
 *  (default: 1.0)
* *
 -L
 *  Use lower-order terms.
 *  (default: no)
* * * @author Remco Bouckaert ([email protected],[email protected]) * @version $Revision: 12558 $ */ public class SMOreg extends AbstractClassifier implements WeightedInstancesHandler, AdditionalMeasureProducer, TechnicalInformationHandler { /** for serialization */ private static final long serialVersionUID = -7149606251113102827L; /** The filter to apply to the training data: Normalzie */ public static final int FILTER_NORMALIZE = 0; /** The filter to apply to the training data: Standardize */ public static final int FILTER_STANDARDIZE = 1; /** The filter to apply to the training data: None */ public static final int FILTER_NONE = 2; /** The filter to apply to the training data */ public static final Tag[] TAGS_FILTER = { new Tag(FILTER_NORMALIZE, "Normalize training data"), new Tag(FILTER_STANDARDIZE, "Standardize training data"), new Tag(FILTER_NONE, "No normalization/standardization"), }; /** Whether to normalize/standardize/neither */ protected int m_filterType = FILTER_NORMALIZE; /** The filter used to make attributes numeric. */ protected NominalToBinary m_NominalToBinary; /** The filter used to standardize/normalize all values. */ protected Filter m_Filter = null; /** The filter used to get rid of missing values. */ protected ReplaceMissingValues m_Missing; /** Only numeric attributes in the dataset? If so, less need to filter */ protected boolean m_onlyNumeric; /** capacity parameter **/ protected double m_C = 1.0; /** coefficients used by normalization filter for doing its linear transformation * so that result = svmoutput * m_x1 + m_x0 **/ protected double m_x1 = 1.0; protected double m_x0 = 0.0; /** contains the algorithm used for learning **/ protected RegOptimizer m_optimizer = new RegSMOImproved(); /** the configured kernel */ protected Kernel m_kernel = new PolyKernel(); /** * Returns a string describing classifier * * @return a description suitable for * displaying in the explorer/experimenter gui */ public String globalInfo() { return "SMOreg implements the support vector machine for regression. " + "The parameters can be learned using various algorithms. The " + "algorithm is selected by setting the RegOptimizer. The most " + "popular algorithm (" + RegSMOImproved.class.getName().replaceAll(".*\\.", "") + ") is due to Shevade, Keerthi " + "et al and this is the default RegOptimizer.\n\n" + "For more information see:\n\n" + getTechnicalInformation().toString(); } /** * Returns an instance of a TechnicalInformation object, containing * detailed information about the technical background of this class, * e.g., paper reference or book this class is based on. * * @return the technical information about this class */ public TechnicalInformation getTechnicalInformation() { TechnicalInformation result; TechnicalInformation additional; result = new TechnicalInformation(Type.INPROCEEDINGS); result.setValue(Field.AUTHOR, "S.K. Shevade and S.S. Keerthi and C. Bhattacharyya and K.R.K. Murthy"); result.setValue(Field.TITLE, "Improvements to the SMO Algorithm for SVM Regression"); result.setValue(Field.BOOKTITLE, "IEEE Transactions on Neural Networks"); result.setValue(Field.YEAR, "1999"); result.setValue(Field.PS, "http://guppy.mpe.nus.edu.sg/~mpessk/svm/ieee_smo_reg.ps.gz"); additional = result.add(Type.TECHREPORT); additional.setValue(Field.AUTHOR, "A.J. Smola and B. Schoelkopf"); additional.setValue(Field.TITLE, "A tutorial on support vector regression"); additional.setValue(Field.NOTE, "NeuroCOLT2 Technical Report NC2-TR-1998-030"); additional.setValue(Field.YEAR, "1998"); return result; } /** * Returns an enumeration describing the available options. * * @return an enumeration of all the available options. */ public Enumeration




© 2015 - 2024 Weber Informatics LLC | Privacy Policy