-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathSMapTest.cc
85 lines (65 loc) · 3.25 KB
/
SMapTest.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
// SMap test
#include "TestCommon.h"
int main () {
//---------------------------------------------------------
// test smap with simple circle test
// embedded = true
//---------------------------------------------------------
// Load validation
//---------------------------------------------------------
DataFrame < double > coefOutput( "./data/", "Smap_circle_coef_valid.csv" );
// Generate cpp output
DataFrame < double > circleData( "../data/", "circle.csv" );
SMapValues smapVals = SMap ( circleData,
"./data/", "",
" 1 100 ", "101 198", 2, 1, 0, -1, 4, 0,
"x y", "x",
"Smap_circle_coef.csv",
"Smap_circle_SV.csv",
true, false, false );
DataFrame < double > cppOutput = smapVals.predictions;
DataFrame < double > cppCoef = smapVals.coefficients;
// Comparison
MakeTest ( "SMap: circle test", coefOutput, cppCoef );
//---------------------------------------------------------
// Load validation
//---------------------------------------------------------
DataFrame < double > pyOutput =
DataFrame <double> ("./data/", "Smap_embd_block_3sp_pyEDM.csv");
smapVals = SMap ( "../data/", "block_3sp.csv",
"./data/", "Smap_embd_block_3sp_cppEDM.csv",
" 1 99 ", "100 198", 3, 1, 0, -1, 2, 0,
"x_t y_t z_t", "x_t", "", "", true, false, false );
cppOutput = smapVals.predictions;
// Comparison
MakeTest ( "SMap: block_3sp test", pyOutput, cppOutput );
//---------------------------------------------------------
// SMap nan test : edmNan
// ./data/circle.csv "1 20" "1 20" "x" x out.csv 2 1 -1
// 0 0 smap 2 n y y n n n 0 0 "1 2 13" "1 1 1"
//---------------------------------------------------------
// Load coeff validation
DataFrame < double > SmapNanCoeff1 =
DataFrame <double> ("./data/", "SmapNanCoeff1_valid.csv");
// Load prediction validation
DataFrame < double > SmapNanPred1 =
DataFrame <double> ("./data/", "SmapNanPred1_valid.csv");
// Load circle data, insert nan at rows 1 2 13, column x
DataFrame < double > circleNanData( "../data/", "circle.csv" );
circleNanData( 0, 0 ) = nan("SmapTest");
circleNanData( 1, 0 ) = nan("SmapTest");
circleNanData( 12, 0 ) = nan("SmapTest");
// Smap with nan at rows 1 2 13, column x
SMapValues smapNanVals = SMap( circleNanData,
"./data/", "Smap_nan_circle_pred.csv",
" 1 20 ", "1 20", 2, 1, 0, -1, 2, 0,
"x", "x",
"Smap_nan_circle_coef.csv",
"Smap_nan_circle_SV.csv",
false, false, false );
DataFrame < double > cppNanOutput = smapNanVals.predictions;
DataFrame < double > cppNanCoef = smapNanVals.coefficients;
// Comparison
MakeTest ( "SMap: nan circle test: coeff", cppNanOutput, SmapNanPred1 );
MakeTest ( "SMap: nan circle test: pred", cppNanCoef, SmapNanCoeff1 );
}