bsvm.h

来自「留一模型选择法leave-one-out model selection」· C头文件 代码 · 共 77 行

H
77
字号
#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 + =
减小字号Ctrl + -
显示快捷键?