本文整理汇总了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)
示例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())