当前位置: 首页>>代码示例>>C++>>正文


C++ BayesNet::SetProperty方法代码示例

本文整理汇总了C++中BayesNet::SetProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ BayesNet::SetProperty方法的具体用法?C++ BayesNet::SetProperty怎么用?C++ BayesNet::SetProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BayesNet的用法示例。


在下文中一共展示了BayesNet::SetProperty方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TestDelNode

void TestDelNode()
{
    BayesNet *net = SevenNodesModel();
    
    net->DelNode("node2");
  
    // all continuous nodes are observed
    net->EditEvidence("node0^0.3");
    net->EditEvidence("node1^0.2");
    net->EditEvidence("node5^0.9");

    net->EditEvidence("node4^True");

    net->SetProperty("Inference", "jtree");
    TokArr jpd3 = net->GetJPD("node3");
	std::cout<< "jpd node3:\t"<<jpd3 << "\n";

    TokArr jpd6 = net->GetJPD("node6");
	std::cout<< "jpd node6:\t"<<jpd6 << "\n";

    delete net;

	std::cout << "TestDelArc is completed successfully" << std::endl;

}
开发者ID:JacobCWard,项目名称:PyPNL,代码行数:25,代码来源:TestSoftMax.cpp

示例2: CrashTestJtreeInferenceSoftMax

void CrashTestJtreeInferenceSoftMax()
{
    BayesNet *net = SimpleSoftMaxModel();
    
    net->SetProperty("Inference", "jtree");
    TokArr jpd5 = net->GetJPD("node5");
	std::cout<< "jpd node5:\t"<<jpd5 << "\n";

    delete net;
}
开发者ID:JacobCWard,项目名称:PyPNL,代码行数:10,代码来源:TestSoftMax.cpp

示例3: TestConditionalGaussianGetJPD

void TestsPnlHigh::TestConditionalGaussianGetJPD()
{
    printf("TestConditionalGaussianGetJPD\n");

    BayesNet *net = SimpleCGM1();
    
    net->SetPGaussian("Cont0", "1.5 -0.5", "1.0 0.3 0.3 2.0", TokArr(), TokArr());
    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");

    net->SetProperty("Inference", "naive");

    net->EditEvidence("Tab0^State0");
    net->GetJPD("Cont0");
    net->GetJPD("Cont1");
    net->GetJPD("Cont2");

    net->ClearEvid();

    Tok tok0("Cont0^Dim0^0.0");
    Tok tok1("Cont0^Dim1^0.0");

    TokIdNode *id0 = tok0.Node();
    TokIdNode *id1 = tok1.Node();

    bool is_int0 = id0->id[id0->id.size()-1].is_int; 
    bool is_int1 = id1->id[id1->id.size()-1].is_int;

    int int_id0 = id0->id[id0->id.size()-1].int_id;
    int int_id1 = id1->id[id1->id.size()-1].int_id;

    TokIdNode *id = net->Net().Token().Node(Tok("Cont0"))->v_next;
    TokIdNode *id2 = net->Net().Token().Node(Tok("Cont1"))->v_next;
    TokIdNode *id3 = net->Net().Token().Node(Tok("Cont2"))->v_next;
    TokIdNode *id4 = net->Net().Token().Node(Tok("Tab0"))->v_next;

    //TokIdNode *a1 = id->v_next;
    //TokIdNode *a2 = a1->h_next;

    net->EditEvidence("Cont0^Dim0^0.0 Cont0^Dim1^1.0");
    net->EditEvidence("Cont1^Dim0^0.0");
    net->EditEvidence("Cont2^Dim0^0.0");

    net->GetJPD("Tab0");

    delete net;
};  
开发者ID:JacobCWard,项目名称:PyPNL,代码行数:47,代码来源:TestCondGaussian.cpp

示例4: TestJtreeInferenceSoftMax1

void TestJtreeInferenceSoftMax1()
{
    BayesNet *net = SimpleSoftMaxModel();
    
    // all continuous nodes are observed
    net->EditEvidence("node0^0.3");
    net->EditEvidence("node1^0.2");
    net->EditEvidence("node2^0.9");
    
    net->SetProperty("Inference", "jtree");
    TokArr jpd5 = net->GetJPD("node5");
	std::cout<< "jpd node5:\t"<<jpd5 << "\n";

    delete net;
	std::cout << "TestJtreeInferenceSoftMax1 is completed successfully" << std::endl;

}
开发者ID:JacobCWard,项目名称:PyPNL,代码行数:17,代码来源:TestSoftMax.cpp

