Classes | Macros | Typedefs | Functions | Variables
svm.cpp File Reference
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <float.h>
#include <string.h>
#include <stdarg.h>
#include <limits.h>
#include <locale.h>
#include <assert.h>
#include "svm.h"
#include <iostream>
Include dependency graph for svm.cpp:

Go to the source code of this file.

Classes

class  Cache
 
struct  decision_function
 
struct  Cache::head_t
 
class  Kernel
 
class  ONE_CLASS_Q
 
class  QMatrix
 
struct  Solver::SolutionInfo
 
class  Solver
 
class  Solver_NU
 
class  SVC_Q
 
class  SVR_Q
 

Macros

#define INF   HUGE_VAL
 
#define Malloc(type, n)   (type *)malloc((n)*sizeof(type))
 
#define TAU   1e-12
 

Typedefs

typedef float Qfloat
 
typedef signed char schar
 

Functions

template<class S , class T >
static void clone (T *&dst, S *src, int n)
 
static void info (const char *fmt,...)
 
double k_function (const svm_node *x, const svm_node *y, const svm_parameter &param)
 
template<class T >
static T max (T x, T y)
 
template<class T >
static T min (T x, T y)
 
static void multiclass_probability (int k, double **r, double *p)
 
static double powi (double base, int times)
 
static void print_string_stdout (const char *s)
 
static char * readline (FILE *input)
 
static void remove_zero_weight (svm_problem *newprob, const svm_problem *prob)
 
static double sigmoid_predict (double decision_value, double A, double B)
 
static void sigmoid_train (int l, const double *dec_values, const double *labels, double &A, double &B)
 
static void solve_c_svc (const svm_problem *prob, const svm_parameter *param, double *alpha, Solver::SolutionInfo *si, double Cp, double Cn)
 
static void solve_epsilon_svr (const svm_problem *prob, const svm_parameter *param, double *alpha, Solver::SolutionInfo *si)
 
static void solve_nu_svc (const svm_problem *prob, const svm_parameter *param, double *alpha, Solver::SolutionInfo *si)
 
static void solve_nu_svr (const svm_problem *prob, const svm_parameter *param, double *alpha, Solver::SolutionInfo *si)
 
static void solve_one_class (const svm_problem *prob, const svm_parameter *param, double *alpha, Solver::SolutionInfo *si)
 
static void svm_binary_svc_probability (const svm_problem *prob, const svm_parameter *param, double Cp, double Cn, double &probA, double &probB)
 
const char * svm_check_parameter (const svm_problem *prob, const svm_parameter *param)
 
int svm_check_probability_model (const svm_model *model)
 
void svm_cross_validation (const svm_problem *prob, const svm_parameter *param, int nr_fold, double *target)
 
void svm_destroy_param (svm_parameter *param)
 
void svm_free_and_destroy_model (svm_model **model_ptr_ptr)
 
void svm_free_model_content (svm_model *model_ptr)
 
void svm_get_labels (const svm_model *model, int *label)
 
int svm_get_nr_class (const svm_model *model)
 
int svm_get_nr_sv (const svm_model *model)
 
void svm_get_sv_indices (const svm_model *model, int *indices)
 
int svm_get_svm_type (const svm_model *model)
 
double svm_get_svr_probability (const svm_model *model)
 
static void svm_group_classes (const svm_problem *prob, int *nr_class_ret, int **label_ret, int **start_ret, int **count_ret, int *perm)
 
double svm_hyper_w_normsqr_twoclass (const struct svm_model *model)
 
svm_modelsvm_load_model (const char *model_file_name)
 
double svm_predict (const svm_model *model, const svm_node *x)
 
double svm_predict_probability (const svm_model *model, const svm_node *x, double *prob_estimates)
 
double svm_predict_values (const svm_model *model, const svm_node *x, double *dec_values)
 
double svm_predict_values_twoclass (const struct svm_model *model, const struct svm_node *x)
 
int svm_save_model (const char *model_file_name, const svm_model *model)
 
void svm_set_print_string_function (void(*print_func)(const char *))
 
static double svm_svr_probability (const svm_problem *prob, const svm_parameter *param)
 
svm_modelsvm_train (const svm_problem *prob, const svm_parameter *param)
 
static decision_function svm_train_one (const svm_problem *prob, const svm_parameter *param, double Cp, double Cn)
 
template<class T >
static void swap (T &x, T &y)
 

Variables

static const char * kernel_type_table []
 
int libsvm_version = LIBSVM_VERSION
 
