本文整理汇总了Python中sklearn.metrics.cluster.homogeneity_completeness_v_measure函数的典型用法代码示例。如果您正苦于以下问题:Python homogeneity_completeness_v_measure函数的具体用法?Python homogeneity_completeness_v_measure怎么用?Python homogeneity_completeness_v_measure使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了homogeneity_completeness_v_measure函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_non_consicutive_labels
def test_non_consicutive_labels():
# regression tests for labels with gaps
h, c, v = homogeneity_completeness_v_measure([0, 0, 0, 2, 2, 2], [0, 1, 0, 1, 2, 2])
assert_almost_equal(h, 0.67, 2)
assert_almost_equal(c, 0.42, 2)
assert_almost_equal(v, 0.52, 2)
h, c, v = homogeneity_completeness_v_measure([0, 0, 0, 1, 1, 1], [0, 4, 0, 4, 2, 2])
assert_almost_equal(h, 0.67, 2)
assert_almost_equal(c, 0.42, 2)
assert_almost_equal(v, 0.52, 2)
开发者ID:joshbohde,项目名称:scikit-learn,代码行数:11,代码来源:test_cluster.py
示例2: test_not_complete_and_not_homogeneous_labeling
def test_not_complete_and_not_homogeneous_labeling():
# neither complete nor homogeneous but not so bad either
h, c, v = homogeneity_completeness_v_measure(
[0, 0, 0, 1, 1, 1],
[0, 1, 0, 1, 2, 2])
assert_almost_equal(h, 0.67, 2)
assert_almost_equal(c, 0.42, 2)
assert_almost_equal(v, 0.52, 2)
开发者ID:GbalsaC,项目名称:bitnamiP,代码行数:8,代码来源:test_supervised.py
示例3: test_complete_but_not_homogeneous_labeling
def test_complete_but_not_homogeneous_labeling():
# complete but not homogeneous clustering
h, c, v = homogeneity_completeness_v_measure(
[0, 0, 1, 1, 2, 2],
[0, 0, 1, 1, 1, 1])
assert_almost_equal(h, 0.58, 2)
assert_almost_equal(c, 1.00, 2)
assert_almost_equal(v, 0.73, 2)
开发者ID:GbalsaC,项目名称:bitnamiP,代码行数:8,代码来源:test_supervised.py
示例4: test_homogeneous_but_not_complete_labeling
def test_homogeneous_but_not_complete_labeling():
# homogeneous but not complete clustering
h, c, v = homogeneity_completeness_v_measure(
[0, 0, 0, 1, 1, 1],
[0, 0, 0, 1, 2, 2])
assert_almost_equal(h, 1.00, 2)
assert_almost_equal(c, 0.69, 2)
assert_almost_equal(v, 0.81, 2)
开发者ID:GbalsaC,项目名称:bitnamiP,代码行数:8,代码来源:test_supervised.py
示例5: test_non_consecutive_labels
def test_non_consecutive_labels():
# regression tests for labels with gaps
h, c, v = homogeneity_completeness_v_measure(
[0, 0, 0, 2, 2, 2],
[0, 1, 0, 1, 2, 2])
assert_almost_equal(h, 0.67, 2)
assert_almost_equal(c, 0.42, 2)
assert_almost_equal(v, 0.52, 2)
h, c, v = homogeneity_completeness_v_measure(
[0, 0, 0, 1, 1, 1],
[0, 4, 0, 4, 2, 2])
assert_almost_equal(h, 0.67, 2)
assert_almost_equal(c, 0.42, 2)
assert_almost_equal(v, 0.52, 2)
ari_1 = adjusted_rand_score([0, 0, 0, 1, 1, 1], [0, 1, 0, 1, 2, 2])
ari_2 = adjusted_rand_score([0, 0, 0, 1, 1, 1], [0, 4, 0, 4, 2, 2])
assert_almost_equal(ari_1, 0.24, 2)
assert_almost_equal(ari_2, 0.24, 2)
开发者ID:MartinThoma,项目名称:scikit-learn,代码行数:20,代码来源:test_supervised.py
示例6: test_beta_parameter
def test_beta_parameter():
# test for when beta passed to
# homogeneity_completeness_v_measure
# and v_measure_score
beta_test = 0.2
h_test = 0.67
c_test = 0.42
v_test = ((1 + beta_test) * h_test * c_test
/ (beta_test * h_test + c_test))
h, c, v = homogeneity_completeness_v_measure(
[0, 0, 0, 1, 1, 1],
[0, 1, 0, 1, 2, 2],
beta=beta_test)
assert_almost_equal(h, h_test, 2)
assert_almost_equal(c, c_test, 2)
assert_almost_equal(v, v_test, 2)
v = v_measure_score(
[0, 0, 0, 1, 1, 1],
[0, 1, 0, 1, 2, 2],
beta=beta_test)
assert_almost_equal(v, v_test, 2)
开发者ID:kevin-coder,项目名称:scikit-learn-fork,代码行数:23,代码来源:test_supervised.py
示例7: test_homogeneity_completeness_v_measure_sparse
def test_homogeneity_completeness_v_measure_sparse():
labels_a = np.array([1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3])
labels_b = np.array([1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 3, 1, 3, 3, 3, 2, 2])
h, c, v = homogeneity_completeness_v_measure(labels_a, labels_b)
h_s, c_s, v_s = homogeneity_completeness_v_measure(labels_a, labels_b, sparse=True)
assert_array_almost_equal([h, c, v], [h_s, c_s, v_s])
开发者ID:stuppie,项目名称:scikit-learn,代码行数:6,代码来源:test_supervised.py
示例8: adjusted_mutual_info_score
cluster_ap = clusterer_ap.fit_predict(data)
cluster_agg_ap = clusterer_agg_ap.fit_predict(data_agg)
cluster_agg_ap2 = clusterer_agg_ap.fit_predict(data_agg2)
cluster_agg_ap4 = clusterer_agg_ap.fit_predict(data_agg4)
cluster_agg_ap4_w = clusterer_agg_ap.fit_predict(data_agg4_w)
cluster_agg_ap4_ws = clusterer_agg_ap.fit_predict(data_agg4_ws)
cluster_agg_ap4_just_season = clusterer_agg_ap.fit_predict(data_agg4_just_season)
cluster_agg_ap4_just_leaf = clusterer_agg_ap.fit_predict(data_agg4_just_leaf)
cluster_agg_ap4_just_seed = clusterer_agg_ap.fit_predict(data_agg4_just_seed)
cluster_agg_ap4_just_weather = clusterer_agg_ap.fit_predict(data_agg4_just_weather)
mutual_info_score = adjusted_mutual_info_score(labels,cluster_ap)
mutual_info_score_agg = adjusted_mutual_info_score(labels,cluster_agg_ap)
v_score = homogeneity_completeness_v_measure(labels,cluster_ap)
v_score_agg2 = homogeneity_completeness_v_measure(labels,cluster_agg_ap2)
v_score_agg4 = homogeneity_completeness_v_measure(labels,cluster_agg_ap4)
v_score_agg4_w = homogeneity_completeness_v_measure(labels,cluster_agg_ap4_w)
v_score_agg4_ws = homogeneity_completeness_v_measure(labels,cluster_agg_ap4_ws)
v_score_agg4_just_season = homogeneity_completeness_v_measure(labels,cluster_agg_ap4_just_season)
v_score_agg4_just_leaf = homogeneity_completeness_v_measure(labels,cluster_agg_ap4_just_leaf)
v_score_agg4_just_seed = homogeneity_completeness_v_measure(labels,cluster_agg_ap4_just_seed)
v_score_agg4_just_weather = homogeneity_completeness_v_measure(labels,cluster_agg_ap4_just_weather)
print(v_score)
print(v_score_agg2)
print(v_score_agg4_just_leaf)
print(v_score_agg4_just_seed)
print(v_score_agg4) # Leaf and seed
开发者ID:KevinDalleau,项目名称:benchmarking,代码行数:31,代码来源:bencharking.py
注:本文中的sklearn.metrics.cluster.homogeneity_completeness_v_measure函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论