import edu.gmu.seor.prognos.unbbayesplugin.cps.CPSCompilerMain;
import edu.gmu.seor.prognos.unbbayesplugin.cps.datastructure.EDB;
public class Discretization_Test extends Test{
public Discretization_Test() {
}
/*
%
% B
% |
% A (X) (Y)
% \ | /
% \ | /
% \| /
% (W)
%
%
% */
String mk_hybridTest_1d2c_bnet = new String(
"defineNode(B, DescriptionB);"+
"{ defineState(Discrete, b1, b2);" +
"p( B ) = { b1:0.8; b2:0.2; } }" +
"defineNode(A, DescriptionA);"+
"{ defineState(Discrete, a1, a2);" +
"p( A | B ) = if( B == b1 ) { a1:0.1; a2:0.9; } " +
"else if( B == b2 ) { a1:0.5; a2:0.5; } " +
"}" +
"defineNode(X, DescriptionX);"+
"{ defineState(Discrete, 1, 2, 3, 4, 5, 6);" +
"p( X ) = NormalDist( 3, 1 ); }" +
"defineNode(Y, DescriptionY);"+
"{ defineState(Discrete, 1, 2, 3, 4, 5, 6);" +
"p( Y ) = NormalDist( 3, 0.5 ); }" +
"defineNode(W, DescriptionW);"+
"{ defineState(Discrete, -20, -10, 30, 40, 50, 60, 70 );" +
"p( W | A, X, Y ) = if( A == a1 ){ X - 0.5*Y + NormalDist( 2, 1 ); } " +
"else if( A == a2 ){ X+Y + NormalDist( -1, 0.5 ); } " +
"}" );
public void test1() {
CPSCompilerMain cpsCompiler = new CPSCompilerMain();
cpsCompiler.InitCompiler();
cpsCompiler.compile( mk_hybridTest_1d2c_bnet +
//"setSampleSize(1000);"+
"createCPT( X, Y, W );"
);
}
/**
* @param args
*/
public static void main(String[] args) {
Discretization_Test t = new Discretization_Test();
t.test1();
}
}