📄 bsvm.h
字号:
#include <stdio.h>#include <stdlib.h>/* constant */#ifndef __BSVM_H__#define __BSVM_H__#define LINEAR_KERNEL 0#define POLY_KERNEL 1#define RBF_KERNEL 2#define TANH_KERNEL 3#define MINQPSIZE 2#define MAXQPSIZE 2000#define EPSILON_A 0#define ZERO EPSILON_A#define COST (svm_param.C - EPSILON_A)#define MAXLEN 16384/* type */typedef struct feature{ /* num:value */ double value; int num;} feature_t;typedef struct sample{ /* a -- class v -- feature vector twonorm_sq -- (|feature_vector|_2)^2 */ double twonorm_sq; int a; feature_t *v; } sample_t;typedef struct svm_param{ /* veclen -- length of feature vector */ double C, epsilon; int cachesize, qpsize, verbosity, veclen;} svm_param_t;typedef struct kernel_param{ double degree; double coef0; double gamma; int ktype;} kernel_param_t;/* min 0.5*x'*Q*x - e'*xsubject to 0 <= x <= C len(x) = n */typedef struct bound_constrained_quadratic_program{ double C; int n; double *x, *Q, *p; } BQP;/* function */extern void solvebqp(BQP);void free_bsvm();void initialize_bsvm();int read_dataset(FILE*);void output_model(FILE*, int, double*, kernel_param_t*);void clear_cache();#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -