-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCETest.cc
103 lines (83 loc) · 4.25 KB
/
CETest.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
// Test conditional embedding functionality
#include <iostream>
#include <string>
#include "TestCommon.h"
int main() {
DataFrame < double > circleData( "../data/", "circle.csv" );
size_t num_rows = circleData.NRows();
//-------------------------------------------------------------------
// Test of CE validLib as all true... should be no change
//-------------------------------------------------------------------
std::vector<bool> valid_lib( num_rows, true );
auto fullLib = Simplex ( "../data/", "block_3sp.csv", "./data/", "",
"1 99","100 198", 3, 1, 0, -1, 0,
"x_t y_t z_t", "x_t", true, false, false );
auto CELib = Simplex ( "../data/", "block_3sp.csv", "./data/", "",
"1 99","100 198", 3, 1, 0, -1, 0,
"x_t y_t z_t", "x_t", true, false, false,
valid_lib );
// Should PASS
MakeTest ( "Simplex: CE full valid",
fullLib.predictions, CELib.predictions );
// Test of CE validLib as all true... should be no change
SMapValues fullSMap = SMap ( circleData, "./data/", "",
"1 100", "101 198", 2, 1, 0, -1, 4, 0,
"x y", "x", "", "",
true, false, false );
SMapValues CESMap = SMap ( circleData, "./data/", "",
"1 100", "101 198", 2, 1, 0, -1, 4, 0,
"x y", "x", "", "",
true, false, false, valid_lib );
// Should PASS
MakeTest ( "SMap: CE full valid", fullSMap.predictions, CESMap.predictions );
//-------------------------------------------------------------------
// Remove validLib rows. valid_lib [0:9] = true
//-------------------------------------------------------------------
for( int i = 10; i < num_rows; i++ ) {
valid_lib[i] = false;
}
//-------------------------------------------------------------------
// Limit lib to the same as valid_lib *** NOTE: lib = "1 11"
// since valid_lib [0:9] equates to lib = "1 10", but... Tp = 1
// means the 10th lib row is skipped.
//-------------------------------------------------------------------
auto partLib = Simplex ( "../data/", "block_3sp.csv", "./data/", "",
"1 11","100 198", 3, 1, 0, -1, 0,
"x_t y_t z_t", "x_t", true, false, false );
// Run with valid_lib that is 0-9
CELib = Simplex ( "../data/", "block_3sp.csv", "./data/", "",
"1 99","100 198", 3, 1, 0, -1, 0,
"x_t y_t z_t", "x_t", true, false, false,
valid_lib );
// Should PASS
MakeTest ( "Simplex: CE partial valid",
CELib.predictions, partLib.predictions );
//-------------------------------------------------------------
// CE SMap *** NOTE: lib = "1 11" for Tp = 1, valid_lib [0:9]
//-------------------------------------------------------------
SMapValues SMapPart = SMap ( circleData, "./data/", "",
"1 11", "101 198", 2, 1, 0, -1, 4, 0,
"x y", "x", "", "",
true, false, false, valid_lib );
// Run with valid_lib that is 0-9
CESMap = SMap ( circleData, "./data/", "",
"1 100", "101 198", 2, 1, 0, -1, 4, 0,
"x y", "x", "CELib_Smap_circle_coef.csv", "",
true, false, false, valid_lib );
// Should PASS
MakeTest ( "SMap: CE partial valid",
CELib.predictions, partLib.predictions );
#ifdef RUN_ALL
// Should be no differences in coefficients
auto coefficients1 = SMapPart.coefficients.VectorColumnName( "C0" );
auto coefficients2 = CESMap.coefficients.VectorColumnName ( "C0" );
std::cout << std::endl << "SMap: Partial library coefficients C0:\n\t";
for ( auto i = 90; i < 99; i++ ) {
std::cout << coefficients1[ i ] << " ";
}
std::cout << std::endl << "SMap: CE library coefficients C0:\n\t";
for ( auto i = 90; i < 99; i++ ) {
std::cout << coefficients2[ i ] << " ";
} std::cout << std::endl;
#endif
}