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


Python NodeData.Vdata方法代码示例

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


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

示例1: q_without_ros

# 需要导入模块: from libpgm.nodedata import NodeData [as 别名]
# 或者: from libpgm.nodedata.NodeData import Vdata [as 别名]
def q_without_ros():
    skel = GraphSkeleton()
    skel.V = ["prize_door", "guest_door", "monty_door"]
    skel.E = [["prize_door", "monty_door"],
              ["guest_door", "monty_door"]]
    skel.toporder()
    nd = NodeData()
    nd.Vdata = {
        "prize_door": {
            "numoutcomes": 3,
            "parents": None,
            "children": ["monty_door"],
            "vals": ["A", "B", "C"],
            "cprob": [1.0/3, 1.0/3, 1.0/3],
        },
        "guest_door": {
            "numoutcomes": 3,
            "parents": None,
            "children": ["monty_door"],
            "vals": ["A", "B", "C"],
            "cprob": [1.0/3, 1.0/3, 1.0/3],
        },
        "monty_door": {
            "numoutcomes": 3,
            "parents": ["prize_door", "guest_door"],
            "children": None,
            "vals": ["A", "B", "C"],
            "cprob": {
                "['A', 'A']": [0., 0.5, 0.5],
                "['B', 'B']": [0.5, 0., 0.5],
                "['C', 'C']": [0.5, 0.5, 0.],
                "['A', 'B']": [0., 0., 1.],
                "['A', 'C']": [0., 1., 0.],
                "['B', 'A']": [0., 0., 1.],
                "['B', 'C']": [1., 0., 0.],
                "['C', 'A']": [0., 1., 0.],
                "['C', 'B']": [1., 0., 0.],
            },
        },
    }
    bn = DiscreteBayesianNetwork(skel, nd)
    fn = TableCPDFactorization(bn)

    query = {
        "prize_door": ["A","B","C"],
    }
    evidence = {
        "guest_door": "A",
        "monty_door": "B",
    }

    res = fn.condprobve(query, evidence)
    print res.vals
    print res.scope
    print res.card
    print res.stride
开发者ID:1224830613,项目名称:jsk_3rdparty,代码行数:58,代码来源:discrete_bayesian_query_sample.py

示例2: discrete_nodedata_from_ros

# 需要导入模块: from libpgm.nodedata import NodeData [as 别名]
# 或者: from libpgm.nodedata.NodeData import Vdata [as 别名]
def discrete_nodedata_from_ros(nodes):
    nd = NodeData()
    nd.Vdata = {n.name: dict_from_ros_discrete_node(n) for n in nodes}
    return nd
开发者ID:1224830613,项目名称:jsk_3rdparty,代码行数:6,代码来源:msg_utils.py


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