-
Notifications
You must be signed in to change notification settings - Fork 2
/
svm_struct_api.h
executable file
·79 lines (75 loc) · 4.09 KB
/
svm_struct_api.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/***********************************************************************/
/* */
/* svm_struct_api.h */
/* */
/* Definition of API for attaching implementing SVM learning of */
/* structures (e.g. parsing, multi-label classification, HMM) */
/* */
/* Author: Thorsten Joachims */
/* Date: 03.07.04 */
/* */
/* Copyright (c) 2004 Thorsten Joachims - All rights reserved */
/* */
/* This software is available for non-commercial use only. It must */
/* not be modified and distributed without prior permission of the */
/* author. The author is not responsible for implications from the */
/* use of this software. */
/* */
/***********************************************************************/
#include "svm_struct_api_types.h"
#include "svm_struct/svm_struct_common.h"
#ifndef svm_struct_api
#define svm_struct_api
void svm_struct_learn_api_init(int argc, char* argv[]);
void svm_struct_learn_api_exit();
void svm_struct_classify_api_init(int argc, char* argv[]);
void svm_struct_classify_api_exit();
SAMPLE read_struct_examples(char *file, STRUCT_LEARN_PARM *sparm);
SAMPLE read_struct_examples_matlab(char *file, STRUCT_LEARN_PARM *sparm, double* label, double* , float* feature, int nSample, int nFeature);
void init_struct_model(SAMPLE sample, STRUCTMODEL *sm,
STRUCT_LEARN_PARM *sparm, LEARN_PARM *lparm,
KERNEL_PARM *kparm);
CONSTSET init_struct_constraints(SAMPLE sample, STRUCTMODEL *sm,
STRUCT_LEARN_PARM *sparm);
LABEL find_most_violated_constraint_slackrescaling(PATTERN x, LABEL y,
STRUCTMODEL *sm,
STRUCT_LEARN_PARM *sparm);
LABEL find_most_violated_constraint_marginrescaling(PATTERN x, LABEL y,
STRUCTMODEL *sm,
STRUCT_LEARN_PARM *sparm);
LABEL classify_struct_example(PATTERN x, STRUCTMODEL *sm,
STRUCT_LEARN_PARM *sparm);
int empty_label(LABEL y);
SVECTOR *psi(PATTERN x, LABEL y, STRUCTMODEL *sm,
STRUCT_LEARN_PARM *sparm);
double loss(LABEL y, LABEL ybar, STRUCT_LEARN_PARM *sparm);
int finalize_iteration(double ceps, int cached_constraint,
SAMPLE sample, STRUCTMODEL *sm,
CONSTSET cset, double *alpha,
STRUCT_LEARN_PARM *sparm);
void print_struct_learning_stats(SAMPLE sample, STRUCTMODEL *sm,
CONSTSET cset, double *alpha,
STRUCT_LEARN_PARM *sparm);
void print_struct_testing_stats(SAMPLE sample, STRUCTMODEL *sm,
STRUCT_LEARN_PARM *sparm,
STRUCT_TEST_STATS *teststats);
void eval_prediction(long exnum, EXAMPLE ex, LABEL prediction,
STRUCTMODEL *sm, STRUCT_LEARN_PARM *sparm,
STRUCT_TEST_STATS *teststats);
void write_struct_model(char *file,STRUCTMODEL *sm,
STRUCT_LEARN_PARM *sparm);
STRUCTMODEL read_struct_model(char *file, STRUCT_LEARN_PARM *sparm);
void write_label(FILE *fp, LABEL y);
void free_pattern(PATTERN x);
void free_label(LABEL y);
void free_struct_model(STRUCTMODEL sm);
void free_struct_sample(SAMPLE s);
void print_struct_help();
void parse_struct_parameters(STRUCT_LEARN_PARM *sparm);
void print_struct_help_classify();
void parse_struct_parameters_classify(STRUCT_LEARN_PARM *sparm);
void svm_learn_struct_joint_custom(SAMPLE sample,
STRUCT_LEARN_PARM *sparm,
LEARN_PARM *lparm, KERNEL_PARM *kparm,
STRUCTMODEL *sm);
#endif