@@ -87,35 +87,19 @@ class KolmogorovSmirnovTestResult(TestResult):
8787 """
8888
8989
90+ @since ('2.0.0' )
9091class BinarySample (namedtuple ("BinarySample" , ["isExperiment" , "value" ])):
9192 """
9293 Represents a (isExperiment, value) tuple.
9394
94- >>> bs = BinarySample(True, 1.0)
95- >>> (bs.isExperiment, bs.value)
96- (True, 1.0)
97-
9895 .. versionadded:: 2.0.0
9996 """
10097
10198 def __reduce__ (self ):
10299 return BinarySample , (bool (self .isExperiment ), float (self .value ))
103100
104101
105- @inherit_doc
106- class StreamingTestResult2 (TestResult ):
107- """
108- Contains test results for StreamingTest.
109- """
110-
111- @property
112- def method (self ):
113- """
114- Name of the test method
115- """
116- return self ._java_model .method ()
117-
118-
102+ @since ('2.0.0' )
119103class StreamingTestResult (namedtuple ("StreamingTestResult" ,
120104 ["pValue" , "degreesOfFreedom" , "statistic" , "method" ,
121105 "nullHypothesis" ])):
@@ -131,6 +115,7 @@ def __reduce__(self):
131115 str (self .method ), str (self .nullHypothesis ))
132116
133117
118+ @since ('2.0.0' )
134119class StreamingTest (object ):
135120 """
136121 .. note:: Experimental
@@ -163,7 +148,7 @@ def setPeacePeriod(self, peacePeriod):
163148 """
164149 Update peacePeriod
165150 :param peacePeriod:
166- :return:
151+ Set number of initial RDD batches of the DStream to be dropped from significance testing.
167152 """
168153 self ._peacePeriod = peacePeriod
169154
@@ -172,7 +157,7 @@ def setWindowSize(self, windowSize):
172157 """
173158 Update windowSize
174159 :param windowSize:
175- :return:
160+ Set the number of batches each significance test is to be performed over.
176161 """
177162 self ._windowSize = windowSize
178163
@@ -181,8 +166,10 @@ def setTestMethod(self, testMethod):
181166 """
182167 Update test method
183168 :param testMethod:
184- :return:
169+ Currently supported tests: `welch`, `student`.
185170 """
171+ assert (testMethod in ("welch" , "student" ),
172+ "Currently supported tests: \" welch\" , \" student\" " )
186173 self ._testMethod = testMethod
187174
188175 @since ('2.0.0' )
@@ -216,18 +203,3 @@ def _validate(cls, samples):
216203 else :
217204 raise TypeError ("BinarySample should be represented by a DStream, "
218205 "but got %s." % type (samples ))
219-
220-
221- def _test ():
222- import doctest
223- import pyspark .mllib .stat .test
224- globs = pyspark .mllib .stat .test .__dict__ .copy ()
225- globs ['sc' ] = SparkContext ('local[4]' , 'Statistical Test doctest' )
226- (failure_count , test_count ) = doctest .testmod (globs = globs , optionflags = doctest .ELLIPSIS )
227- globs ['sc' ].stop ()
228- if failure_count :
229- exit (- 1 )
230-
231-
232- if __name__ == "__main__" :
233- _test ()
0 commit comments