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


Python PCAModel.original_variance方法代码示例

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


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

示例1: test_pca_variance

# 需要导入模块: from menpo.model import PCAModel [as 别名]
# 或者: from menpo.model.PCAModel import original_variance [as 别名]
def test_pca_variance():
    samples = [PointCloud(np.random.randn(10)) for _ in range(10)]
    model = PCAModel(samples)
    # kept variance must be equal to total variance
    assert_equal(model.variance(), model.original_variance())
    # kept variance ratio must be 1.0
    assert_equal(model.variance_ratio(), 1.0)
    # noise variance must be 0.0
    assert_equal(model.noise_variance(), 0.0)
    # noise variance ratio must be also 0.0
    assert_equal(model.noise_variance_ratio(), 0.0)
开发者ID:kritsong,项目名称:menpo,代码行数:13,代码来源:test_model.py

示例2: test_pca_variance_after_trim

# 需要导入模块: from menpo.model import PCAModel [as 别名]
# 或者: from menpo.model.PCAModel import original_variance [as 别名]
def test_pca_variance_after_trim():
    samples = [PointCloud(np.random.randn(10)) for _ in range(10)]
    model = PCAModel(samples)
    # set number of active components
    model.trim_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


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