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


Python Series.normalize方法代码示例

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


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

示例1: test_normalization

# 需要导入模块: from thunder.rdds.series import Series [as 别名]
# 或者: from thunder.rdds.series.Series import normalize [as 别名]
 def test_normalization(self):
     rdd = self.sc.parallelize([(0, array([1, 2, 3, 4, 5], dtype='float16'))])
     data = Series(rdd, dtype='float16')
     out = data.normalize('percentile')
     # check that _dtype has been set properly *before* calling first(), b/c first() will update this
     # value even if it hasn't been correctly set
     assert_equals('float16', str(out._dtype))
     vals = out.first()[1]
     assert_equals('float16', str(vals.dtype))
     assert(allclose(vals, array([-0.42105,  0.10526,  0.63157,  1.15789,  1.68421]), atol=1e-3))
开发者ID:mfcabrera,项目名称:thunder,代码行数:12,代码来源:test_series.py

示例2: test_normalization_bywindow

# 需要导入模块: from thunder.rdds.series import Series [as 别名]
# 或者: from thunder.rdds.series.Series import normalize [as 别名]
    def test_normalization_bywindow(self):
        y = array([1, 2, 3, 4, 5], dtype='float16')
        rdd = self.sc.parallelize([(0, y)])
        data = Series(rdd, dtype='float16')
        out = data.normalize('window', window=2)
        # check that _dtype has been set properly *before* calling first(), b/c first() will update this
        # value even if it hasn't been correctly set
        assert_equals('float16', str(out._dtype))
        vals = out.first()[1]
        assert_equals('float64', str(vals.dtype))
        b_true = array([1.2,  1.4,  2.4,  3.4,  4.2])
        result_true = (y - b_true) / (b_true + 0.1)
        assert(allclose(vals, result_true, atol=1e-3))

        out = data.normalize('window', window=6)
        vals = out.first()[1]
        b_true = array([1.6,  1.8,  1.8,  1.8,  2.6])
        result_true = (y - b_true) / (b_true + 0.1)
        assert(allclose(vals, result_true, atol=1e-3))
开发者ID:thomaswangyiwen,项目名称:thunder,代码行数:21,代码来源:test_series.py

示例3: test_normalization_bymean

# 需要导入模块: from thunder.rdds.series import Series [as 别名]
# 或者: from thunder.rdds.series.Series import normalize [as 别名]
 def test_normalization_bymean(self):
     rdd = self.sc.parallelize([(0, array([1, 2, 3, 4, 5], dtype='float16'))])
     data = Series(rdd, dtype='float16')
     out = data.normalize('mean')
     # check that _dtype has been set properly *before* calling first(), b/c first() will update this
     # value even if it hasn't been correctly set
     assert_equals('float16', str(out._dtype))
     vals = out.first()[1]
     assert_equals('float16', str(vals.dtype))
     assert(allclose(out.first()[1],
                     array([-0.64516,  -0.32258,  0.0,  0.32258,  0.64516]), atol=1e-3))
开发者ID:mfcabrera,项目名称:thunder,代码行数:13,代码来源:test_series.py

示例4: test_normalization

# 需要导入模块: from thunder.rdds.series import Series [as 别名]
# 或者: from thunder.rdds.series.Series import normalize [as 别名]
 def test_normalization(self):
     rdd = self.sc.parallelize([(0, array([1, 2, 3, 4, 5]))])
     data = Series(rdd)
     assert(allclose(data.normalize('percentile').first()[1],
                     array([-0.42105,  0.10526,  0.63157,  1.15789,  1.68421]), atol=1e-4))
开发者ID:getBioinfo,项目名称:thunder,代码行数:7,代码来源:test_series.py


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