OpenCLTemplate.MachineLearning.SVM Class Reference

This class stores the variables of a SMO problem solution. More...

List of all members.

Classes

class  CLSVMSrc
class  ProblemSolver
 This class aggregates all methods for solving SMO problems.

Public Member Functions

 SVM ()
 Constructor that initializes with 0s.
void initializeWithZeros ()
 Set all values of the solution to 0.
void PreCalibrateCfg (float tolPositive, float tolNegative)
 Attempts to pre-calibrate configuration parameters. Finds an alpha that enhances similarities between positive examples and reduces similarities between positive and negative examples. Assumes that decreasing lambda increases kernel match.
float TrainWithCrossValidation ()
 Trains current SVM with cross-validation, adjusting kernel parameter lambda and box parameter C.
float TrainWithCrossValidation (float CrossValidationSetPercent, float[] lambdaSet, float[] CSet)
 Trains current SVM with cross-validation, adjusting kernel parameter lambda and box parameter C. Returns best performance so far.
void Train ()
 Trains current SVM.
void ResetSolution ()
 Resets current SVM solution.
void RemoveNonSupportVectors ()
 Removes all vectors that are not SVMs, ie, so that alpha[i]=0.
bool Classify (TrainingUnit Sample)
 Classifies a training unit as positive or negative (true or false).
float ClassificationValue (TrainingUnit Sample)
 Classifies a training unit with a float. The bigger, the more positive the sample. Values greater than zero are assumed to be positive samples.
float GetTrainingSetHitRate ()
 Gets the percentage of training examples classified correctly in the training set.
float GetTrainingSetHitRate (int ind)
 Gets the percentage of training examples classified correctly starting from the ind-th training sample.
float GetHitRate (TrainingSet samples)
 Computes hit rates for a given test set.
void Load (string FileName)
 Copy all values from another solution.
void Save (string FileName)
 Writes current solution to a file.
 SVM ()
 Constructor that initializes with 0s.
void initializeWithZeros ()
 Set all values of the solution to 0.
void PreCalibrateCfg (float tolPositive, float tolNegative)
 Attempts to pre-calibrate configuration parameters. Finds an alpha that enhances similarities between positive examples and reduces similarities between positive and negative examples. Assumes that decreasing lambda increases kernel match.
float TrainWithCrossValidation ()
 Trains current SVM with cross-validation, adjusting kernel parameter lambda and box parameter C.
float TrainWithCrossValidation (float CrossValidationSetPercent, float[] lambdaSet, float[] CSet)
 Trains current SVM with cross-validation, adjusting kernel parameter lambda and box parameter C. Returns best performance so far.
void Train ()
 Trains current SVM.
void ResetSolution ()
 Resets current SVM solution.
void RemoveNonSupportVectors ()
 Removes all vectors that are not SVMs, ie, so that alpha[i]=0.
bool Classify (TrainingUnit Sample)
 Classifies a training unit as positive or negative (true or false).
float ClassificationValue (TrainingUnit Sample)
 Classifies a training unit with a float. The bigger, the more positive the sample. Values greater than zero are assumed to be positive samples.
float GetTrainingSetHitRate ()
 Gets the percentage of training examples classified correctly in the training set.
float GetTrainingSetHitRate (int ind)
 Gets the percentage of training examples classified correctly starting from the ind-th training sample.
float GetHitRate (TrainingSet samples)
 Computes hit rates for a given test set.
void Load (string FileName)
 Copy all values from another solution.
void Save (string FileName)
 Writes current solution to a file.

Static Public Member Functions

static void CLcalculateAllKernels (SVM problemSolution)
 Computes All kernels and errors accelerating with OpenCL.
static float CLpredictOutput (SVM problemSolution, TrainingUnit untrainedUnit)
 Predicts the output of a single entry, given a previous problem, solution and correspondent training set.
static float[] MultiClassify (SVM svm, CLCalc.Program.Image2D Samples)
 Classifies multiple samples stored in OpenCL memory.
static void CLcalculateAllKernels (SVM problemSolution)
 Computes All kernels and errors accelerating with OpenCL.
static float CLpredictOutput (SVM problemSolution, TrainingUnit untrainedUnit)
 Predicts the output of a single entry, given a previous problem, solution and correspondent training set.
