-
Notifications
You must be signed in to change notification settings - Fork 1
/
validator.h
59 lines (48 loc) · 1.81 KB
/
validator.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
#ifndef DSL_VALIDATOR_H
#define DSL_VALIDATOR_H
// {{SMILE_PUBLIC_HEADER}}
class DSL_progress;
class DSL_em;
class DSL_network;
class DSL_dataset;
struct DSL_datasetWriteParams;
struct DSL_datasetMatch;
#include <vector>
class DSL_validator
{
public:
DSL_validator(
DSL_dataset& ds, const DSL_network &net,
const std::vector<DSL_datasetMatch> &matching,
const std::vector<int> *fixedNodes = 0);
int AddClassNode(int classNodeHandle);
int Test(DSL_progress *progress = 0);
int KFold(DSL_em &em, int foldCount, int randSeed = 0, DSL_progress *progress = 0);
int LeaveOneOut(DSL_em &em, DSL_progress *progress = 0);
int GetPosteriors(int classNodeHandle, int recordIndex, std::vector<double> &posteriors) const;
int GetAccuracy(int classNodeHandle, int outcome, double &acc) const;
int GetConfusionMatrix(int classNodeHandle, std::vector<std::vector<int> > &matrix) const;
int GetPredictedOutcome(int classNodeHandle, int recordIndex) const;
int GetPredictedNode(int recordIndex) const;
int GetPredictedNodeIndex(int recordIndex) const;
int GetFoldIndex(int recordIndex) const;
void GetResultDataset(DSL_dataset &output) const;
private:
int InitOutput();
int InstantiateRecord(DSL_network &net, int recordIndex);
int GetClassNodeIndex(int nodeHandle) const;
int GetPosteriorsPosition(int classNodeIndex, int recordIndex) const;
int GetOutcomeCount(int classNodeIndex) const;
int Predict(int classNodeIndex, int recordIndex) const;
const DSL_network &origNet;
DSL_dataset &ds;
std::vector<DSL_datasetMatch> matching;
std::vector<int> fixedNodes;
std::vector<int> classNodes;
std::vector<int> posteriorPos;
std::vector<int> folds;
int posteriorsPerRecord;
std::vector<double> posteriors;
std::vector<std::vector<std::vector<int> > > results;
};
#endif