-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathParameters.h
52 lines (40 loc) · 1.18 KB
/
Parameters.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
/*
* Parameters.h
*
* Created on: Apr 6, 2014
* Author: yuanz
*/
#ifndef PARAMETERS_H_
#define PARAMETERS_H_
#include <vector>
#include "Options.h"
#include "DependencyInstance.h"
#include "util/FeatureVector.h"
#include "FeatureExtractor.h"
namespace segparser {
using namespace std;
class FeatureExtractor;
class Parameters {
public:
vector<double> parameters;
vector<double> total;
int size;
Parameters(int size, Options* options);
virtual ~Parameters();
void copyParams(Parameters* param);
void averageParams(double avVal);
void update(DependencyInstance* gold, DependencyInstance* pred,
FeatureVector* diffFv, double loss, FeatureExtractor* fe, int upd);
double getScore(FeatureVector* fv);
void writeParams(FILE* fs);
void readParams(FILE* fs);
double elementError(WordInstance& gold, WordInstance& pred, int segid);
double wordError(WordInstance& gold, WordInstance& pred);
double wordDepError(WordInstance& gold, WordInstance& pred);
private:
Options* options;
int maxMatch(SegInstance& gold, SegInstance& pred, vector<int>& match);
double numError(DependencyInstance* gold, DependencyInstance* pred);
};
} /* namespace segparser */
#endif /* PARAMETERS_H_ */