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


Python TSNE._EXPLORATION_N_ITER方法代码示例

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


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

示例1: test_bh_match_exact

# 需要导入模块: from sklearn.manifold.t_sne import TSNE [as 别名]
# 或者: from sklearn.manifold.t_sne.TSNE import _EXPLORATION_N_ITER [as 别名]
def test_bh_match_exact():
    # check that the ``barnes_hut`` method match the exact one when
    # ``angle = 0`` and ``perplexity > n_samples / 3``
    random_state = check_random_state(0)
    n_features = 10
    X = random_state.randn(30, n_features).astype(np.float32)
    X_embeddeds = {}
    n_iter = {}
    for method in ['exact', 'barnes_hut']:
        tsne = TSNE(n_components=2, method=method, learning_rate=1.0,
                    init="random", random_state=0, n_iter=251,
                    perplexity=30.0, angle=0)
        # Kill the early_exaggeration
        tsne._EXPLORATION_N_ITER = 0
        X_embeddeds[method] = tsne.fit_transform(X)
        n_iter[method] = tsne.n_iter_

    assert n_iter['exact'] == n_iter['barnes_hut']
    assert_array_almost_equal(X_embeddeds['exact'], X_embeddeds['barnes_hut'],
                              decimal=3)
开发者ID:BasilBeirouti,项目名称:scikit-learn,代码行数:22,代码来源:test_t_sne.py

示例2: test_n_iter_without_progress

# 需要导入模块: from sklearn.manifold.t_sne import TSNE [as 别名]
# 或者: from sklearn.manifold.t_sne.TSNE import _EXPLORATION_N_ITER [as 别名]
def test_n_iter_without_progress():
    # Use a dummy negative n_iter_without_progress and check output on stdout
    random_state = check_random_state(0)
    X = random_state.randn(100, 10)
    for method in ["barnes_hut", "exact"]:
        tsne = TSNE(n_iter_without_progress=-1, verbose=2, learning_rate=1e8,
                    random_state=0, method=method, n_iter=351, init="random")
        tsne._N_ITER_CHECK = 1
        tsne._EXPLORATION_N_ITER = 0

        old_stdout = sys.stdout
        sys.stdout = StringIO()
        try:
            tsne.fit_transform(X)
        finally:
            out = sys.stdout.getvalue()
            sys.stdout.close()
            sys.stdout = old_stdout

        # The output needs to contain the value of n_iter_without_progress
        assert_in("did not make any progress during the "
                  "last -1 episodes. Finished.", out)
开发者ID:BasilBeirouti,项目名称:scikit-learn,代码行数:24,代码来源:test_t_sne.py


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