Rosetta Utilities  2014.35
Classes | Macros | Typedefs | Functions | Variables
Svm.cc 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 <iostream>
#include <cassert>
#include "Svm.hh"

Classes

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

Macros

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

Typedefs

typedef float Qfloat
 
typedef signed char schar
 

Functions

template<class T >
static T min (T x, T y)
 
template<class T >
static T max (T x, T y)
 
template<class T >
static void swap (T &x, T &y)
 
template<class S , class T >
static void clone (T *&dst, S *src, int n)
 
static double powi (double base, int times)
 
static void print_string_stdout (const char *s)
 
static void info (const char *fmt,...)
 
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_nu_svc (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 solve_epsilon_svr (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 decision_function svm_train_one (const svm_problem *prob, const svm_parameter *param, double Cp, double Cn)
 
static void sigmoid_train (int l, const double *dec_values, const double *labels, double &A, double &B)
 
static double sigmoid_predict (double decision_value, double A, double B)
 
static void multiclass_probability (int k, double **r, double *p)
 
static void svm_binary_svc_probability (const svm_problem *prob, const svm_parameter *param, double Cp, double Cn, double &probA, double &probB)
 
static double svm_svr_probability (const svm_problem *prob, const svm_parameter *param)
 
static void svm_group_classes (const svm_problem *prob, int *nr_class_ret, int **label_ret, int **start_ret, int **count_ret, int *perm)
 
svm_modelsvm_train (const svm_problem *prob, const svm_parameter *param)
 
void svm_cross_validation (const svm_problem *prob, const svm_parameter *param, int nr_fold, double *target)
 
int svm_get_svm_type (const svm_model *model)
 
int svm_get_nr_class (const svm_model *model)
 
void svm_get_labels (const svm_model *model, int *label)
 
void svm_get_sv_indices (const svm_model *model, int *indices)
 
int svm_get_nr_sv (const svm_model *model)
 
double svm_get_svr_probability (const svm_model *model)
 
double svm_predict_values (const svm_model *model, const svm_node *x, double *dec_values)
 
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)
 
int svm_save_model (const char *model_file_name, const svm_model *model)
 
static char * readline (FILE *input)
 
svm_modelsvm_load_model (const char *model_file_name)
 
void svm_free_model_content (svm_model *model_ptr)
 
void svm_free_and_destroy_model (svm_model **model_ptr_ptr)
 
void svm_destroy_param (svm_parameter *param)
 
const char * svm_check_parameter (const svm_problem *prob, const svm_parameter *param)
 
int svm_check_probability_model (const svm_model *model)
 
void svm_set_print_string_function (void(*print_func)(const char *))
 

Variables

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

Macro Definition Documentation

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

Typedef Documentation

typedef signed char schar

Function Documentation

template<class S , class T >
static void clone ( T *&  dst,
S *  src,
int  n 
)
inlinestatic
static void info ( const char *  fmt,
  ... 
)
static
template<class T >
static T max ( x,
y 
)
inlinestatic
template<class T >
static T min ( x,
y 
)
inlinestatic
static void multiclass_probability ( int  k,
double **  r,
double p 
)
static
static double powi ( double  base,
int  times 
)
inlinestatic
static void print_string_stdout ( const char *  s)
static
static char* readline ( FILE *  input)
static

References line.

Referenced by svm_load_model().

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

Referenced by svm_predict_probability().

static void sigmoid_train ( int  l,
const double dec_values,
const double labels,
double A,
double B 
)
static
static void solve_c_svc ( const svm_problem prob,
const svm_parameter param,
double alpha,
Solver::SolutionInfo si,
double  Cp,
double  Cn 
)
static
static void solve_epsilon_svr ( const svm_problem prob,
const svm_parameter param,
double alpha,
Solver::SolutionInfo si 
)
static
static void solve_nu_svc ( const svm_problem prob,
const svm_parameter param,
double alpha,
Solver::SolutionInfo si 
)
static
static void solve_nu_svr ( const svm_problem prob,
const svm_parameter param,
double alpha,
Solver::SolutionInfo si 
)
static
static void solve_one_class ( const svm_problem prob,
const svm_parameter param,
double alpha,
Solver::SolutionInfo si 
)
static
static void svm_binary_svc_probability ( const svm_problem prob,
const svm_parameter param,
double  Cp,
double  Cn,
double probA,
double probB 
)
static
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)

References svm_model::l.

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 
)
static
svm_model* svm_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 
)
int svm_save_model ( const char *  model_file_name,
const svm_model model 
)
void svm_set_print_string_function ( void(*)(const char *)  print_func)
static double svm_svr_probability ( const svm_problem prob,
const svm_parameter param 
)
static
svm_model* svm_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 
)
static
template<class T >
static void swap ( T &  x,
T &  y 
)
inlinestatic

Variable Documentation

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

Referenced by svm_load_model(), and svm_save_model().

int libsvm_version = LIBSVM_VERSION
char* line = NULL
static
int max_line_len
static
void(* svm_print_string)(const char *) = &print_string_stdout
static
const char* svm_type_table[]
static
Initial value:
=
{
"c_svc","nu_svc","one_class","epsilon_svr","nu_svr",NULL
}

Referenced by svm_load_model(), and svm_save_model().