-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathSimplexTest.cc
210 lines (156 loc) · 7.68 KB
/
SimplexTest.cc
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
// Test simplex algorithm
#include "TestCommon.h"
int main () {
// Declare DataFrames to hold file and computed output
SimplexValues S;
DataFrame< double > cppOutput;
DataFrame< double > pyOutput;
//----------------------------------------------------------
// Simplex prediction on block_3sp data : No dynamic embedding
//----------------------------------------------------------
pyOutput = DataFrame < double >("./data/","Smplx_embd_block_3sp_pyEDM.csv");
// Generate cpp output
S = Simplex ( "../data/", "block_3sp.csv",
"./data/", "Smplx_embd_block_3sp_cppEDM.csv",
"1 99","100 198", 3, 1, 0, -1, 0,
"x_t y_t z_t", "x_t", true, false, false );
cppOutput = S.predictions;
// Comparison
MakeTest ( "Simplex: block_3sp.csv embedded data",
pyOutput, cppOutput );
//----------------------------------------------------------
// Simplex prediction with dynamically embedded data
//----------------------------------------------------------
pyOutput = DataFrame < double > ("./data/","Smplx_E3_block_3sp_pyEDM.csv");
// Generate cpp output
S = Simplex ( "../data/", "block_3sp.csv",
"./data/", "Smplx_E3_block_3sp_cppEDM.csv",
"1 100", "101 195", 3, 1, 0, -1, 0,
"x_t", "x_t", false, false, false );
cppOutput = S.predictions;
// Comparison
MakeTest ( "Simplex: block_3sp.csv dynamic embedding",
pyOutput, cppOutput );
//-------------------------------------------------------------------
// Simplex prediction with dynamically embedded data and ISO Datetime
//-------------------------------------------------------------------
pyOutput = DataFrame < double > ("./data/","Smplx_S12CD_E3_pyEDM.csv");
// Generate cpp output
S = Simplex ( "../data/", "S12CD-S333-SumFlow_1980-2005.csv",
"./data/", "Smplx_S12CD_E3_cppEDM.csv",
"1 800", "801 1375", 3, 1, 0, -1, 0,
"S12.C.D.S333", "S12.C.D.S333", false, false, false );
cppOutput = S.predictions;
cppOutput.MaxRowPrint() = 5; // Set number of rows to print
// std::cout << cppOutput; // ISO datetime in Time column
MakeTest ( "Simplex: S12CD-S333 ISO datetime", pyOutput, cppOutput );
//----------------------------------------------------------
// Simplex Ties
//----------------------------------------------------------
pyOutput = DataFrame < double > ("./data/","Smplx_ties_valid.csv");
// Generate cpp output
S = Simplex ( "./data/", "tie.csv",
"./data/", "Smplx_ties_cppEDM.csv",
"1 10", "1 10", 1, 1, 0, -1, 0,
"ts", "ts", false, false, false );
cppOutput = S.predictions;
// Comparison
MakeTest ( "Simplex: neighbor ties", pyOutput, cppOutput );
//----------------------------------------------------------
// Simplex Ties 2
//----------------------------------------------------------
pyOutput = DataFrame < double > ("./data/","Smplx_ties2_valid.csv");
// Generate cpp output
S = Simplex ( "./data/", "tserr.csv",
"./data/", "Smplx_ties2_cppEDM.csv",
"1 100", "10 15", 1, 1, 0, -1, 0,
"ts", "ts", false, false, false );
cppOutput = S.predictions;
// Comparison
MakeTest ( "Simplex: neighbor ties 2", pyOutput, cppOutput );
//----------------------------------------------------------
// Simplex negative Tp
//----------------------------------------------------------
pyOutput = DataFrame < double > ("./data/","ts_negTp_valid.csv");
// Generate cpp output
S = Simplex ( "./data/", "ts_negtp.csv",
"./data/", "ts_negtp_cppEDM.csv",
"1 100", "81 85", 2, -1, 0, -1, 0,
"ts", "ts", false, false, false );
cppOutput = S.predictions;
// Comparison
MakeTest ( "Simplex: negative Tp 1", pyOutput, cppOutput );
//----------------------------------------------------------
// Simplex negative Tp Takens embedded = false
//----------------------------------------------------------
pyOutput = DataFrame < double > ("./data/","negTp_takens_valid.csv");
// Generate cpp output
S = Simplex ( "./data/", "small_data.csv",
"./data/", "negTp_takens_cppEDM.csv",
"1 12", "1 12", 2, -1, 0, -1, 0,
"x", "x", false, false, false );
cppOutput = S.predictions;
// Comparison
MakeTest ( "Simplex: negative Tp Takens", pyOutput, cppOutput );
//----------------------------------------------------------
// Simplex negative Tp Takens embedded = true
//----------------------------------------------------------
pyOutput = DataFrame < double > ("./data/","negTp_embedded_valid.csv");
// Generate cpp output
S = Simplex ( "./data/", "small_data.csv",
"./data/", "negTp_embedded_cppEDM.csv",
"1 12", "1 12", 0, -1, 0, -1, 0,
"x y", "x", true, false, false );
cppOutput = S.predictions;
// Comparison
MakeTest ( "Simplex: negative Tp embedded", pyOutput, cppOutput );
//----------------------------------------------------------
// Simplex disjoint lib embedded = true
//----------------------------------------------------------
pyOutput = DataFrame < double > ("./data/","Smplx_disjointLib_valid.csv");
// Generate cpp output
S = Simplex ( "./data/", "small_data.csv",
"./data/", "Smplx_disjointLib_cppEDM.csv",
"1 3 6 12", "1 12", 0, 1, 0, -1, 0,
"x y", "x", true, false, false );
cppOutput = S.predictions;
// Comparison
MakeTest ( "Simplex: disjoint library", pyOutput, cppOutput );
//----------------------------------------------------------
// Simplex disjoint lib 2 embedded = true
//----------------------------------------------------------
pyOutput = DataFrame < double > ("./data/","Smplx_disjointLib2_valid.csv");
// Generate cpp output
S = Simplex ( "./data/", "block_ts50.csv",
"./data/", "Smplx_disjointLib2_cppEDM.csv",
"1 20 31 50", "1 20", 0, 1, 0, -1, 0,
"x_t x_tp", "x_t", true, false, false );
cppOutput = S.predictions;
// Comparison
MakeTest ( "Simplex: disjoint library 2", pyOutput, cppOutput );
//----------------------------------------------------------
// Simplex disjoint lib 3 embedded = false
//----------------------------------------------------------
pyOutput = DataFrame < double > ("./data/","Smplx_disjointLib3_valid.csv");
// Generate cpp output
S = Simplex ( "./data/", "ts_gene_2.csv",
"./data/", "Smplx_disjointLib3_cppEDM.csv",
"1 57 58 108", "49 65", 5, 1, 0, -1, 0,
"ts", "ts", false, false, false );
cppOutput = S.predictions;
// Comparison
MakeTest ( "Simplex: disjoint library 3", pyOutput, cppOutput );
//----------------------------------------------------------
// Simplex column names with spaces
// NOTE: ',' in columns or target ignores whitespace
//----------------------------------------------------------
pyOutput = DataFrame < double > ("./data/","columnNameSpace_valid.csv");
// Generate cpp output
S = Simplex ( "./data/", "columnNameSpace.csv",
"./data/", "columnNameSpace_cppEDM.csv",
"1 80", "81 100", 5, 1, 0, -1, 0,
"Var 5 1,", "Var 2,", false, false, false );
cppOutput = S.predictions;
// Comparison
MakeTest ( "Simplex: column name space", pyOutput, cppOutput );
}