LIBML  Version 3.2.4
LIBML DSP Software Library
Macros | Functions
SVM Functions

Macros

#define EXP2F_TABLE_BITS   5
 SVM rbf prediction. More...
 
#define EXP2F_POLY_ORDER   3
 
#define N   (1 << EXP2F_TABLE_BITS)
 
#define N   (1 << EXP2F_TABLE_BITS)
 
#define InvLn2N   __exp2f_data.invln2_scaled
 
#define T   __exp2f_data.tab
 
#define C   __exp2f_data.poly_scaled
 

Functions

void tpt_svm_linear_init_f32 (tpt_svm_linear_f32_t *aSVM, uint32_t nbOfSupportVectors, uint32_t vectorDimension, f32_t intercept, const f32_t *dualCoefficients, const f32_t *supportVectors, const int32_t *classes)
 SVM linear instance init function. More...
 
void tpt_svm_linear_predict_f32 (int32_t *aResult, const tpt_svm_linear_f32_t *aSVM, const f32_t *aInData)
 SVM linear prediction. More...
 
void tpt_svm_polynomial_init_f32 (tpt_svm_polynomial_f32_t *aSVM, uint32_t nbOfSupportVectors, uint32_t vectorDimension, f32_t intercept, const f32_t *dualCoefficients, const f32_t *supportVectors, const int32_t *classes, int32_t degree, f32_t coef0, f32_t gamma)
 SVM polynomial instance init function. More...
 
void tpt_svm_polynomial_predict_f32 (int32_t *aResult, const tpt_svm_polynomial_f32_t *aSVM, const f32_t *aInData)
 SVM polynomial prediction. More...
 
void tpt_svm_rbf_init_f32 (tpt_svm_rbf_f32_t *aSVM, uint32_t nbOfSupportVectors, uint32_t vectorDimension, f32_t intercept, const f32_t *dualCoefficients, const f32_t *supportVectors, const int32_t *classes, f32_t gamma)
 SVM radial basis function instance init function. More...
 
static uint32_t top12 (f32_t x)
 
static f32_t _expf_ (f32_t x)
 
void tpt_svm_rbf_predict_f32 (int32_t *aResult, const tpt_svm_rbf_f32_t *aSVM, const f32_t *aInData)
 SVM rbf prediction. More...
 
void tpt_svm_sigmoid_init_f32 (tpt_svm_sigmoid_f32_t *aSVM, uint32_t nbOfSupportVectors, uint32_t vectorDimension, f32_t intercept, const f32_t *dualCoefficients, const f32_t *supportVectors, const int32_t *classes, f32_t coef0, f32_t gamma)
 SVM sigmoid instance init function. More...
 
void tpt_svm_sigmoid_predict_f32 (int32_t *aResult, const tpt_svm_sigmoid_f32_t *aSVM, const f32_t *aInData)
 SVM sigmoid prediction. More...
 

Detailed Description

This set of functions is implementing SVM classification on 2 classes. The training must be done from scikit-learn. The parameters can be easily generated from the scikit-learn object.

If more than 2 classes are needed, the functions in this folder will have to be used, as building blocks, to do multi-class classification.

No multi-class classification is provided in this SVM folder.

Macro Definition Documentation

◆ C

#define C   __exp2f_data.poly_scaled

◆ EXP2F_POLY_ORDER

#define EXP2F_POLY_ORDER   3

◆ EXP2F_TABLE_BITS

#define EXP2F_TABLE_BITS   5

SVM rbf prediction.

Parameters
[out]aResultdecision value
[in]aSVMPointer to an instance of the rbf SVM structure.
[in]aInDataPointer to input vector
Returns
none.

◆ InvLn2N

#define InvLn2N   __exp2f_data.invln2_scaled

◆ N [1/2]

#define N   (1 << EXP2F_TABLE_BITS)

◆ N [2/2]

#define N   (1 << EXP2F_TABLE_BITS)

◆ T

#define T   __exp2f_data.tab

Function Documentation

◆ _expf_()

static f32_t _expf_ ( f32_t  x)
inlinestatic

◆ top12()

static uint32_t top12 ( f32_t  x)
inlinestatic

◆ tpt_svm_linear_init_f32()

void tpt_svm_linear_init_f32 ( tpt_svm_linear_f32_t aSVM,
uint32_t  nbOfSupportVectors,
uint32_t  vectorDimension,
f32_t  intercept,
const f32_t dualCoefficients,
const f32_t supportVectors,
const int32_t *  classes 
)

SVM linear instance init function.

Classes are integer used as output of the function (instead of having -1, 1 as class values).