static float[] MultiClassify (SVM svm, CLCalc.Program.Image2D Samples)
 Classifies multiple samples stored in OpenCL memory.

Public Attributes

TrainingSet TrainingSet = null
 Training set for this solution.
ProblemConfig ProblemCfg = new ProblemConfig(0.1f, 50, 1e-3f, 1)
 Problem configuration.

Detailed Description

This class stores the variables of a SMO problem solution.


Constructor & Destructor Documentation

OpenCLTemplate.MachineLearning.SVM.SVM (  ) 

Constructor that initializes with 0s.

OpenCLTemplate.MachineLearning.SVM.SVM (  ) 

Constructor that initializes with 0s.


Member Function Documentation

float OpenCLTemplate.MachineLearning.SVM.ClassificationValue ( TrainingUnit  Sample  ) 

Classifies a training unit with a float. The bigger, the more positive the sample. Values greater than zero are assumed to be positive samples.

Parameters:
Sample Sample to be classified
float OpenCLTemplate.MachineLearning.SVM.ClassificationValue ( TrainingUnit  Sample  ) 

Classifies a training unit with a float. The bigger, the more positive the sample. Values greater than zero are assumed to be positive samples.

Parameters:
Sample Sample to be classified
bool OpenCLTemplate.MachineLearning.SVM.Classify ( TrainingUnit  Sample  ) 

Classifies a training unit as positive or negative (true or false).

Parameters:
Sample Sample to be classified
bool OpenCLTemplate.MachineLearning.SVM.Classify ( TrainingUnit  Sample  ) 

Classifies a training unit as positive or negative (true or false).

Parameters:
Sample Sample to be classified
static void OpenCLTemplate.MachineLearning.SVM.CLcalculateAllKernels ( SVM  problemSolution  )  [static]

Computes All kernels and errors accelerating with OpenCL.

Parameters:
problemSolution Problem solution SVM
static void OpenCLTemplate.MachineLearning.SVM.CLcalculateAllKernels ( SVM  problemSolution  )  [static]

Computes All kernels and errors accelerating with OpenCL.

Parameters:
problemSolution Problem solution SVM
static float OpenCLTemplate.MachineLearning.SVM.CLpredictOutput ( SVM  problemSolution,
TrainingUnit  untrainedUnit 
) [static]

Predicts the output of a single entry, given a previous problem, solution and correspondent training set.

Parameters:
problemSolution Correspondent problem solution
untrainedUnit Input features from which the output will be predicted
Returns:
The y classification (true/false = positive/negative)
static float OpenCLTemplate.MachineLearning.SVM.CLpredictOutput ( SVM  problemSolution,
TrainingUnit  untrainedUnit 
) [static]

Predicts the output of a single entry, given a previous problem, solution and correspondent training set.

Parameters:
problemSolution Correspondent problem solution
untrainedUnit Input features from which the output will be predicted
Returns:
The y classification (true/false = positive/negative)
float OpenCLTemplate.MachineLearning.SVM.GetHitRate ( TrainingSet  samples  ) 

Computes hit rates for a given test set.

Parameters:
samples Test set to be used
float OpenCLTemplate.MachineLearning.SVM.GetHitRate ( TrainingSet  samples  ) 

Computes hit rates for a given test set.

Parameters:
samples Test set to be used
float OpenCLTemplate.MachineLearning.SVM.GetTrainingSetHitRate ( int  ind  ) 

Gets the percentage of training examples classified correctly starting from the ind-th training sample.

Parameters:
ind Index to start reading training set samples
float OpenCLTemplate.MachineLearning.SVM.GetTrainingSetHitRate (  ) 

Gets the percentage of training examples classified correctly in the training set.

float OpenCLTemplate.MachineLearning.SVM.GetTrainingSetHitRate ( int  ind  ) 

Gets the percentage of training examples classified correctly starting from the ind-th training sample.

Parameters:
ind Index to start reading training set samples
float OpenCLTemplate.MachineLearning.SVM.GetTrainingSetHitRate (  ) 

Gets the percentage of training examples classified correctly in the training set.

void OpenCLTemplate.MachineLearning.SVM.initializeWithZeros (  ) 

Set all values of the solution to 0.

void OpenCLTemplate.MachineLearning.SVM.initializeWithZeros (  ) 

Set all values of the solution to 0.

