📄 supportvectorsettings.java
字号:
/*
* 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 2 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, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/**
* Title: XELOPES Data Mining Library
* Description: The XELOPES library is an open platform-independent and data-source-independent library for Embedded Data Mining.
* Copyright: Copyright (c) 2002 Prudential Systems Software GmbH
* Company: ZSoft (www.zsoft.ru), Prudsys (www.prudsys.com)
* @author Michael Thess
* @version 1.1
*/
package com.prudsys.pdm.Models.Regression.SVM;
import com.prudsys.pdm.Core.MiningModel;
import com.prudsys.pdm.Core.MiningSettings;
import com.prudsys.pdm.Models.Regression.RegressionSettings;
/**
* Parameters for computing support vector machines. <p>
*
* From PDM CWM extension. <p>
*
* Superclasses:
* <ul>
* <li> RegressionSettings
* </ul>
* Attributes:
* <ul>
* <li> <i>svmType</i>: Defines the type of SVM. The following types
* are predefined: SvmCSvc, SvmNuSvc, SvmOneClass, SvmEpsilonSvr, SvmNuSvr. <br>
* - type: Integer <br>
* - multiplicity: exactly one
* <li> <i>kernelType</i>: Defines the kernel type of the SVM. The following types
* are predefined: KernelLinear, KernelPoly, KernelRbf, KernelSigmoid. <br>
* - type: Integer <br>
* - multiplicity: exactly one
* <li> <i>degree</i>: Degree in kernel function. <br>
* - type: Float <br>
* - multiplicity: exactly one
* <li> <i>gamma</i>: Gamma in kernel function. <br>
* - type: Float <br>
* - multiplicity: exactly one
* <li> <i>coef0</i>: Coefficient coef0 in kernel function. <br>
* - type: float <br>
* - multiplicity: exactly one
* <li> <i>C</i>: Regularization parameter C. <br>
* - type: float <br>
* - multilplicity: exactly one
* <li> <i>nu</i>: Nu in NU-SVM. <br>
* - type: Float <br>
* - multiplicity: exactly one
* <li> <i>lossEpsilon</i>: Epsilon in EPSILON-SVR. <br>
* - type: Float <br>
* - multiplicity: exactly one
* </ul>
* Constraints:
* <ul>
* <li> number of supportVectors must be equal to number of coefficients.
* </ul>
*
* @see MiningSettings
* @see RegressionSettings
*/
public class SupportVectorSettings extends RegressionSettings
{
// -----------------------------------------------------------------------
// Constants defining SVM and kernel types
// -----------------------------------------------------------------------
public static final int SVM_C_SVC = 0;
public static final int SVM_NU_SVC = 1;
public static final int SVM_ONE_CLASS = 2;
public static final int SVM_EPSILON_SVR = 3;
public static final int SVM_NU_SVR = 4;
public static final int KERNEL_LINEAR = 0;
public static final int KERNEL_POLY = 1;
public static final int KERNEL_RBF = 2;
public static final int KERNEL_SIGMOID = 3;
// -----------------------------------------------------------------------
// Variables declarations
// -----------------------------------------------------------------------
// SVM types:
private int svmType = SVM_C_SVC;
private int kernelType = KERNEL_RBF;
// Kernel parameters:
private double degree = 3.0;
private double gamma = 1.0;
private double coef0 = 0.0;
// Algorithm parameters:
private double C = 1.0;
private double nu = 0.5;
private double lossEpsilon = 0.1;
// -----------------------------------------------------------------------
// Constructor
// -----------------------------------------------------------------------
/**
* Empty constructor.
*/
public SupportVectorSettings()
{
setFunction( MiningModel.REGRESSION_FUNCTION );
setAlgorithm( MiningModel.SUPPORT_VECTOR_MACHINE_ALGORITHM);
}
// -----------------------------------------------------------------------
// Getter and setter methods
// -----------------------------------------------------------------------
// SVM type:
public int getSvmType()
{
return svmType;
}
public void setSvmType(int svmType)
{
this.svmType = svmType;
}
// Kernel type:
public int getKernelType()
{
return kernelType;
}
public void setKernelType(int kernelType)
{
this.kernelType = kernelType;
}
// Kernel parameters:
public double getDegree()
{
return degree;
}
public void setDegree(double degree)
{
this.degree = degree;
}
public double getGamma()
{
return gamma;
}
public void setGamma(double gamma)
{
this.gamma = gamma;
}
public double getCoef0()
{
return coef0;
}
public void setCoef0(double coef0)
{
this.coef0 = coef0;
}
// algorithm parameters:
public void setC(double C) {
this.C = C;
}
public double getC() {
return C;
}
public void setNu(double nu) {
this.nu = nu;
}
public double getNu() {
return nu;
}
public void setLossEpsilon(double lossEpsilon) {
this.lossEpsilon = lossEpsilon;
}
public double getLossEpsilon() {
return lossEpsilon;
}
// -----------------------------------------------------------------------
// Export methods
// -----------------------------------------------------------------------
/**
* Returns settings as string.
*
* @return settings as string
*/
public String toString()
{
return "Support vector machine\n" +
"Target attribute=\"" + target + "\"";
}
/**
* Returns settings as HTML string.
*
* @return settings as HTML string
*/
public String toHtmlString()
{
String description = "Model: Support Vector Machine<br>" +
"<a href=http://this?Target>Target attribute = <font color=red><b>" + target + "</b></color></a>";
return description;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -