weka.classifiers.functions.supportVector.RBFKernel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of weka-dev Show documentation
Show all versions of weka-dev Show documentation
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.
/*
* 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 .
*/
/*
* RBFKernel.java
* Copyright (C) 1999-2012 University of Waikato, Hamilton, New Zealand
* Copyright (C) 2005 J. Lindgren
*
*/
package weka.classifiers.functions.supportVector;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Vector;
import weka.core.Capabilities;
import weka.core.Capabilities.Capability;
import weka.core.Instance;
import weka.core.Instances;
import weka.core.Option;
import weka.core.RevisionUtils;
import weka.core.Utils;
/**
* The RBF kernel. K(x, y) = e^-(gamma * <x-y,
* x-y>^2)
*
*
*
* Valid options are:
*
*
*
* -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)
*
*
*
* -G <num>
* The Gamma parameter.
* (default: 0.01)
*
*
*
*
* @author Eibe Frank ([email protected])
* @author Shane Legg ([email protected]) (sparse vector code)
* @author Stuart Inglis ([email protected]) (sparse vector code)
* @author J. Lindgren (jtlindgr{at}cs.helsinki.fi) (RBF kernel)
* @version $Revision: 10169 $
*/
public class RBFKernel extends CachedKernel {
/** for serialization */
static final long serialVersionUID = 5247117544316387852L;
/** The precalculated dotproducts of <inst_i,inst_i> */
protected double m_kernelPrecalc[];
/** Gamma for the RBF kernel. */
protected double m_gamma = 0.01;
/**
* default constructor - does nothing.
*/
public RBFKernel() {
super();
}
/**
* Constructor. Initializes m_kernelPrecalc[].
*
* @param data the data to use
* @param cacheSize the size of the cache
* @param gamma the bandwidth
* @throws Exception if something goes wrong
*/
public RBFKernel(Instances data, int cacheSize, double gamma) throws Exception {
super();
setCacheSize(cacheSize);
setGamma(gamma);
buildKernel(data);
}
/**
* Returns a string describing the kernel
*
* @return a description suitable for displaying in the explorer/experimenter
* gui
*/
@Override
public String globalInfo() {
return "The RBF kernel. K(x, y) = e^-(gamma * ^2)";
}
/**
* 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