-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathperceptron.h
74 lines (49 loc) · 1.73 KB
/
perceptron.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
/*
* File: perceptron.h
* Author: husnusensoy
*
* Created on April 27, 2014, 2:51 PM
*/
#ifndef PERCEPTRON_H
#define PERCEPTRON_H
#include "mkl.h"
#include "datastructure.h"
#include "debug.h"
#include "corpus.h"
#include "dependency.h"
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
/**
*
* NONE: No budgeting at all
* RANDOMIZED: Choose one randomly out of hypothesis vector with alpha value equal to 1.
*/
enum BudgetMethod{
NONE,
RANDOMIZED
};
KernelPerceptron create_PolynomialKernelPerceptron(int power, float bias);
KernelPerceptron create_RBFKernelPerceptron(float lambda) ;
void update_alpha(KernelPerceptron kp, uint32_t sidx, uint16_t from, uint16_t to, FeaturedSentence sent, float inc);
void update_average_alpha(KernelPerceptron kp);
void train_once_KernelPerceptronModel(KernelPerceptron mdl, const CoNLLCorpus corpus, int max_rec);
/**
*
* @param mdl KernelPerceptron model
* @param corpus Corpus to be parsed
* @param use_temp_weight Whether to use averaged weights or the raw (use_temp_weight=true) ones
* @param gold_ofp Dump the parsed sentences with gold parent estimations into a file if gold_ofp != NULL
* @param model_ofp Dump the parsed sentences with model parent estimations into a file if model_ofp != NULL
* @return ParserTestMetric struct
*/
ParserTestMetric test_KernelPerceptronModel(void *mdl, const CoNLLCorpus corpus, bool use_temp_weight, FILE *gold_ofp, FILE *model_ofp);
void mark_best_KernelPerceptronModel(KernelPerceptron kmodel, int numit);
void dump_KernelPerceptronModel(FILE *fp, KernelPerceptron kp);
KernelPerceptron load_KernelPerceptronModel(FILE *fp);
PerceptronModel load_PerceptronModel(FILE *fp);
#endif /* PERCEPTRON_H */