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


Python PCAModel.n_active_components方法代码示例

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


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

示例1: test_pca_n_active_components_too_many

# 需要导入模块: from menpo.model import PCAModel [as 别名]
# 或者: from menpo.model.PCAModel import n_active_components [as 别名]
def test_pca_n_active_components_too_many():
    samples = [PointCloud(np.random.randn(10)) for _ in range(10)]
    model = PCAModel(samples)
    # too many components
    model.n_active_components = 100
    assert_equal(model.n_active_components, 9)
    # reset too smaller number of components
    model.n_active_components = 5
    assert_equal(model.n_active_components, 5)
    # reset to too many components
    model.n_active_components = 100
    assert_equal(model.n_active_components, 9)
开发者ID:OlivierML,项目名称:menpo,代码行数:14,代码来源:test_model.py

示例2: test_pca_orthogonalize_against_with_less_active_components

# 需要导入模块: from menpo.model import PCAModel [as 别名]
# 或者: from menpo.model.PCAModel import n_active_components [as 别名]
def test_pca_orthogonalize_against_with_less_active_components():
    pca_samples = [PointCloud(np.random.randn(10)) for _ in range(10)]
    pca_model = PCAModel(pca_samples)
    lm_samples = np.asarray([np.random.randn(10) for _ in range(4)])
    lm_model = LinearModel(np.asarray(lm_samples))
    # set number of active components
    pca_model.n_active_components = 5
    # orthogonalize
    pca_model.orthonormalize_against_inplace(lm_model)
    # number of active components must remain the same
    assert_equal(pca_model.n_active_components, 5)
开发者ID:OlivierML,项目名称:menpo,代码行数:13,代码来源:test_model.py

示例3: test_pca_variance_after_change_n_active_components

# 需要导入模块: from menpo.model import PCAModel [as 别名]
# 或者: from menpo.model.PCAModel import n_active_components [as 别名]
def test_pca_variance_after_change_n_active_components():
    samples = [PointCloud(np.random.randn(10)) for _ in range(10)]
    model = PCAModel(samples)
    # set number of active components
    model.n_active_components = 5
    # kept variance must be smaller than total variance
    assert(model.variance() < model.original_variance())
    # kept variance ratio must be smaller than 1.0
    assert(model.variance_ratio() < 1.0)
    # noise variance must be bigger than 0.0
    assert(model.noise_variance() > 0.0)
    # noise variance ratio must also be bigger than 0.0
    assert(model.noise_variance_ratio() > 0.0)
    # inverse noise variance is computable
    assert(model.inverse_noise_variance() == 1/model.noise_variance())
开发者ID:OlivierML,项目名称:menpo,代码行数:17,代码来源:test_model.py

示例4: test_pca_n_active_components_negative

# 需要导入模块: from menpo.model import PCAModel [as 别名]
# 或者: from menpo.model.PCAModel import n_active_components [as 别名]
def test_pca_n_active_components_negative():
    samples = [PointCloud(np.random.randn(10)) for _ in range(10)]
    model = PCAModel(samples)
    # not sufficient components
    model.n_active_components = -5
开发者ID:OlivierML,项目名称:menpo,代码行数:7,代码来源:test_model.py

示例5: test_pca_n_active_components

# 需要导入模块: from menpo.model import PCAModel [as 别名]
# 或者: from menpo.model.PCAModel import n_active_components [as 别名]
def test_pca_n_active_components():
    samples = [PointCloud(np.random.randn(10)) for _ in range(10)]
    model = PCAModel(samples)
    # integer
    model.n_active_components = 5
    assert_equal(model.n_active_components, 5)
开发者ID:OlivierML,项目名称:menpo,代码行数:8,代码来源:test_model.py


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