|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectSciLib.Neuro.SVM.SVM
public class SVM
| Field Summary | |
|---|---|
protected vector |
alpha
|
protected double |
B
|
protected double |
b_low
|
protected double |
b_up
|
protected boolean |
binary
|
protected double |
C
|
protected double |
eps
|
protected vector |
error_cache
|
protected FileHandler |
file
|
int |
GACV1
|
protected int |
i_low
|
protected int |
i_up
|
int |
JHB
|
protected Kernel |
K
|
protected int |
M
|
protected int |
N
variables |
protected matrix |
patterns
|
protected boolean |
sparse
|
protected vector |
sv
|
protected integerVector |
svIndex
|
protected integerVector |
targets
|
protected double |
tolerance
|
| Constructor Summary | |
|---|---|
SVM(FileHandler file,
boolean binary,
boolean sparse)
Constructor - you must define Kernel |
|
SVM(FileHandler file,
Kernel K,
boolean binary,
boolean sparse)
Constructor |
|
SVM(matrix patterns,
integerVector targets,
Kernel K)
Constructor |
|
| Method Summary | |
|---|---|
protected void |
computeB()
compute the the threshold value b |
void |
crossValidation(int k,
double startLog2C,
int cs,
double startLambda,
int ls,
double a,
double b)
|
double |
f(int k)
compute the decision function without the threshold value b |
double |
f(vector x)
compute the decision function without the threshold value b |
vector |
getAlpha()
get alpha vector |
double |
getB()
get threshold value b |
double |
getC()
get the value of C |
double |
getEpsi()
get the epsilon parameter of SVM |
FileHandler |
getFile()
get the object that handles data files |
Kernel |
getKernel()
get kernel K |
int |
getNoOfSV()
get the number of SVs |
matrix |
getPatterns()
get patterns matrix when data is not sparse |
vector |
getSV()
get support vectors |
integerVector |
getSVIndex()
get indices of SVs |
integerVector |
getTargets()
get targets vector of training data |
double |
getTolerance()
get the tolerance of SVM |
protected void |
initialize(FileHandler file)
|
void |
initiateParameter(double startlog2C,
double startlog2Lambda,
int cs,
int ls,
vector cp,
vector lp)
|
boolean |
isBinary()
check if data is binary |
protected boolean |
isInI0I1I2(int i)
check if index i is in Iup or in Ilow |
protected boolean |
isInI0I3I4(int i)
|
protected boolean |
isInI1I2(int i)
|
protected boolean |
isInI3I4(int i)
|
boolean |
isSparse()
check if data is sparse |
void |
LOOValidation(int type,
double[] cPar,
double[] lambdaPar,
double a,
double b)
|
void |
LOOValidation(int type,
double startLog2C,
int cs,
double startLambda,
int ls,
double a,
double b)
|
static integerVector |
makeTargets(int k,
integerVector targets)
|
int |
misclassified(matrix p,
integerVector t)
|
void |
readSVs(java.lang.String alphaFile,
vector sv,
integerVector svIndex)
|
void |
setB(double b)
set the threshold b of SVM |
void |
setC(double C)
set the parameter C of SVM |
void |
setEpsi(double eps)
set the epsilon of SVM |
void |
setFile(FileHandler file)
set the object that handles data files |
void |
setKernel(Kernel K)
set the kernel of SVM |
void |
setN(int n)
|
void |
setTolerance(double tolerance)
set the tolerance of SVM |
double |
testing(FileHandler testFile)
|
double |
testing(FileHandler testFile,
double a,
double b)
|
double |
testing(FileHandler testFile,
java.lang.String alphaFile)
|
double |
testing(FileHandler testFile,
java.lang.String alphaFile,
double a,
double b)
|
void |
training(java.lang.String alphaFile)
|
void |
training(java.lang.String alphaFile,
double a,
double b)
|
void |
writeReport(java.lang.String fileName,
java.lang.String header)
write report about svm |
void |
writeResultToFile(java.lang.String fileName)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int N
protected int M
protected boolean binary
protected boolean sparse
protected double C
protected double B
protected double tolerance
protected double eps
protected vector alpha
protected vector error_cache
protected FileHandler file
protected Kernel K
protected matrix patterns
protected integerVector targets
protected vector sv
protected integerVector svIndex
protected double b_up
protected double b_low
protected int i_up
protected int i_low
public final int JHB
public final int GACV1
| Constructor Detail |
|---|
public SVM(FileHandler file,
Kernel K,
boolean binary,
boolean sparse)
file - the file that handles training data, FileHandlerK - the kernel of SVM, Kernelbinary - the data is binary or not, booleansparse - the data is sparse or not, boolean
public SVM(FileHandler file,
boolean binary,
boolean sparse)
file - the file that handles training data, FileHandlerbinary - the data is binary or not, booleansparse - the data is sparse or not, boolean
public SVM(matrix patterns,
integerVector targets,
Kernel K)
patterns - the training data, a matrixtargets - the labels of taining patterns, an integerVectorK - the kernel of SVM, Kernel| Method Detail |
|---|
protected void initialize(FileHandler file)
public boolean isBinary()
public boolean isSparse()
public vector getAlpha()
public double getB()
public Kernel getKernel()
public FileHandler getFile()
public matrix getPatterns()
public integerVector getTargets()
public void setFile(FileHandler file)
file - a FileHandlerpublic void setKernel(Kernel K)
K - a Kernelpublic void setB(double b)
b - a doublepublic void setTolerance(double tolerance)
tolerance - a doublepublic void setEpsi(double eps)
eps - a doublepublic void setC(double C)
C - a doublepublic void setN(int n)
public double getTolerance()
public double getEpsi()
public double getC()
public int getNoOfSV()
public vector getSV()
public integerVector getSVIndex()
public void writeResultToFile(java.lang.String fileName)
public void readSVs(java.lang.String alphaFile,
vector sv,
integerVector svIndex)
protected boolean isInI0I1I2(int i)
i - the index i
protected boolean isInI0I3I4(int i)
protected boolean isInI1I2(int i)
protected boolean isInI3I4(int i)
protected void computeB()
public void writeReport(java.lang.String fileName,
java.lang.String header)
fileName - fileName for store the reportheader - the header string
public static integerVector makeTargets(int k,
integerVector targets)
public double f(int k)
k - the index of the input data from the training setpublic double f(vector x)
x - the input vector
public void initiateParameter(double startlog2C,
double startlog2Lambda,
int cs,
int ls,
vector cp,
vector lp)
public void training(java.lang.String alphaFile)
training in interface SMO
public void training(java.lang.String alphaFile,
double a,
double b)
training in interface SMOpublic double testing(FileHandler testFile)
testing in interface SMO
public double testing(FileHandler testFile,
java.lang.String alphaFile)
testing in interface SMO
public double testing(FileHandler testFile,
double a,
double b)
testing in interface SMO
public double testing(FileHandler testFile,
java.lang.String alphaFile,
double a,
double b)
testing in interface SMO
public int misclassified(matrix p,
integerVector t)
misclassified in interface SMO
public void crossValidation(int k,
double startLog2C,
int cs,
double startLambda,
int ls,
double a,
double b)
crossValidation in interface SMO
public void LOOValidation(int type,
double startLog2C,
int cs,
double startLambda,
int ls,
double a,
double b)
LOOValidation in interface SMO
public void LOOValidation(int type,
double[] cPar,
double[] lambdaPar,
double a,
double b)
LOOValidation in interface SMO
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||