test_transforms.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:uncover-ml 作者: GeoscienceAustralia 项目源码 文件源码
def test_StandardiseTransform_caching(make_random_data):

    # Generate an initial set of data
    x, mu, std = make_random_data

    # Apply the CentreTransform to the first dataset to preserve the mean
    x_copy = x.copy()
    center_transformer = CentreTransform()
    center_transformer(x_copy)

    # Now apply the center transform to a matrix translated by 2 * mu
    x_translated = x + 3.0 * mu
    x_expected = x_translated - mu
    x_produced = center_transformer(x_translated)

    # Check that the transformer used the mean mu instead of the translated
    # mean which was 4 * mu in this case above
    assert np.array_equal(x_expected, x_produced)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号