本文整理汇总了Python中pystruct.models.GraphCRF._get_pairwise_potentials方法的典型用法代码示例。如果您正苦于以下问题:Python GraphCRF._get_pairwise_potentials方法的具体用法?Python GraphCRF._get_pairwise_potentials怎么用?Python GraphCRF._get_pairwise_potentials使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pystruct.models.GraphCRF
的用法示例。
在下文中一共展示了GraphCRF._get_pairwise_potentials方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_graph_crf_inference
# 需要导入模块: from pystruct.models import GraphCRF [as 别名]
# 或者: from pystruct.models.GraphCRF import _get_pairwise_potentials [as 别名]
def test_graph_crf_inference():
# create two samples with different graphs
# two states only, pairwise smoothing
for inference_method in get_installed(['qpbo', 'lp', 'ad3', 'dai', 'ogm']):
crf = GraphCRF(n_states=2, n_features=2,
inference_method=inference_method)
assert_array_equal(crf.inference((x_1, g_1), w), y_1)
assert_array_equal(crf.inference((x_2, g_2), w), y_2)
print crf._get_pairwise_potentials((x_1, g_1), w)
示例2: test_directed_graph_crf_inference
# 需要导入模块: from pystruct.models import GraphCRF [as 别名]
# 或者: from pystruct.models.GraphCRF import _get_pairwise_potentials [as 别名]
def test_directed_graph_crf_inference():
# create two samples with different graphs
# two states only, pairwise smoothing
# same as above, only with full symmetric matrix
for inference_method in get_installed(['qpbo', 'lp', 'ad3', 'dai', 'ogm']):
crf = GraphCRF(n_states=2, n_features=2,
inference_method=inference_method, directed=True)
assert_array_equal(crf.inference((x_1, g_1), w_sym), y_1)
assert_array_equal(crf.inference((x_2, g_2), w_sym), y_2)
print crf._get_pairwise_potentials((x_1, g_1), w_sym)