本文整理汇总了C++中BayesNet::SetPGaussian方法的典型用法代码示例。如果您正苦于以下问题:C++ BayesNet::SetPGaussian方法的具体用法?C++ BayesNet::SetPGaussian怎么用?C++ BayesNet::SetPGaussian使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BayesNet
的用法示例。
在下文中一共展示了BayesNet::SetPGaussian方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BayesNet
BayesNet *VerySimpleGaussianModel()
{
// NodeA -> NodeB -> NodeC
BayesNet *net;
net = new BayesNet();
net->AddNode(continuous^"NodeB NodeA NodeC", "dim1");
// net->AddNode(continuous^"NodeA NodeB NodeC", "dim1");
net->AddArc("NodeA", "NodeB");
net->AddArc("NodeB", "NodeC");
net->SetPGaussian("NodeA", "1.0", "10.0");
net->SetPGaussian("NodeB", "0.5", "7.0", "0.1");
net->SetPGaussian("NodeC", "0.8", "3.5", "0.4");
return net;
}
示例2: BayesNet
BayesNet *SimpleSoftMaxModel()
{
BayesNet *net;
net = new BayesNet();
net->AddNode(continuous^"node0 node1 node2");
net->AddNode(discrete^"node5", "True False");
net->AddArc("node0", "node5");
net->AddArc("node1", "node5");
net->AddArc("node2", "node5");
net->SetPGaussian("node0", "0.1", "0.9");
net->SetPGaussian("node1", "0.2", "0.8");
net->SetPGaussian("node2", "0.3", "0.7");
net->SetPSoftMax("node5^True node5^False", "0.3 0.4 0.5 0.6 0.7 0.8", "0.1 0.1");
return net;
}
示例3: TestGetGaussianMeanCovarWeights
void TestsPnlHigh::TestGetGaussianMeanCovarWeights()
{
printf("TestGetGaussianMeanCovarWeights\n");
BayesNet *net = SimpleCGM1();
net->SetPGaussian("Cont1", "0.0", "2.5", "1.0 3.0", "Tab0^State0");
net->SetPGaussian("Cont1", "-1.5", "0.75", "0.5 2.5", "Tab0^State1");
if (net->GetGaussianMean("Cont1", "Tab0^State0")[0].FltValue() != 0.0f)
{
PNL_THROW(pnl::CAlgorithmicException, "GetGaussianMean works incorrectly");
};
if (net->GetGaussianMean("Cont1", "Tab0^State1")[0].FltValue() != -1.5f)
{
PNL_THROW(pnl::CAlgorithmicException, "GetGaussianMean works incorrectly");
};
if (net->GetGaussianCovar("Cont1", "Tab0^State0")[0].FltValue() != 2.5f)
{
PNL_THROW(pnl::CAlgorithmicException, "GetGaussianCovar works incorrectly");
};
if (net->GetGaussianCovar("Cont1", "Tab0^State1")[0].FltValue() != 0.75f)
{
PNL_THROW(pnl::CAlgorithmicException, "GetGaussianCovar works incorrectly");
};
if (String(net->GetGaussianWeights("Cont1", "Cont0", "Tab0^State0")[0]) != "1.000000^3.000000")
{
PNL_THROW(pnl::CAlgorithmicException, "GetGaussianCovar works incorrectly");
};
if (String(net->GetGaussianWeights("Cont1", "Cont0", "Tab0^State1")[0]) != "0.500000^2.500000")
{
PNL_THROW(pnl::CAlgorithmicException, "GetGaussianCovar works incorrectly");
};
delete net;
};
示例4: CropModel
BayesNet* CropModel()
{
// Subsidy(d) Crop(c)
// | |
// V V
// Price(c)
// |
// V
// Buy(d)
BayesNet *net;
net = new BayesNet();
textcolor(WHITE);
net->AddNode(discrete^"Subsidy", "Yes No");
printf("\n net->AddNode(discrete^\"Subsidy\", \"Yes No\");");
textcolor(LIGHTGREEN);
printf("\t\t\t\t\t\tAdding of nodes is in process....");
_sleep(2000);
textcolor(WHITE);
net->AddNode(continuous ^ "Crop");
printf("\n net->AddNode(continuous ^ \"Crop\");");
_sleep(1000);
net->AddNode(continuous ^ "Price");
printf("\n net->AddNode(continuous ^ \"Price\");");
_sleep(1000);
net->AddNode(discrete^"Buy", "Yes No");
printf("\n net->AddNode(discrete^\"Buy\", \"Yes No\");");
textcolor(LIGHTGREEN);
printf("\n ......All nodes are added....\n");
getch();
// arcs
textcolor(WHITE);
net->AddArc("Subsidy Crop", "Price");
printf("\n net->AddArc(\"Subsidy Crop\", \"Price\");");
textcolor(LIGHTGREEN);
printf("\t\t\t\t\t\t\tAdding of arcs is in process....");
_sleep(2000);
textcolor(WHITE);
net->AddArc("Price", "Buy");
printf("\n net->AddArc(\"Price\", \"Buy\");");
textcolor(LIGHTGREEN);
printf("\n ......All arcs are added....\n");
getch();
// distributions
textcolor(WHITE);
net->SetPTabular("Subsidy^Yes Subsidy^No", "0.3 0.7");
printf("\n net->SetPTabular(\"Subsidy^Yes Subsidy^No\", \"0.3 0.7\");");
textcolor(LIGHTGREEN);
printf("\t\t\t\t\tAdding of distributions is in process....");
_sleep(2000);
textcolor(WHITE);
net->SetPGaussian("Crop", "5.0", "1.0");
printf("\n net->SetPGaussian(\"Crop\", \"5.0\", \"1.0\");");
_sleep(1000);
net->SetPGaussian("Price", "10.0", "1.0", "-1.0", "Subsidy^Yes");
printf("\n net->SetPGaussian(\"Price\", \"10.0\", \"1.0\", \"-1.0\", \"Subsidy^Yes\");");
_sleep(1000);
net->SetPGaussian("Price", "20.0", "1.0", "-1.0", "Subsidy^No");
printf("\n net->SetPGaussian(\"Price\", \"20.0\", \"1.0\", \"-1.0\", \"Subsidy^No\");");
_sleep(1000);
net->SetPSoftMax("Buy^Yes Buy^No", "-1.0 1.0", "5.0 -5.0");
printf("\n net->SetPSoftMax(\"Buy^Yes Buy^No\", \"-1.0 1.0\", \"5.0 -5.0\");");
textcolor(LIGHTGREEN);
printf("\n ......All distributions are added....\n");
getch();
textcolor(WHITE);
return net;
}
示例5: BayesNet
BayesNet *WasteModel()
{
BayesNet *net;
net = new BayesNet();
textcolor(WHITE);
net->AddNode(discrete^"TypeOfWaste", "industrial household");
net->AddNode(discrete^"FilterState", "intact defective");
net->AddNode(discrete^"BurningRegime", "stable unstable");
printf("\n net->AddNode(discrete^\"TypeOfWaste\", \"industrial household\");");
textcolor(LIGHTGREEN);
printf("\t\t\t\tAdding of nodes is in process....");
_sleep(2000);
textcolor(WHITE);
printf("\n net->AddNode(discrete^\"FilterState\", \"intact defective\");");
_sleep(1000);
printf("\n net->AddNode(discrete^\"BurningRegime\", \"stable unstable\");");
_sleep(1000);
net->AddNode(continuous^"FilterEfficiency CO2Emission DustEmission", "dim1");
printf("\n net->AddNode(continuous^\"FilterEfficiency CO2Emission DustEmission\", \"dim1\");");
_sleep(1000);
net->AddNode(continuous^"MetalInWaste MetalEmission Light", "dim1");
printf("\n net->AddNode(continuous^\"MetalInWaste MetalEmission Light\", \"dim1\");");
textcolor(LIGHTGREEN);
printf("\n ......All nodes are added....\n");
getch();
// arcs
textcolor(WHITE);
net->AddArc("TypeOfWaste FilterState", "FilterEfficiency");
printf("\n net->AddArc(\"TypeOfWaste FilterState\", \"FilterEfficiency\");");
textcolor(LIGHTGREEN);
printf("\t\t\t\tAdding of arcs is in process....");
_sleep(2000);
textcolor(WHITE);
net->AddArc("FilterState FilterEfficiency BurningRegime", "DustEmission") ;
printf("\n net->AddArc(\"FilterState FilterEfficiency BurningRegime\", \"DustEmission\") ;");
_sleep(1000);
net->AddArc( "FilterState", "MetalInWaste");
printf("\n net->AddArc(\"FilterState\", \"MetalInWaste\");");
_sleep(1000);
net->AddArc( "BurningRegime", "CO2Emission");
printf("\n net->AddArc(\"BurningRegime\", \"CO2Emission\");");
_sleep(1000);
net->AddArc( "DustEmission MetalInWaste", "MetalEmission");
printf("\n net->AddArc(\"DustEmission MetalInWaste\", \"MetalEmission\");");
_sleep(1000);
net->AddArc( "MetalInWaste", "Light");
printf("\n net->AddArc(\"MetalInWaste\", \"Light\");");
_sleep(1000);
textcolor(LIGHTGREEN);
printf("\n ......All arcs are added....\n");
getch();
// distributions
textcolor(WHITE);
net->SetPTabular( "TypeOfWaste^industrial TypeOfWaste^household", "0.95 0.05");
printf("\n net->SetPTabular(\"TypeOfWaste^industrial TypeOfWaste^household\", \"0.95 0.05\");");
textcolor(LIGHTGREEN);
printf("\t\tAdding of distributions is in process....");
_sleep(2000);
textcolor(WHITE);
net->SetPTabular( "FilterState^intact FilterState^defective", "0.285714 0.714286");
printf("\n net->SetPTabular(\"FilterState^intact FilterState^defective\", \"0.285714 0.714286\");");
_sleep(1000);
net->SetPTabular( "BurningRegime^stable BurningRegime^unstable", "0.85 0.15");
printf("\n net->SetPTabular(\"BurningRegime^stable BurningRegime^unstable\", \"0.85 0.15\");");
_sleep(1000);
net->SetPGaussian( "FilterEfficiency", "-3.2", "0.00002", "", "TypeOfWaste^industrial FilterState^defective");
printf("\n net->SetPGaussian(\"FilterEfficiency\", \"-3.2\", \"0.00002\", \"\", \n\t\t\"TypeOfWaste^industrial FilterState^defective\");");
_sleep(1000);
net->SetPGaussian( "FilterEfficiency", "-0.5", "0.0001", "", "TypeOfWaste^industrial FilterState^intact");
printf("\n net->SetPGaussian(\"FilterEfficiency\", \"-0.5\", \"0.0001\", \"\", \n\t\t\"TypeOfWaste^industrial FilterState^intact\");");
_sleep(1000);
net->SetPGaussian( "FilterEfficiency", "-3.9", "0.00002", "", "TypeOfWaste^household FilterState^defective");
printf("\n net->SetPGaussian(\"FilterEfficiency\", \"-3.9\", \"0.00002\", \"\", \n\t\t\"TypeOfWaste^household FilterState^defective\");");
_sleep(1000);
net->SetPGaussian( "FilterEfficiency", "-0.4", "0.0001", "", "TypeOfWaste^household FilterState^intact");
printf("\n net->SetPGaussian(\"FilterEfficiency\", \"-0.4\", \"0.0001\", \"\", \n\t\t\"TypeOfWaste^household FilterState^intact\");");
_sleep(1000);
//.........这里部分代码省略.........