示例5: TestCondGaussianGetMPE

void TestsPnlHigh::TestCondGaussianGetMPE()
{
    printf("TestCondGaussianGetMPE\n");

    BayesNet *net = SimpleCGM1();
    //Cont0(3) Tab0(0)
    //  |      |
    //  \/    \/
    //   Cont1(1)
    //    |
    //    \/
    //   Cont2(2)

    net->SetPGaussian("Cont0", "1.5 -0.5", "1.0 0.3 0.3 2.0", TokArr(), TokArr());
    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");

    net->SetProperty("Inference", "naive");

    net->EditEvidence("Tab0^State1");
    #ifndef PRINT_TestCondGaussianGetMPE
	net->GetMPE("Cont0");
	net->GetMPE("Cont1");
	net->GetMPE("Cont2");
    #else
	std::cout << String(net->GetMPE("Cont0")) << "\n";
	std::cout << String(net->GetMPE("Cont1")) << "\n";
	std::cout << String(net->GetMPE("Cont2")) << "\n";
    #endif

    net->ClearEvid();

    net->EditEvidence("Cont0^Dim0^0.0 Cont0^Dim1^1.0");
    net->EditEvidence("Cont1^Dim0^0.0");
    net->EditEvidence("Cont2^Dim0^0.0");

    #ifndef PRINT_TestCondGaussianGetMPE
	net->GetMPE("Tab0");
    #else
	std::cout << String(net->GetMPE("Tab0")) << "\n";
    #endif

    delete net;
	std::cout << "TestCondGaussianGetMPE is completed successfully" << std::endl;

};
开发者ID:JacobCWard,项目名称:PyPNL,代码行数:46,代码来源:TestCondGaussian.cpp

示例6: TestJtreeInferenceSoftMax2

void TestJtreeInferenceSoftMax2()
{
    BayesNet *net = SimpleSoftMaxModel();
    
    // all discrete nodes are observed
    net->EditEvidence("node5^True");
    net->EditEvidence("node1^0.2");
    
    net->SetProperty("Inference", "jtree");

    TokArr jpd0 = net->GetJPD("node0");
	std::cout<< "jpd node0:\t"<<jpd0 << "\n";

    TokArr jpd2 = net->GetJPD("node2");
	std::cout<< "jpd node2:\t"<<jpd2 << "\n";

    delete net;
	std::cout << "TestJtreeInferenceSoftMax2 is completed successfully" << std::endl;

}
开发者ID:JacobCWard,项目名称:PyPNL,代码行数:20,代码来源:TestSoftMax.cpp

示例7: TestGibbsInferenceSoftMax

void TestGibbsInferenceSoftMax()
{
    BayesNet *net = SimpleSoftMaxModel();
    
    // no observed nodes
    net->SetProperty("Inference", "gibbs");

    TokArr jpd0 = net->GetJPD("node0");
	std::cout<< "jpd node0:\t"<<jpd0 << "\n";

    TokArr jpd1 = net->GetJPD("node1");
	std::cout<< "jpd node1:\t"<<jpd1 << "\n";

    TokArr jpd2 = net->GetJPD("node2");
	std::cout<< "jpd node2:\t"<<jpd2 << "\n";

    TokArr jpd5 = net->GetJPD("node5");
	std::cout<< "jpd node5:\t"<<jpd5 << "\n";

    delete net;
	std::cout << "TestGibbsInferenceSoftMax is completed successfully" << std::endl;

}
开发者ID:JacobCWard,项目名称:PyPNL,代码行数:23,代码来源:TestSoftMax.cpp

示例8: TestJtreeInference2SevenNodesModel

void TestJtreeInference2SevenNodesModel()
{
    BayesNet *net = SevenNodesModel();
    
    // all discrete nodes are observed
    net->EditEvidence("node2^True");
    net->EditEvidence("node3^False");
    net->EditEvidence("node4^False");
    net->EditEvidence("node6^True");
    
    net->EditEvidence("node1^0.55");

    net->SetProperty("Inference", "jtree");

    TokArr jpd0 = net->GetJPD("node0");
	std::cout<< "jpd node0:\t"<<jpd0 << "\n";

    TokArr jpd5 = net->GetJPD("node1");
	std::cout<< "jpd node5:\t"<<jpd5 << "\n";

    delete net;
	std::cout << "TestJtreeInference2SevenNodesModel is completed successfully" << std::endl;

}
开发者ID:JacobCWard,项目名称:PyPNL,代码行数:24,代码来源:TestSoftMax.cpp


注:本文中的BayesNet::SetProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。