static char * line = NULL
 
static int max_line_len
 
static void(* svm_print_string )(const char *) = &print_string_stdout
 
static const char * svm_type_table []
 

Macro Definition Documentation

◆ INF

#define INF   HUGE_VAL

Definition at line 71 of file svm.cpp.

◆ Malloc

#define Malloc (   type,
 
)    (type *)malloc((n)*sizeof(type))

Definition at line 73 of file svm.cpp.

◆ TAU

#define TAU   1e-12

Definition at line 72 of file svm.cpp.

Typedef Documentation

◆ Qfloat

typedef float Qfloat

Definition at line 46 of file svm.cpp.

◆ schar

typedef signed char schar

Definition at line 47 of file svm.cpp.

Function Documentation

◆ clone()

template<class S , class T >
static void clone ( T *&  dst,
S *  src,
int  n 
)
inlinestatic

Definition at line 55 of file svm.cpp.

◆ info()

static void info ( const char *  fmt,
  ... 
)
static

Definition at line 92 of file svm.cpp.

◆ k_function()

double k_function ( const svm_node x,
const svm_node y,
const svm_parameter param 
)

Definition at line 289 of file svm.cpp.

◆ max()

template<class T >
static T max ( x,
y 
)
inlinestatic

Definition at line 52 of file svm.cpp.

◆ min()

template<class T >
static T min ( x,
y 
)
inlinestatic

Definition at line 49 of file svm.cpp.

◆ multiclass_probability()

static void multiclass_probability ( int  k,
double **  r,
double *  p 
)
static

Definition at line 1921 of file svm.cpp.

◆ powi()

static double powi ( double  base,
int  times 
)
inlinestatic

Definition at line 60 of file svm.cpp.

◆ print_string_stdout()

static void print_string_stdout ( const char *  s)
static

Definition at line 75 of file svm.cpp.

◆ readline()

static char* readline ( FILE *  input)
static

Definition at line 2905 of file svm.cpp.

◆ remove_zero_weight()

static void remove_zero_weight ( svm_problem newprob,
const svm_problem prob 
)
static

Definition at line 2170 of file svm.cpp.

◆ sigmoid_predict()

static double sigmoid_predict ( double  decision_value,
double  A,
double  B 
)
static

Definition at line 1910 of file svm.cpp.

◆ sigmoid_train()

static void sigmoid_train ( int  l,
const double *  dec_values,
const double *  labels,
double &  A,
double &  B 
)
static

Definition at line 1797 of file svm.cpp.

◆ solve_c_svc()

static void solve_c_svc ( const svm_problem prob,
const svm_parameter param,
double *  alpha,
Solver::SolutionInfo si,
double  Cp,
double  Cn 
)
static

Definition at line 1482 of file svm.cpp.

◆ solve_epsilon_svr()

static void solve_epsilon_svr ( const svm_problem prob,
const svm_parameter param,
double *  alpha,
Solver::SolutionInfo si 
)
static

Definition at line 1637 of file svm.cpp.

◆ solve_nu_svc()

static void solve_nu_svc ( const svm_problem prob,
const svm_parameter param,
double *  alpha,
Solver::SolutionInfo si 
)
static

Definition at line 1531 of file svm.cpp.

◆ solve_nu_svr()

static void solve_nu_svr ( const svm_problem prob,
const svm_parameter param,
double *  alpha,
Solver::SolutionInfo si 
)
static

Definition at line 1677 of file svm.cpp.

◆ solve_one_class()

static void solve_one_class ( const svm_problem prob,
const svm_parameter param,
double *  alpha,
Solver::SolutionInfo si 
)
static

Definition at line 1594 of file svm.cpp.

◆ svm_binary_svc_probability()

static void svm_binary_svc_probability ( const svm_problem prob,
const svm_parameter param,
double  Cp,
double  Cn,
double &  probA,
double &  probB 
)
static

Definition at line 1985 of file svm.cpp.

◆ svm_check_parameter()

const char* svm_check_parameter ( const svm_problem prob,
const svm_parameter param 
)

Definition at line 3186 of file svm.cpp.

◆ svm_check_probability_model()

int svm_check_probability_model ( const svm_model model)

Definition at line 3307 of file svm.cpp.

◆ svm_cross_validation()

void svm_cross_validation ( const svm_problem prob,
const svm_parameter param,
int  nr_fold,
double *  target 
)

Definition at line 2461 of file svm.cpp.

◆ svm_destroy_param()

