Package de.bwaldvogel.liblinear
Class Parameter
- java.lang.Object
-
- de.bwaldvogel.liblinear.Parameter
-
- All Implemented Interfaces:
java.lang.Cloneable
public final class Parameter extends java.lang.Object implements java.lang.Cloneable
-
-
Field Summary
Fields Modifier and Type Field Description (package private) double
C
private static long
DEFAULT_RANDOM_SEED
(package private) double
eps
stopping tolerance(package private) double[]
init_sol
Initial-solution specification (only supported forSolverType.L2R_LR
andSolverType.L2R_L2LOSS_SVC
)(package private) int
max_iters
(package private) double
nu
(package private) double
p
(package private) java.util.Random
random
(package private) boolean
regularize_bias
(package private) SolverType
solverType
(package private) double[]
weight
(package private) int[]
weightLabel
-
Constructor Summary
Constructors Constructor Description Parameter(SolverType solver, double C, double eps)
Parameter(SolverType solverType, double C, double eps, double p)
Parameter(SolverType solverType, double C, double eps, int max_iters, double p)
Parameter(SolverType solver, double C, int max_iters, double eps)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Parameter
clone()
private static java.util.Random
deepClone(java.util.Random random)
double
getC()
double
getEps()
double[]
getInitSol()
int
getMaxIters()
double
getNu()
int
getNumWeights()
the number of weightsdouble
getP()
SolverType
getSolverType()
int[]
getWeightLabels()
double[]
getWeights()
boolean
isRegularizeBias()
void
setC(double C)
C is the cost of constraints violation.void
setEps(double eps)
eps is the stopping criterion.void
setInitSol(double[] init_sol)
void
setMaxIters(int iters)
void
setNu(double nu)
void
setP(double p)
set the epsilon in loss function of epsilon-SVR (default 0.1)void
setRandom(java.util.Random random)
void
setRegularizeBias(boolean regularizeBias)
void
setSolverType(SolverType solverType)
void
setWeights(double[] weights, int[] weightLabels)
nr_weight, weight_label, and weight are used to change the penalty for some classes (If the weight for a class is not changed, it is set to 1).
-
-
-
Field Detail
-
DEFAULT_RANDOM_SEED
private static final long DEFAULT_RANDOM_SEED
- See Also:
- Constant Field Values
-
C
double C
-
eps
double eps
stopping tolerance
-
max_iters
int max_iters
-
solverType
SolverType solverType
-
weight
double[] weight
-
weightLabel
int[] weightLabel
-
p
double p
-
nu
double nu
-
init_sol
double[] init_sol
Initial-solution specification (only supported forSolverType.L2R_LR
andSolverType.L2R_L2LOSS_SVC
)
-
regularize_bias
boolean regularize_bias
-
random
java.util.Random random
-
-
Constructor Detail
-
Parameter
public Parameter(SolverType solver, double C, double eps)
-
Parameter
public Parameter(SolverType solver, double C, int max_iters, double eps)
-
Parameter
public Parameter(SolverType solverType, double C, double eps, double p)
-
Parameter
public Parameter(SolverType solverType, double C, double eps, int max_iters, double p)
-
-
Method Detail
-
setWeights
public void setWeights(double[] weights, int[] weightLabels)
nr_weight, weight_label, and weight are used to change the penalty for some classes (If the weight for a class is not changed, it is set to 1). This is useful for training classifier using unbalanced input data or with asymmetric misclassification cost.
Each weight[i] corresponds to weight_label[i], meaning that the penalty of class weight_label[i] is scaled by a factor of weight[i].
If you do not want to change penalty for any of the classes, just set nr_weight to 0.
-
getWeights
public double[] getWeights()
- See Also:
setWeights(double[], int[])
-
getWeightLabels
public int[] getWeightLabels()
- See Also:
setWeights(double[], int[])
-
getNumWeights
public int getNumWeights()
the number of weights- See Also:
setWeights(double[], int[])
-
setC
public void setC(double C)
C is the cost of constraints violation. (we usually use 1 to 1000)
-
getC
public double getC()
-
setEps
public void setEps(double eps)
eps is the stopping criterion. (we usually use 0.01).
-
getEps
public double getEps()
-
setMaxIters
public void setMaxIters(int iters)
-
getMaxIters
public int getMaxIters()
-
setSolverType
public void setSolverType(SolverType solverType)
-
getSolverType
public SolverType getSolverType()
-
setP
public void setP(double p)
set the epsilon in loss function of epsilon-SVR (default 0.1)
-
getP
public double getP()
-
setInitSol
public void setInitSol(double[] init_sol)
-
getInitSol
public double[] getInitSol()
-
setNu
public void setNu(double nu)
-
getNu
public double getNu()
-
setRegularizeBias
public void setRegularizeBias(boolean regularizeBias)
-
isRegularizeBias
public boolean isRegularizeBias()
-
setRandom
public void setRandom(java.util.Random random)
-
clone
public Parameter clone()
- Overrides:
clone
in classjava.lang.Object
-
deepClone
private static java.util.Random deepClone(java.util.Random random)
-
-