Parameters
[in]aSVMPointer to an instance of the linear SVM structure.
[in]nbOfSupportVectorsNumber of support vectors
[in]vectorDimensionDimension of vector space
[in]interceptIntercept
[in]dualCoefficientsArray of dual coefficients
[in]supportVectorsArray of support vectors
[in]classesArray of 2 classes ID
Returns
none.

◆ tpt_svm_linear_predict_f32()

void tpt_svm_linear_predict_f32 ( int32_t *  aResult,
const tpt_svm_linear_f32_t aSVM,
const f32_t aInData 
)

SVM linear prediction.

Parameters
[out]aResultDecision value
[in]aSVMPointer to an instance of the linear SVM structure.
[in]aInDataPointer to input vector
Returns
none.

◆ tpt_svm_polynomial_init_f32()

void tpt_svm_polynomial_init_f32 ( tpt_svm_polynomial_f32_t aSVM,
uint32_t  nbOfSupportVectors,
uint32_t  vectorDimension,
f32_t  intercept,
const f32_t dualCoefficients,
const f32_t supportVectors,
const int32_t *  classes,
int32_t  degree,
f32_t  coef0,
f32_t  gamma 
)

SVM polynomial instance init function.

Classes are integer used as output of the function (instead of having -1, 1 as class values).

Parameters
[in]aSVMpoints to an instance of the polynomial SVM structure.
[in]nbOfSupportVectorsNumber of support vectors
[in]vectorDimensionDimension of vector space
[in]interceptIntercept
[in]dualCoefficientsArray of dual coefficients
[in]supportVectorsArray of support vectors
[in]classesArray of 2 classes ID
[in]degreePolynomial degree
[in]coef0coeff0 (scikit-learn terminology)
[in]gammagamma (scikit-learn terminology)
Returns
none.

◆ tpt_svm_polynomial_predict_f32()

void tpt_svm_polynomial_predict_f32 ( int32_t *  aResult,
const tpt_svm_polynomial_f32_t aSVM,
const f32_t aInData 
)

SVM polynomial prediction.

Parameters
[out]aResultDecision value
[in]aSVMPointer to an instance of the polynomial SVM structure.
[in]aInDataPointer to input vector
Returns
none.

◆ tpt_svm_rbf_init_f32()

void tpt_svm_rbf_init_f32 ( tpt_svm_rbf_f32_t aSVM,
uint32_t  nbOfSupportVectors,
uint32_t  vectorDimension,
f32_t  intercept,
const f32_t dualCoefficients,
const f32_t supportVectors,
const int32_t *  classes,
f32_t  gamma 
)

SVM radial basis function instance init function.

Classes are integer used as output of the function (instead of having -1, 1 as class values).

Parameters
[in]aSVMpoints to an instance of the rbf SVM structure.
[in]nbOfSupportVectorsNumber of support vectors
[in]vectorDimensionDimension of vector space
[in]interceptIntercept
[in]dualCoefficientsArray of dual coefficients
[in]supportVectorsArray of support vectors
[in]classesArray of 2 classes ID
[in]gammagamma (scikit-learn terminology)
Returns
none.

◆ tpt_svm_rbf_predict_f32()

void tpt_svm_rbf_predict_f32 ( int32_t *  aResult,
const tpt_svm_rbf_f32_t aSVM,
const f32_t aInData 
)

SVM rbf prediction.

Parameters
[out]aResultdecision value
[in]aSVMPointer to an instance of the rbf SVM structure.
[in]aInDataPointer to input vector
Returns
none.

◆ tpt_svm_sigmoid_init_f32()

void tpt_svm_sigmoid_init_f32 ( tpt_svm_sigmoid_f32_t aSVM,
uint32_t  nbOfSupportVectors,
uint32_t  vectorDimension,
f32_t  intercept,
const f32_t dualCoefficients,
const f32_t supportVectors,
const int32_t *  classes,
f32_t  coef0,
f32_t  gamma 
)

SVM sigmoid instance init function.

Classes are integer used as output of the function (instead of having -1, 1 as class values).

Parameters
[in]aSVMpoints to an instance of the sigmoid SVM structure.
[in]nbOfSupportVectorsNumber of support vectors
[in]vectorDimensionDimension of vector space
[in]interceptIntercept
[in]dualCoefficientsArray of dual coefficients
[in]supportVectorsArray of support vectors
[in]classesArray of 2 classes ID
[in]coef0coeff0 (scikit-learn terminology)
[in]gammagamma (scikit-learn terminology)
Returns
none.

◆ tpt_svm_sigmoid_predict_f32()

void tpt_svm_sigmoid_predict_f32 ( int32_t *  aResult,
const tpt_svm_sigmoid_f32_t aSVM,
const f32_t aInData 
)

SVM sigmoid prediction.

Parameters
[out]aResultDecision value
[in]aSVMPointer to an instance of the sigmoid SVM structure.
[in]aInDataPointer to input vector
Returns
none.