void svm_destroy_param ( svm_parameter param)

Definition at line 3180 of file svm.cpp.

◆ svm_free_and_destroy_model()

void svm_free_and_destroy_model ( svm_model **  model_ptr_ptr)

Definition at line 3170 of file svm.cpp.

◆ svm_free_model_content()

void svm_free_model_content ( svm_model model_ptr)

Definition at line 3138 of file svm.cpp.

◆ svm_get_labels()

void svm_get_labels ( const svm_model model,
int *  label 
)

Definition at line 2591 of file svm.cpp.

◆ svm_get_nr_class()

int svm_get_nr_class ( const svm_model model)

Definition at line 2586 of file svm.cpp.

◆ svm_get_nr_sv()

int svm_get_nr_sv ( const svm_model model)

Definition at line 2605 of file svm.cpp.

◆ svm_get_sv_indices()

void svm_get_sv_indices ( const svm_model model,
int *  indices 
)

Definition at line 2598 of file svm.cpp.

◆ svm_get_svm_type()

int svm_get_svm_type ( const svm_model model)

Definition at line 2581 of file svm.cpp.

◆ svm_get_svr_probability()

double svm_get_svr_probability ( const svm_model model)

Definition at line 2610 of file svm.cpp.

◆ svm_group_classes()

static void svm_group_classes ( const svm_problem prob,
int *  nr_class_ret,
int **  label_ret,
int **  start_ret,
int **  count_ret,
int *  perm 
)
static

Definition at line 2110 of file svm.cpp.

◆ svm_hyper_w_normsqr_twoclass()

double svm_hyper_w_normsqr_twoclass ( const struct svm_model model)

Definition at line 2622 of file svm.cpp.

◆ svm_load_model()

svm_model* svm_load_model ( const char *  model_file_name)

Definition at line 2923 of file svm.cpp.

◆ svm_predict()

double svm_predict ( const svm_model model,
const svm_node x 
)

Definition at line 2744 of file svm.cpp.

◆ svm_predict_probability()

double svm_predict_probability ( const svm_model model,
const svm_node x,
double *  prob_estimates 
)

Definition at line 2759 of file svm.cpp.

◆ svm_predict_values()

double svm_predict_values ( const svm_model model,
const svm_node x,
double *  dec_values 
)

Definition at line 2668 of file svm.cpp.

◆ svm_predict_values_twoclass()

double svm_predict_values_twoclass ( const struct svm_model model,
const struct svm_node x 
)

Definition at line 2643 of file svm.cpp.

◆ svm_save_model()

int svm_save_model ( const char *  model_file_name,
const svm_model model 
)

Definition at line 2808 of file svm.cpp.

◆ svm_set_print_string_function()

void svm_set_print_string_function ( void(*)(const char *)  print_func)

Definition at line 3315 of file svm.cpp.

◆ svm_svr_probability()

static double svm_svr_probability ( const svm_problem prob,
const svm_parameter param 
)
static

Definition at line 2076 of file svm.cpp.

◆ svm_train()

svm_model* svm_train ( const svm_problem prob,
const svm_parameter param 
)

Definition at line 2196 of file svm.cpp.

◆ svm_train_one()

static decision_function svm_train_one ( const svm_problem prob,
const svm_parameter param,
double  Cp,
double  Cn 
)
static

Definition at line 1732 of file svm.cpp.

◆ swap()

template<class T >
static void swap ( T &  x,
T &  y 
)
inlinestatic

Definition at line 54 of file svm.cpp.

Variable Documentation

◆ kernel_type_table

const char* kernel_type_table[]
static
Initial value:
=
{
"linear","polynomial","rbf","sigmoid","precomputed",NULL
}

Definition at line 2803 of file svm.cpp.

◆ libsvm_version

int libsvm_version = LIBSVM_VERSION

Definition at line 45 of file svm.cpp.

◆ line

char* line = NULL
static

Definition at line 2902 of file svm.cpp.

◆ max_line_len

int max_line_len
static

Definition at line 2903 of file svm.cpp.

◆ svm_print_string

void(* svm_print_string) (const char *) = &print_string_stdout
static

Definition at line 80 of file svm.cpp.

◆ svm_type_table

const char* svm_type_table[]
static
Initial value:
=
{
"c_svc","nu_svc","one_class","epsilon_svr","nu_svr",NULL
}

Definition at line 2798 of file svm.cpp.



fcl
Author(s):
autogenerated on Tue Dec 5 2023 03:40:50