⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cusvm.h

📁 CU SVM Classifier Matlab Toolbox
💻 H
字号:
struct svm_node
{
	int index;
	double value;
};

struct svm_problem
{
	int l;
	double *y;
	struct svm_node **x;
	//int nr_class;
	int nr_binary;
	//int *label;
	//int *count;
	//int *index;
	int **I;
};

struct svm_parameter
{
	int svm_type;
	int kernel_type;
	double degree;	/* for poly */
	double gamma;	/* for poly/rbf/sigmoid */
	double coef0;	/* for poly/sigmoid */

	/* these are for training only */
	double cache_size; /* in MB */
	double eps;	/* stopping criteria */
	double C;	/* for C_SVC, EPSILON_SVR and NU_SVR */
	int nr_weight;		/* for C_SVC */
	int *weight_label;	/* for C_SVC */
	double* weight;		/* for C_SVC */
	int multiclass_type;
	double nu;	/* for NU_SVC, ONE_CLASS, and NU_SVR */
	double p;	/* for EPSILON_SVR */
	int shrinking;	/* use the shrinking heuristics */
	int probability; /* do probability estimates */
};

struct svm_model
{
	svm_parameter param;	// parameter
	int nr_class;		// number of classes, = 2 in regression/one class svm
	int nr_binary;		// number of binary SVMs
	int **I;                // I matrix for different multiclass types
	int l;			// total #SV
	svm_node **SV;		// SVs (SV[l])
	double **sv_coef;	// coefficients for SVs in decision functions
	int **sv_ind;	        // index of SVs
	double *rho;		// constants in decision functions (rho[n*(n-1)/2])
	double *probA;          // pariwise probability information
	double *probB;

	
	// for classification only

	int *label;		// label of each class (label[n])
	int *nSV;		// number of SVs for each class (nSV[n])
				// nSV[0] + nSV[1] + ... + nSV[n-1] = l
	int *nSV_binary;		// number of SVs for each binary SVM
	// XXX
	int free_sv;		// 1 if svm_model is created by svm_load_model
				// 0 if svm_model is created by svm_train
};

struct svm_data_input
{
	int m; //dimension of training vectors
	int n; //total number of training samples
    double *labels;
	double *samples;
};

/*struct svm_model_input
{
	double *params;
	double *rhos;
	int *labels;
	double *probA;
	double *probB;
	int *nSV;
	double *sv_coef;
	double *SV;
};
*/
struct svm_model_input
{
	double *params;
	double *rhos;
	int *labels;
	double *probA;
	double *probB;
	int *nSV;
	int *nSV_binary;
	int *sv_ind;
	int *I;
	double *sv_coef;
	double *SV;
};

extern "C" __declspec(dllexport) void SVM_Train(struct svm_data_input input, struct svm_parameter param, char *filename, double *cross);
extern "C" __declspec(dllexport) void SVM_Test(struct svm_data_input input, struct svm_model_input mod, double *params, double *predlabel, double *predvalue);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -