Preamble
'ONE_VS_ONE' -> One versus One Coding. 'ONE_VS_ALL' -> One versus All Coding. 'DECOC' -> Discriminant Error Correcting. 'SUBDECOC' -> DECOC with subclasses. 'DENSE_RANDOM' -> Dense Random Coding. 'SPARSE_RANDOM' -> Sparse Random Coding. 'ECOC_ONE' -> ECOC One Coding. 'FOREST_ECOC' -> Forest ECOC. 'CUSTOM_CODING' -> Custom Coding.
'HAMMING' -> Hamming Decoding. 'EUCLIDEAN' -> Euclidean Decoding 'LAPLACIAN' -> Laplacian Decoding. 'HAMMING_ATTENUATED' -> Hamming Attenuated Decoding. 'EUCLIDEAN_ATTENUATED' -> Euclidean Attenuated Decoding. 'LINEAR_LOSS_WEIGHTED_DECODING' -> Linear Loss Weighted Decoding. 'EXPONENTIAL_LOSS_WEIGHTED_DECODING' -> Exponential Loss Weighted Decoding. 'LINEAR_LOSS_BASED_DECODING' -> Linear Loss Based Decoding. 'EXPONENTIAL_LOSS_BASED_DECODING' -> Exponential Loss Based Decoding. 'BETA_DENSITY_DECODING' -> Beta-density Decoding. 'PROBABILISTIC_BASED_DECODING' -> Probabilistic Based Decoding. 'INVERSE_HAMMING_DECODING' -> Inverse Hamming Decoding. 'CUSTOM_DECODING' -> Custom Decoding.
'NCC' -> Nearest Class Centroid Classifier. 'FLDA' -> Fisher Linear Discriminant Analysis Followed by NCC. 'SVM' -> LIBSVM's Support Vector Machine. 'ADABOOST' -> Discrete AdaBoost. 'LEAST_SQUARES' -> Sum of Least Error Squares Classifier. 'CUSTOM_CLASSIFIER' -> Custom Classifier.
'FQMI' -> Fast Quadratic Mutual Information. 'FLDR' -> Fisher's Linear Discriminant Ratio. 'CUSTOM_CRITERION' -> Custom Decomposition Criterion.
'PAIR' -> Add only pair of classes. 'ALL_CLASSES' -> Use SFFS to determine new binary problem.
u32 one_vs_one ( const mat& training_samples, const icolvec& training_labels, const mat& testing_samples, const icolvec& testing_labels, const int decoding_strategy, const int classifier_type, const bool verbose, ofstream& verbose_output, double& elapsed_time )
// matrix of training samples -- should be filled
mat training_samples;
// column vector of training labels -- should be filled
icolvec training_labels;
// matrix of test samples -- should be filled
mat testing_samples;
// column vector of test labels -- should be filled
icolvec testing_labels;
// type of decoding selected by user
const int decoding_strategy = HAMMING;
// type of classifier selected by user
const int classifier_type = NCC;
// execution time in seconds
double elapsed_time = 0.0;
// compute misclassified test samples
const u32 missed = one_vs_one
(
training_samples,
training_labels,
testing_samples,
testing_labels,
decoding_strategy,
classifier_type,
verbose,
verbose_output,
elapsed_time
);
double cvonesvsone ( const mat& samples, const icolvec& labels, const u32 n_folds, const u32 classifier_type, const int decoding_strategy, const bool verbose, ofstream& output, double& elapsed_time )
// matrix of training samples -- should be filled
mat training_samples;
// column vector of training labels -- should be filled and start from 1
// check auxiliary function for this
icolvec training_labels;
// matrix of test samples -- should be filled
mat testing_samples;
// column vector of test labels -- should be filled and start from 1
// check auxiliary function for this
icolvec testing_labels;
// type of decoding selected by user
const int decoding_strategy = HAMMING;
// type of classifier selected by user
const int classifier_type = NCC;
// execution time in seconds
double elapsed_time = 0.0;
// set number of folds
const u32 n_folds = 10;
// to be filled with the execution time
double elapsed_time = 0.0;
// compute 10 fold cross-validation error rate
const double error_rate = onevsonecv
(
samples,
labels,
n_folds,
decoding_strategy,
classifier_type,
verbose,
verbose_output,
elapsed_time
);
u32 one_vs_all ( const mat& training_samples, const icolvec& training_labels, const mat& testing_samples, const icolvec& testing_labels, const int decoding_strategy, const int classifier_type, const bool verbose, ofstream& verbose_output, double& elapsed_time )
// matrix of training samples -- should be filled
mat training_samples;
// column vector of training labels -- should be filled
icolvec training_labels;
// matrix of test samples -- should be filled
mat testing_samples;
// column vector of test labels -- should be filled
icolvec testing_labels;
// type of decoding selected by user
const int decoding_strategy = HAMMING;
// type of classifier selected by user
const int classifier_type = NCC;
// execution time in seconds
double elapsed_time = 0.0;
// compute misclassified test samples
const u32 missed = one_vs_all
(
training_samples,
training_labels,
testing_samples,
testing_labels,
decoding_strategy,
classifier_type,
verbose,
verbose_output,
elapsed_time
);
double cvonesvsall ( const mat& samples, const icolvec& labels, const u32 n_folds, const u32 classifier_type, const int decoding_strategy, const bool verbose, ofstream& output, double& elapsed_time )
// matrix of training samples -- should be filled
mat training_samples;
// column vector of training labels -- should be filled and start from 1
// check auxiliary function for this
icolvec training_labels;
// matrix of test samples -- should be filled
mat testing_samples;
// column vector of test labels -- should be filled and start from 1
// check auxiliary function for this
icolvec testing_labels;
// type of decoding selected by user
const int decoding_strategy = HAMMING;
// type of classifier selected by user
const int classifier_type = NCC;
// execution time in seconds
double elapsed_time = 0.0;
// set number of folds
const u32 n_folds = 10;
// to be filled with the execution time
double elapsed_time = 0.0;
// compute 10 fold cross-validation error rate
const double error_rate = onevsallcv
(
samples,
labels,
n_folds,
decoding_strategy,
classifier_type,
verbose,
verbose_output,
elapsed_time
);
u32 decoc ( const mat& training_samples, const icolvec& training_labels, const mat& testing_samples, const icolvec& testing_labels, const int decoding_strategy, const int classifier_type, const int criterion_option, const bool verbose, ofstream& verbose_output, double& elapsed_time )
// matrix of training samples -- should be filled
mat training_samples;
// column vector of training labels -- should be filled
icolvec training_labels;
// matrix of test samples -- should be filled
mat testing_samples;
// column vector of test labels -- should be filled
icolvec testing_labels;
// type of decoding selected by user
const int decoding_strategy = HAMMING;
// type of classifier selected by user
const int classifier_type = NCC;
// type of decomposition criterion
const int criterion_option = FLDR;
// execution time in seconds
double elapsed_time = 0.0;
// compute misclassified test samples
const u32 missed = decoc
(
training_samples,
training_labels,
testing_samples,
testing_labels,
decoding_strategy,
classifier_type,
criterion_option,
verbose,
verbose_output,
elapsed_time
);
double cvdecoc ( const mat& samples, const icolvec& labels, const u32 n_folds, const u32 classifier_type, const int decoding_strategy, const u32 criterion_option, const bool verbose, ofstream& output, double& elapsed_time )
// matrix of training samples -- should be filled
mat training_samples;
// column vector of training labels -- should be filled and start from 1
// check auxiliary function for this
icolvec training_labels;
// matrix of test samples -- should be filled
mat testing_samples;
// column vector of test labels -- should be filled and start from 1
// check auxiliary function for this
icolvec testing_labels;
// type of decoding selected by user
const int decoding_strategy = HAMMING;
// type of classifier selected by user
const int classifier_type = NCC;
// type of decomposition criterion selected by user
const int criterion_option = FLDR;
// execution time in seconds
double elapsed_time = 0.0;
// set number of folds
const u32 n_folds = 10;
// to be filled with the execution time
double elapsed_time = 0.0;
// compute 10 fold cross-validation error rate
const double error_rate = cvdecoc
(
samples,
labels,
n_folds,
decoding_strategy,
classifier_type,
criterion_option,
verbose,
verbose_output,
elapsed_time
);
u32 subdecoc ( const mat& training_samples, const icolvec& training_labels, const mat& testing_samples, const icolvec& testing_labels, const Threshold& thres, const int decoding_strategy, const int classifier_type, const int criterion_option, const bool verbose, imat& coding_matrix, ofstream& verbose_output, double& elapsed_time )
// matrix of training samples -- should be filled
mat training_samples;
// column vector of training labels -- should be filled
icolvec training_labels;
// matrix of test samples -- should be filled
mat testing_samples;
// column vector of test labels -- should be filled
icolvec testing_labels;
// set thresholds
// 1st argument performance, 2nd argument minimum cluster size, 3rd
// argument minimum improvement
Threshold thres(0,2,1);
// type of decoding selected by user
const int decoding_strategy = HAMMING;
// type of classifier selected by user
const int classifier_type = NCC;
// type of decomposition criterion
const int criterion_option = FLDR;
// execution time in seconds
double elapsed_time = 0.0;
// output stream -- redirect accordingly
ofstream verbose_output;
// compute misclassified test samples
const u32 missed = subdecoc
(
training_samples,
training_labels,
testing_samples,
testing_labels,
thres,
decoding_strategy,
classifier_type,
criterion_option,
verbose,
verbose_output,
elapsed_time
);
double cvsubdecoc ( const mat& samples, const icolvec& labels, const u32 n_folds, const u32 classifier_type, const int decoding_strategy, const u32 criterion_option, const Threshold& thres, const bool verbose, double& mr, double& mc, ofstream& output, double& elapsed_time )
// matrix of training samples -- should be filled
mat training_samples;
// column vector of training labels -- should be filled and start from 1
// check auxiliary function for this
icolvec training_labels;
// matrix of test samples -- should be filled
mat testing_samples;
// column vector of test labels -- should be filled and start from 1
// check auxiliary function for this
icolvec testing_labels;
// set thresholds
// 1st argument performance, 2nd argument minimum cluster size, 3rd
// argument minimum improvement
Threshold thres(0,2,1);
// type of decoding selected by user
const int decoding_strategy = HAMMING;
// type of classifier selected by user
const int classifier_type = NCC;
// type of decomposition criterion selected by user
const int criterion_option = FLDR;
// execution time in seconds
double elapsed_time = 0.0;
// set number of folds
const u32 n_folds = 10;
// to be filled with the execution time
double elapsed_time = 0.0;
// mean number of rows
double mr = 0.0;
// mean number of columns
double mc = 0.0;
// compute 10 fold cross-validation error rate
const double error_rate = cvsubdecoc
(
samples,
labels,
n_folds,
decoding_strategy,
classifier_type,
criterion_option,
thres,
verbose,
mr,
mc,
verbose_output,
elapsed_time
);
u32 dense_random_ecoc() ( const mat& training_samples, const icolvec& training_labels, const mat& testing_samples, const icolvec& testing_labels, const int decoding_strategy, const int classifier_type, const u32 n_matrices, const u32 n_desired_classifiers, const bool verbose, ofstream& verbose_output, double& elapsed_time )
// matrix of training samples -- should be filled
mat training_samples;
// column vector of training labels -- should be filled
icolvec training_labels;
// matrix of test samples -- should be filled
mat testing_samples;
// column vector of test labels -- should be filled
icolvec testing_labels;
// type of decoding selected by user
const int decoding_strategy = HAMMING;
// type of classifier selected by user
const int classifier_type = NCC;
// number of matrices to be formed
const int n_matrices = 100;
// number of classifiers to be formed
const int n_desired_classifiers = 3;
// execution time in seconds
double elapsed_time = 0.0;
// compute misclassified test samples
const u32 missed = dense_random_ecoc
(
training_samples,
training_labels,
testing_samples,
testing_labels,
decoding_strategy,
classifier_type,
n_matrices,
n_desired_classifiers,
verbose,
verbose_output,
elapsed_time
);
double cvdenserand ( const mat& samples, const icolvec& labels, const u32 n_folds, const u32 classifier_type, const int decoding_strategy, const u32 n_matrices, const u32 n_desired_classifers, const bool verbose, ofstream& output, double& elapsed_time )
// matrix of training samples -- should be filled
mat training_samples;
// column vector of training labels -- should be filled and start from 1
// check auxiliary function for this
icolvec training_labels;
// matrix of test samples -- should be filled
mat testing_samples;
// column vector of test labels -- should be filled and start from 1
// check auxiliary function for this
icolvec testing_labels;
// type of decoding selected by user
const int decoding_strategy = HAMMING;
// type of classifier selected by user
const int classifier_type = NCC;
// execution time in seconds
double elapsed_time = 0.0;
// set number of folds
const u32 n_folds = 10;
// number of matrices to be formed
const u32 n_matrices = 100;
// number of classifiers to be formed
const u32 n_desired_classifiers = 3;
// to be filled with the execution time
double elapsed_time = 0.0;
// compute 10 fold cross-validation error rate
const double error_rate = cvdenserand
(
samples,
labels,
n_folds,
classifier_type,
decoding_strategy,
n_matrices,
n_desired_classifiers,
verbose,
verbose_output,
elapsed_time
);
u32 sparse_random_ecoc() ( const mat& training_samples, const icolvec& training_labels, const mat& testing_samples, const icolvec& testing_labels, const int decoding_strategy, const int classifier_type, const u32 n_matrices, const u32 n_desired_classifiers, const bool verbose, ofstream& verbose_output, double& elapsed_time )
// matrix of training samples -- should be filled
mat training_samples;
// column vector of training labels -- should be filled
icolvec training_labels;
// matrix of test samples -- should be filled
mat testing_samples;
// column vector of test labels -- should be filled
icolvec testing_labels;
// type of decoding selected by user
const int decoding_strategy = HAMMING;
// type of classifier selected by user
const int classifier_type = NCC;
// number of matrices to be formed
const int n_matrices = 100;
// number of classifiers to be formed
const int n_desired_classifiers = 3;
// execution time in seconds
double elapsed_time = 0.0;
// compute misclassified test samples
const u32 missed = sparse_random_ecoc
(
training_samples,
training_labels,
testing_samples,
testing_labels,
decoding_strategy,
classifier_type,
n_matrices,
n_desired_classifiers,
verbose,
verbose_output,
elapsed_time
);
double cvsparserand ( const mat& samples, const icolvec& labels, const u32 n_folds, const u32 classifier_type, const int decoding_strategy, const u32 n_matrices, const u32 n_desired_classifers, const bool verbose, ofstream& output, double& elapsed_time )
// matrix of training samples -- should be filled
mat training_samples;
// column vector of training labels -- should be filled and start from 1
// check auxiliary function for this
icolvec training_labels;
// matrix of test samples -- should be filled
mat testing_samples;
// column vector of test labels -- should be filled and start from 1
// check auxiliary function for this
icolvec testing_labels;
// type of decoding selected by user
const int decoding_strategy = HAMMING;
// type of classifier selected by user
const int classifier_type = NCC;
// execution time in seconds
double elapsed_time = 0.0;
// set number of folds
const u32 n_folds = 10;
// number of matrices to be formed
const u32 n_matrices = 100;
// number of classifiers to be formed
const u32 n_desired_classifiers = 3;
// to be filled with the execution time
double elapsed_time = 0.0;
// compute 10 fold cross-validation error rate
const double error_rate = cvsparserand
(
samples,
labels,
n_folds,
classifier_type,
decoding_strategy,
n_matrices,
n_desired_classifiers,
verbose,
verbose_output,
elapsed_time
);
u32 ecoc_one ( const mat& training_samples, const icolvec& training_labels, const mat& testing_samples, const icolvec& testing_labels, const Threshold& thres, const int decoding_strategy, const int classifier_type, const int criterion_option, const u32 n_matrices, const u32 n_desired_classifiers, const double validation, const int init_coding_strategy, const int ecocone_mode, const u32 max_iter, const double epsilon, const double wv, const bool verbose, ofstream& verbose_output, double& elapsed_time )
// matrix of training samples -- should be filled
mat training_samples;
// column vector of training labels -- should be filled
icolvec training_labels;
// matrix of test samples -- should be filled
mat testing_samples;
// column vector of test labels -- should be filled
icolvec testing_labels;
// set thresholds
// 1st argument performance, 2nd argument minimum cluster size, 3rd
// argument minimum improvement
Threshold thres(0,2,1);
// type of decoding selected by user
const int decoding_strategy = HAMMING;
// type of classifier selected by user
const int classifier_type = NCC;
// type of decomposition criterion
const int criterion_option = FLDR;
// initial coding strategy
const int init_coding_strategy = SUBDECOC;
// validation percentage in [0,1]
const double validation = 0.3;
// ECOC One mode
const u32 ecocone_mode = PAIR;
// maximum number of columns
const u32 max_iter = 10;
// epsilon tolerance
const double epsilon = 0.03;
// validation error weight in [0,1]
const double wv = 0.2;
// dummies since initial coding strategy isn't random
const double n_matrices = 0;
const double n_desired_classifiers = 0;
// execution time in seconds
double elapsed_time = 0.0;
// output stream -- redirect accordingly
ofstream verbose_output;
// compute misclassified test samples
const u32 missed = ecoc_one
(
training_samples,
training_labels,
testing_samples,
testing_labels,
thres,
decoding_strategy,
classifier_type,
criterion_option,
n_matrices,
n_desired_classifiers,
validation,
init_coding_strategy,
ecocone_mode,
max_iter,
epsilon,
wv,
verbose,
verbose_output,
elapsed_time
);
double cvecocone ( const mat& samples, const icolvec& labels, const u32 n_folds, const u32 classifier_type, const int decoding_strategy, const u32 criterion_option, const Threshold& thres, const u32 n_matrices, const u32 n_desired_classifiers, const double validation, const int init_coding_strategy, const int ecocone_mode, const u32 max_iter, const double epsilon, const double wv, const bool verbose, ofstream& output, double& elapsed_time )
// matrix of training samples -- should be filled
mat training_samples;
// column vector of training labels -- should be filled and start from 1
// check auxiliary function for this
icolvec training_labels;
// matrix of test samples -- should be filled
mat testing_samples;
// column vector of test labels -- should be filled and start from 1
// check auxiliary function for this
icolvec testing_labels;
// set thresholds
// 1st argument performance, 2nd argument minimum cluster size, 3rd
// argument minimum improvement
Threshold thres(0,2,1);
// type of decoding selected by user
const int decoding_strategy = HAMMING;
// type of classifier selected by user
const int classifier_type = NCC;
// type of decomposition criterion selected by user
const int criterion_option = FLDR;
// initial coding strategy
const int init_coding_strategy = SUBDECOC;
// validation percentage in [0,1]
const double validation = 0.3;
// ECOC One mode
const u32 ecocone_mode = PAIR;
// maximum number of columns
const u32 max_iter = 10;
// epsilon tolerance
const double epsilon = 0.03;
// validation error weight in [0,1]
const double wv = 0.2;
// dummies since init coding strategy isn't random
const double n_matrices = 0;
const double n_desired_classifiers = 0;
// execution time in seconds
double elapsed_time = 0.0;
// set number of folds
const u32 n_folds = 10;
// to be filled with the execution time
double elapsed_time = 0.0;
// compute 10 fold cross-validation error rate
const double error_rate = cvsubdecoc
(
samples,
labels,
n_folds,
decoding_strategy,
classifier_type,
criterion_option,
thres,
n_matrices,
n_desired_classifiers,
validation,
init_coding_strategy,
ecocone_mode,
max_iter,
epsilon,
wv,
verbose,
verbose_output,
elapsed_time
);
u32 forest_ecoc ( const mat& training_samples, const icolvec& training_labels, const mat& testing_samples, const icolvec& testing_labels, const int decoding_strategy, const int classifier_type, const int criterion_option, const u32 n_forests, const bool verbose, ofstream& verbose_output, double& elapsed_time )
// matrix of training samples -- should be filled
mat training_samples;
// column vector of training labels -- should be filled
icolvec training_labels;
// matrix of test samples -- should be filled
mat testing_samples;
// column vector of test labels -- should be filled
icolvec testing_labels;
// type of decoding selected by user
const int decoding_strategy = HAMMING;
// type of classifier selected by user
const int classifier_type = NCC;
// type of decomposition criterion
const int criterion_option = FLDR;
// execution time in seconds
double elapsed_time = 0.0;
// output stream -- redirect accordingly
ofstream verbose_output;
// maximum number of trees
const u32 n_forests = 3;
// compute misclassified test samples
const u32 missed = forest_ecoc
(
training_samples,
training_labels,
testing_samples,
testing_labels,
decoding_strategy,
classifier_type,
criterion_option,
n_forests,
verbose,
verbose_output,
elapsed_time
);
double cvforest ( const mat& samples, const icolvec& labels, const u32 n_folds, const u32 classifier_type, const int decoding_strategy, const u32 criterion_option, const u32 n_forests, const bool verbose, ofstream& output, double& elapsed_time )
// matrix of training samples -- should be filled
mat training_samples;
// column vector of training labels -- should be filled and start from 1
// check auxiliary function for this
icolvec training_labels;
// matrix of test samples -- should be filled
mat testing_samples;
// column vector of test labels -- should be filled and start from 1
// check auxiliary function for this
icolvec testing_labels;
// type of decoding selected by user
const int decoding_strategy = HAMMING;
// type of classifier selected by user
const int classifier_type = NCC;
// type of decomposition criterion selected by user
const int criterion_option = FLDR;
// execution time in seconds
double elapsed_time = 0.0;
// set number of folds
const u32 n_folds = 10;
// to be filled with the execution time
double elapsed_time = 0.0;
// maximum number of trees
const u32 n_forests = 3;
// compute 10 fold cross-validation error rate
const double error_rate = cvforest
(
samples,
labels,
n_folds,
decoding_strategy,
classifier_type,
criterion_option,
n_forests,
verbose,
verbose_output,
elapsed_time
);
custom_coding ( const mat& training_samples, const icolvec& training_labels, const mat& testing_samples, const icolvec& testing_labels, const imat& coding_matrix, const int decoding_strategy, const int classifier_type, const bool verbose, ofstream& verbose_output, double& elapsed_time )
// matrix of training samples -- should be filled
mat training_samples;
// column vector of training labels -- should be filled
icolvec training_labels;
// matrix of test samples -- should be filled
mat testing_samples;
// column vector of test labels -- should be filled
icolvec testing_labels;
// custom coding matrix -- should be filled
imat coding_matrix;
// type of decoding selected by user
const int decoding_strategy = HAMMING;
// type of classifier selected by user
const int classifier_type = NCC;
// execution time in seconds
double elapsed_time = 0.0;
// output stream -- redirect accordingly
ofstream verbose_output;
// compute misclassified test samples
const u32 missed = custom_coding
(
training_samples,
training_labels,
testing_samples,
testing_labels,
coding_matrix,
decoding_strategy,
classifier_type,
verbose,
verbose_output,
elapsed_time
);
double cvcustom ( const mat& samples, const icolvec& labels, const u32 n_folds, const u32 classifier_type, const int decoding_strategy, const imat& coding_matrix, const bool verbose, ofstream& output, double& elapsed_time )
// matrix of training samples -- should be filled
mat training_samples;
// column vector of training labels -- should be filled and start from 1
// check auxiliary function for this
icolvec training_labels;
// matrix of test samples -- should be filled
mat testing_samples;
// column vector of test labels -- should be filled and start from 1
// check auxiliary function for this
icolvec testing_labels;
// user defined coding matrix -- should be filled
imat coding_matrix;
// type of decoding selected by user
const int decoding_strategy = HAMMING;
// type of classifier selected by user
const int classifier_type = NCC;
// type of decomposition criterion selected by user
const int criterion_option = FLDR;
// execution time in seconds
double elapsed_time = 0.0;
// set number of folds
const u32 n_folds = 10;
// to be filled with the execution time
double elapsed_time = 0.0;
// compute 10 fold cross-validation error rate
const double error_rate = cvcustom
(
samples,
labels,
n_folds,
decoding_strategy,
classifier_type,
criterion_option,
codin_matrix,
verbose,
verbose_output,
elapsed_time
);
param.svm_type -> can take the value C_SVC for classification SVM or NU_SVC for nuSVM.
param.kernel_type -> defines the SVM's kernel type, can take the values LINEAR, POLY, RBF,
SIGMOID, PRECOMPUTED.
param.degree -> Integral value defines the kernel degree in case kernel type is POLY.
param.coef0 -> Real valued coefficient in case kernel type is SIGMOID.
param.nu -> nu in case NU_SVC.
param.C -> Cost parameter.
param.gamma -> Real valued gamma parameter in case kernel type RBF.
Example:
param.svm_type = C_SVC;
param.kernel_type = RBF;
param.degree = 3; // no need to set it since kernel type is RBF
param.coef0 = 0; // no need to set it since kernel type is RBF
param.nu = 0.5 // no need to set it since SVM type is C_SVC
param.C = 100.0;
param.gamma = 0.3;
For more options see LIBSVM code.
param.degree -> Sets the maximum number of weak classifiers when AdaBoost classifier is
in use.
Example:
param.degree = 10;
param.C -> Sets the regularization parameter when Sum of Error Squares classifier is in use.Example:
param.C = 0.1;
// create a random 5 x 5 matrix // (uniform distribution in [0,1]) mat A = randu<mat>(5,5); // access element at second row // and third column of A double x = A(1,2); // matrix addition mat B = A + A; // matrix multiplication mat C = A * B; // matrix element wise multiplication mat D = A % B; // fill B with zeros B.zeros(); // allocate size for B B.set_size(10,10); // set B to 5 rows 6 columns matrix // set with zeros B.zeros(5,6); // fixed size matrices: mat::fixed<5,6> F; F.ones(); // fill F with ones
| irowvec | = | Row<s32> |
| urowvec | = | Row<u32> |
| rowvec | = | Row<double> |
| icolvec | = | Col<s32> |
| ucolvec | = | Col<u32> |
| colvec | = | Col<double> |
colvec x(10); colvec y = zeros<colvec>(10,1); mat A = randu<mat>(10,10); // extract a column vector colvec z = A.col(5); rowvec x(10); rowvec y = zeros<mat>(1,10); mat A = randu<mat>(10,10); // extract a row vector rowvec z = A.row(5);