File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,7 +78,10 @@ var trajDist = Infer({ model() {
7878 return simulate(mdp.startState, aleph0).trajectory;
7979}}).getDist();
8080
81- //console.log("trajDist", trajDist);
81+ console.log("\nDATA FOR REGRESSION TESTS: \ntrajDist");
82+ var regressionTestData = webpplAgents.trajDist2simpleJSON(trajDist);
83+ console.log(JSON.stringify(regressionTestData));
84+ console.log("END OF DATA FOR REGRESSION TESTS\n");
8285
8386var trajData = trajDist2TrajData(trajDist, agent);
8487
Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ var onlyNonnegativeFormat = function (x) {
2626 ;
2727} ;
2828
29+ var prettyState = function ( state ) { return "(" + state . loc [ 0 ] + "," + state . loc [ 1 ] + ")-" + state . timeLeft ; } ;
30+
2931module . exports = {
3032
3133 emptySet : ( ) => new Set ( ) ,
@@ -155,6 +157,24 @@ module.exports = {
155157 }
156158 } ,
157159
160+ prettyState,
161+
162+ trajDist2simpleJSON : function ( trajDist ) {
163+ var keys = Object . keys ( trajDist ) ,
164+ result = [ ] ;
165+ for ( var index in keys ) {
166+ var trajString = keys [ index ] ,
167+ traj = JSON . parse ( trajString ) ,
168+ val = trajDist [ trajString ] ,
169+ prob = val . prob ,
170+ trajOut = traj . map ( ( stepData ) => [ prettyState ( stepData . state ) , stepData . action ] ) ;
171+ res = [ prob , trajOut ]
172+ ;
173+ result . push ( res ) ;
174+ }
175+ return result ;
176+ } ,
177+
158178 // TO BE MOVED TO src/utils/metalog.js:
159179
160180 /* TODO:
You can’t perform that action at this time.
0 commit comments