void OpenCLTemplate.MachineLearning.SVM.Load ( string  FileName  ) 

Copy all values from another solution.

Parameters:
FileName File containing alpha's data
void OpenCLTemplate.MachineLearning.SVM.Load ( string  FileName  ) 

Copy all values from another solution.

Parameters:
FileName File containing alpha's data
static float [] OpenCLTemplate.MachineLearning.SVM.MultiClassify ( SVM  svm,
CLCalc.Program.Image2D  Samples 
) [static]

Classifies multiple samples stored in OpenCL memory.

Parameters:
Samples Samples data to classify
svm SVM to use as classifier
static float [] OpenCLTemplate.MachineLearning.SVM.MultiClassify ( SVM  svm,
CLCalc.Program.Image2D  Samples 
) [static]

Classifies multiple samples stored in OpenCL memory.

Parameters:
Samples Samples data to classify
svm SVM to use as classifier
void OpenCLTemplate.MachineLearning.SVM.PreCalibrateCfg ( float  tolPositive,
float  tolNegative 
)

Attempts to pre-calibrate configuration parameters. Finds an alpha that enhances similarities between positive examples and reduces similarities between positive and negative examples. Assumes that decreasing lambda increases kernel match.

Parameters:
tolPositive Positive kernels average should be greater than tolPositive
tolNegative Negative kernels average should be lesser than tolNegative
void OpenCLTemplate.MachineLearning.SVM.PreCalibrateCfg ( float  tolPositive,
float  tolNegative 
)

Attempts to pre-calibrate configuration parameters. Finds an alpha that enhances similarities between positive examples and reduces similarities between positive and negative examples. Assumes that decreasing lambda increases kernel match.

Parameters:
tolPositive Positive kernels average should be greater than tolPositive
tolNegative Negative kernels average should be lesser than tolNegative
void OpenCLTemplate.MachineLearning.SVM.RemoveNonSupportVectors (  ) 

Removes all vectors that are not SVMs, ie, so that alpha[i]=0.

void OpenCLTemplate.MachineLearning.SVM.RemoveNonSupportVectors (  ) 

Removes all vectors that are not SVMs, ie, so that alpha[i]=0.

void OpenCLTemplate.MachineLearning.SVM.ResetSolution (  ) 

Resets current SVM solution.

void OpenCLTemplate.MachineLearning.SVM.ResetSolution (  ) 

Resets current SVM solution.

void OpenCLTemplate.MachineLearning.SVM.Save ( string  FileName  ) 

Writes current solution to a file.

void OpenCLTemplate.MachineLearning.SVM.Save ( string  FileName  ) 

Writes current solution to a file.

void OpenCLTemplate.MachineLearning.SVM.Train (  ) 

Trains current SVM.

void OpenCLTemplate.MachineLearning.SVM.Train (  ) 

Trains current SVM.

float OpenCLTemplate.MachineLearning.SVM.TrainWithCrossValidation ( float  CrossValidationSetPercent,
float[]  lambdaSet,
float[]  CSet 
)

Trains current SVM with cross-validation, adjusting kernel parameter lambda and box parameter C. Returns best performance so far.

Parameters:
CrossValidationSetPercent Percentage of training examples that should be used as cross validation set
lambdaSet Values of lambda to try
CSet Values of c to try
float OpenCLTemplate.MachineLearning.SVM.TrainWithCrossValidation (  ) 

Trains current SVM with cross-validation, adjusting kernel parameter lambda and box parameter C.

float OpenCLTemplate.MachineLearning.SVM.TrainWithCrossValidation ( float  CrossValidationSetPercent,
float[]  lambdaSet,
float[]  CSet 
)

Trains current SVM with cross-validation, adjusting kernel parameter lambda and box parameter C. Returns best performance so far.

Parameters:
CrossValidationSetPercent Percentage of training examples that should be used as cross validation set
lambdaSet Values of lambda to try
CSet Values of c to try
float OpenCLTemplate.MachineLearning.SVM.TrainWithCrossValidation (  ) 

Trains current SVM with cross-validation, adjusting kernel parameter lambda and box parameter C.


Member Data Documentation

Problem configuration.

Training set for this solution.

Generated on Sun Dec 4 17:27:04 2011 for OpenCLTemplate by  doxygen 1.6.3