0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 from pyspark.mllib.common import inherit_doc, JavaModelWrapper
0019
0020
0021 __all__ = ["ChiSqTestResult", "KolmogorovSmirnovTestResult"]
0022
0023
0024 class TestResult(JavaModelWrapper):
0025 """
0026 Base class for all test results.
0027 """
0028
0029 @property
0030 def pValue(self):
0031 """
0032 The probability of obtaining a test statistic result at least as
0033 extreme as the one that was actually observed, assuming that the
0034 null hypothesis is true.
0035 """
0036 return self._java_model.pValue()
0037
0038 @property
0039 def degreesOfFreedom(self):
0040 """
0041 Returns the degree(s) of freedom of the hypothesis test.
0042 Return type should be Number(e.g. Int, Double) or tuples of Numbers.
0043 """
0044 return self._java_model.degreesOfFreedom()
0045
0046 @property
0047 def statistic(self):
0048 """
0049 Test statistic.
0050 """
0051 return self._java_model.statistic()
0052
0053 @property
0054 def nullHypothesis(self):
0055 """
0056 Null hypothesis of the test.
0057 """
0058 return self._java_model.nullHypothesis()
0059
0060 def __str__(self):
0061 return self._java_model.toString()
0062
0063
0064 @inherit_doc
0065 class ChiSqTestResult(TestResult):
0066 """
0067 Contains test results for the chi-squared hypothesis test.
0068 """
0069
0070 @property
0071 def method(self):
0072 """
0073 Name of the test method
0074 """
0075 return self._java_model.method()
0076
0077
0078 @inherit_doc
0079 class KolmogorovSmirnovTestResult(TestResult):
0080 """
0081 Contains test results for the Kolmogorov-Smirnov test.
0082 """