|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.MiToBo.core.operator.MTBOperator
de.unihalle.informatik.MiToBo.apps.scratchAssay.ScratchAssaySVMTrainer
@ALDAOperator(genericExecutionMode=SWING, level=STANDARD, allowBatchMode=false) public class ScratchAssaySVMTrainer
class for training and cross validating a support vector machine for classification of scratch assay
images into images containing a scratch and those that don't
Nested Class Summary | |
---|---|
static class |
ScratchAssaySVMTrainer.KERNEL_TYPE
|
static class |
ScratchAssaySVMTrainer.ScratchOrientation
|
static class |
ScratchAssaySVMTrainer.ValidationMethod
|
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator |
---|
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode |
Field Summary | |
---|---|
private java.lang.Integer |
C
|
private java.lang.Integer |
degree
|
private java.lang.Integer |
entropyFilterSize
|
private java.lang.String |
error_msg
|
(package private) java.lang.StringBuffer |
falseFileNames
|
(package private) java.lang.StringBuffer |
falseNegativeFileNames
|
(package private) java.lang.StringBuffer |
falsePositiveFileNames
|
private int |
fn
|
private int |
fp
|
private java.lang.Boolean |
isHorizontal
|
private java.lang.Integer |
k
|
private java.lang.Integer |
maxIter
|
private ScratchAssaySVMTrainer.ValidationMethod |
method
|
private libsvm.svm_model |
model
|
private de.unihalle.informatik.Alida.datatypes.ALDDirectoryString |
negDir
|
private ScratchAssaySVMTrainer.ScratchOrientation |
orientation
|
(package private) java.lang.String |
outFile
|
private libsvm.svm_parameter |
param
|
private de.unihalle.informatik.Alida.datatypes.ALDDirectoryString |
posDir
|
private libsvm.svm_problem |
prob
|
private java.lang.Integer |
sigma
|
private int |
tn
|
private int |
tp
|
private ScratchAssaySVMTrainer.KERNEL_TYPE |
type
|
private java.util.Vector<libsvm.svm_node[]> |
vx
|
private java.util.Vector<java.lang.Double> |
vy
|
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator |
---|
completeDAG, name, portHashAccess, verbose, versionProvider |
Constructor Summary | |
---|---|
ScratchAssaySVMTrainer()
|
|
ScratchAssaySVMTrainer(java.lang.String posDir,
java.lang.String negDir,
int sigma,
int entropyFilterSize,
boolean isHorizontal,
int maxIter)
|
Method Summary | |
---|---|
private void |
addFeatures(double label,
double[] features)
add the given patterns (feature arrays) together with their corresponding label to the existing patterns used to train the SVM |
private double |
classify(double[] features)
|
private void |
extract(java.io.File[] samples,
double label)
segment the given images and extract their features for classification |
private void |
extract(java.util.Vector<java.io.File> samples,
double label)
segment the given images and extract their features for classification |
private void |
leaveOneOutCrossValidation()
leave-one-out cross validation, i.e. iteratively one sample is taken as test sample whereas all others are used for training |
private MTBTableModel |
makeTable()
|
void |
operate()
|
private MTBImage |
readImage(java.lang.String path)
|
private void |
saveSVM()
save resulting svm model file |
void |
setSVMParameters(libsvm.svm_parameter param)
|
private void |
stratifiedCrossValidation()
stratified k-fold cross validation, i.e. training and test tests contain approximately the same proportions of positive and negative samples in every iteration |
private int[] |
test(java.util.Vector<java.io.File> samples,
int label)
|
private void |
train()
the actual svm training |
Methods inherited from class de.unihalle.informatik.MiToBo.core.operator.MTBOperator |
---|
readResolve |
Methods inherited from class de.unihalle.informatik.Alida.operator.ALDOperator |
---|
deserializeFromXmlFile, fieldContained, getALDPortHashAccessKey, getConstructionMode, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterNames, getSupplementalNames, getVerbose, getVersion, isConfigured, parametersToXmlObject, print, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, runOp, runOp, runOp, serializeToXmlFile, setConstructionMode, setName, setParameter, setParametersFromXml, setParametersFromXml, setVerbose, toStringVerbose, unconfiguredItems, validate, validateCustom, validateGeneric, writeHistory, writeHistory, writeHistory, writeParametersToXml |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@Parameter(label="regularization parameter (C)", required=false, direction=IN, supplemental=false, description="regularization parameter", mode=STANDARD, dataIOOrder=0) private java.lang.Integer C
@Parameter(label="degree (only for polynomial kernel)", required=false, direction=IN, supplemental=false, description="degree for polynomial svm kernel", mode=STANDARD, dataIOOrder=4) private java.lang.Integer degree
@Parameter(label="entropy filter size", required=true, direction=IN, supplemental=false, description="size of entropy filter mask", mode=STANDARD, dataIOOrder=4) private java.lang.Integer entropyFilterSize
private java.lang.String error_msg
java.lang.StringBuffer falseFileNames
java.lang.StringBuffer falseNegativeFileNames
java.lang.StringBuffer falsePositiveFileNames
private int fn
private int fp
private java.lang.Boolean isHorizontal
@Parameter(label="k (only for k-fold x-validation)", required=false, direction=IN, supplemental=false, description="k for k-fold cross validation", mode=STANDARD, dataIOOrder=5) private java.lang.Integer k
@Parameter(label="maximum iterations", required=false, direction=IN, supplemental=false, description="maximum number of iterations of level set segmentation", mode=ADVANCED, dataIOOrder=2) private java.lang.Integer maxIter
@Parameter(label="validation method", required=false, direction=IN, supplemental=false, description="validation method for x-validation", mode=STANDARD, dataIOOrder=6) private ScratchAssaySVMTrainer.ValidationMethod method
private libsvm.svm_model model
@Parameter(label="directory containing negative samples", required=true, direction=IN, supplemental=false, description="directory containing negative samples", mode=STANDARD, dataIOOrder=1) private de.unihalle.informatik.Alida.datatypes.ALDDirectoryString negDir
@Parameter(label="scratch orientation", required=true, direction=IN, supplemental=false, description="horizontally or vertically oriented scratch", mode=STANDARD, dataIOOrder=2) private ScratchAssaySVMTrainer.ScratchOrientation orientation
java.lang.String outFile
private libsvm.svm_parameter param
@Parameter(label="directory containing positive samples", required=true, direction=IN, supplemental=false, description="directory containing positive samples", mode=STANDARD, dataIOOrder=0) private de.unihalle.informatik.Alida.datatypes.ALDDirectoryString posDir
private libsvm.svm_problem prob
@Parameter(label="\u03c3", required=true, direction=IN, supplemental=false, description="standard deviation of gauss filter", mode=STANDARD, dataIOOrder=3) private java.lang.Integer sigma
private int tn
private int tp
@Parameter(label="kernel type", required=false, direction=IN, supplemental=false, description="type of svm kernel", mode=STANDARD, dataIOOrder=1) private ScratchAssaySVMTrainer.KERNEL_TYPE type
private java.util.Vector<libsvm.svm_node[]> vx
private java.util.Vector<java.lang.Double> vy
Constructor Detail |
---|
public ScratchAssaySVMTrainer() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
public ScratchAssaySVMTrainer(java.lang.String posDir, java.lang.String negDir, int sigma, int entropyFilterSize, boolean isHorizontal, int maxIter) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
posDir
- directory containing positive samplesnegDir
- directory containing negative samplessigma
- standard deviation of gauss filterentropyFilterSize
- size of entropy filter maskisHorizontal
- is scratch horizontally oriented (assumed to be vertically oriented else)maxIter
- maximum number of iterations for level set segmentation
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail |
---|
private void addFeatures(double label, double[] features)
label
- label for the givven featuresfeatures
- array of feature valuesprivate double classify(double[] features)
features
-
private void extract(java.io.File[] samples, double label)
samples
- array of filenames containing imageslabel
- label of the input imagesprivate void extract(java.util.Vector<java.io.File> samples, double label)
samples
- vector of filenames containing imageslabel
- label of the input imagesprivate void leaveOneOutCrossValidation()
private MTBTableModel makeTable()
public void operate() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
operate
in class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
private MTBImage readImage(java.lang.String path)
path
-
private void saveSVM()
public void setSVMParameters(libsvm.svm_parameter param)
param
- private void stratifiedCrossValidation()
private int[] test(java.util.Vector<java.io.File> samples, int label)
samples
- Vector of sample fileslabel
- ground truth labels for the input images
private void train()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |