當前位置: 首頁>>代碼示例>>Python>>正文


Python TransformableRDD.smooth方法代碼示例

本文整理匯總了Python中pyprepbuddy.rdds.transformable_rdd.TransformableRDD.smooth方法的典型用法代碼示例。如果您正苦於以下問題:Python TransformableRDD.smooth方法的具體用法?Python TransformableRDD.smooth怎麽用?Python TransformableRDD.smooth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pyprepbuddy.rdds.transformable_rdd.TransformableRDD的用法示例。


在下文中一共展示了TransformableRDD.smooth方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_should_smooth_data_by_Simple_Moving_Average

# 需要導入模塊: from pyprepbuddy.rdds.transformable_rdd import TransformableRDD [as 別名]
# 或者: from pyprepbuddy.rdds.transformable_rdd.TransformableRDD import smooth [as 別名]
 def test_should_smooth_data_by_Simple_Moving_Average(self):
     initial_dataset = self.sc.parallelize(
             ["52,3,53", "23,4,64", "23,5,64", "23,6,64", "23,7,64", "23,8,64", "23,9,64"], 3)
     transformable_rdd = TransformableRDD(initial_dataset, "csv")
     transformed = transformable_rdd.smooth(1, SimpleMovingAverage(3))
     excepted = 4.0
     self.assertEquals(excepted, transformed.first())
開發者ID:blpabhishek,項目名稱:prep-buddy,代碼行數:9,代碼來源:smoothers_test.py

示例2: test_should_smooth_data_by_Weighted_Moving_Average

# 需要導入模塊: from pyprepbuddy.rdds.transformable_rdd import TransformableRDD [as 別名]
# 或者: from pyprepbuddy.rdds.transformable_rdd.TransformableRDD import smooth [as 別名]
    def test_should_smooth_data_by_Weighted_Moving_Average(self):
        initial_dataset = self.sc.parallelize(["10", "12", "16", "13", "17", "19", "15", "20", "22", "19", "21", "19"],
                                              3)
        transformable_rdd = TransformableRDD(initial_dataset, "csv")

        weights = Weights(3)
        weights.add(0.166)
        weights.add(0.333)
        weights.add(0.5)

        moving_average = WeightedMovingAverage(3, weights)
        rdd = transformable_rdd.smooth(0, moving_average)

        expected = 13.656
        actual = rdd.first()
        self.assertEquals(expected, actual)
開發者ID:blpabhishek,項目名稱:prep-buddy,代碼行數:18,代碼來源:smoothers_test.py


注:本文中的pyprepbuddy.rdds.transformable_rdd.TransformableRDD.smooth方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。