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

weka.classifiers.functions.supportVector.RegOptimizer 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 .
 */

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

package weka.classifiers.functions.supportVector;

import java.io.Serializable;
import java.util.Enumeration;
import java.util.Random;
import java.util.Vector;

import weka.classifiers.functions.SMOreg;
import weka.core.Instance;
import weka.core.Instances;
import weka.core.Option;
import weka.core.OptionHandler;
import weka.core.RevisionHandler;
import weka.core.RevisionUtils;
import weka.core.Utils;

/**
 * Base class implementation for learning algorithm of SMOreg
 * 
 *  Valid options are:
 * 

* *

 * -L <double>
 *  The epsilon parameter in epsilon-insensitive loss function.
 *  (default 1.0e-3)
 * 
* *
 * -W <double>
 *  The random number seed.
 *  (default 1)
 * 
* * * * @author Remco Bouckaert ([email protected],[email protected]) * @version $Revision: 10169 $ */ public class RegOptimizer implements OptionHandler, Serializable, RevisionHandler { /** for serialization */ private static final long serialVersionUID = -2198266997254461814L; /** loss type **/ // protected int m_nLossType = EPSILON; /** the loss type: L1 */ // public final static int L1 = 1; /** the loss type: L2 */ // public final static int L2 = 2; /** the loss type: HUBER */ // public final static int HUBER = 3; /** the loss type: EPSILON */ // public final static int EPSILON = 4; /** the loss type */ // public static final Tag[] TAGS_LOSS_TYPE = { // new Tag(L2, "L2"), // new Tag(L1, "L1"), // new Tag(HUBER, "Huber"), // new Tag(EPSILON, "EPSILON"), // }; /** alpha and alpha* arrays containing weights for solving dual problem **/ public double[] m_alpha; public double[] m_alphaStar; /** offset **/ protected double m_b; /** epsilon of epsilon-insensitive cost function **/ protected double m_epsilon = 1e-3; /** capacity parameter, copied from SMOreg **/ protected double m_C = 1.0; /** class values/desired output vector **/ protected double[] m_target; /** points to data set **/ protected Instances m_data; /** the kernel */ protected Kernel m_kernel; /** index of class variable in data set **/ protected int m_classIndex = -1; /** number of instances in data set **/ protected int m_nInstances = -1; /** random number generator **/ protected Random m_random; /** seed for initializing random number generator **/ protected int m_nSeed = 1; /** set of support vectors, that is, vectors with alpha(*)!=0 **/ protected SMOset m_supportVectors; /** number of kernel evaluations, used for printing statistics only **/ protected int m_nEvals = 0; /** number of kernel cache hits, used for printing statistics only **/ protected int m_nCacheHits = -1; /** weights for linear kernel **/ protected double[] m_weights; /** * Variables to hold weight vector in sparse form. (To reduce storage * requirements.) */ protected double[] m_sparseWeights; protected int[] m_sparseIndices; /** flag to indicate whether the model is built yet **/ protected boolean m_bModelBuilt = false; /** parent SMOreg class **/ protected SMOreg m_SVM = null; /** * the default constructor */ public RegOptimizer() { super(); m_random = new Random(m_nSeed); } /** * Gets an enumeration describing the available options. * * @return an enumeration of all the available options. */ @Override public Enumeration




© 2015 - 2024 Weber Informatics LLC | Privacy Policy