@@ -220,11 +220,11 @@ def chiSqTest(observed, expected=None):
220220 >>> from pyspark.mllib.linalg import Vectors, Matrices
221221 >>> observed = Vectors.dense([4, 6, 5])
222222 >>> pearson = Statistics.chiSqTest(observed)
223- >>> pearson.statistic
223+ >>> print pearson.statistic
224224 0.4
225225 >>> pearson.degreesOfFreedom
226226 2
227- >>> round(pearson.pValue, 4)
227+ >>> print round(pearson.pValue, 4)
228228 0.8187
229229 >>> pearson.method
230230 u'pearson'
@@ -234,13 +234,13 @@ def chiSqTest(observed, expected=None):
234234 >>> observed = Vectors.dense([21, 38, 43, 80])
235235 >>> expected = Vectors.dense([3, 5, 7, 20])
236236 >>> pearson = Statistics.chiSqTest(observed, expected)
237- >>> round(pearson.pValue, 4)
237+ >>> print round(pearson.pValue, 4)
238238 0.0027
239239
240240 >>> data = [40.0, 24.0, 29.0, 56.0, 32.0, 42.0, 31.0, 10.0, 0.0, 30.0, 15.0, 12.0]
241241 >>> chi = Statistics.chiSqTest(Matrices.dense(3, 4, data))
242- >>> round(chi.statistic)
243- 22.0
242+ >>> print round(chi.statistic, 4 )
243+ 21.9958
244244
245245 >>> from pyspark.mllib.regression import LabeledPoint
246246 >>> data = [LabeledPoint(0.0, Vectors.dense([0.5, 10.0])),
@@ -251,9 +251,9 @@ def chiSqTest(observed, expected=None):
251251 ... LabeledPoint(1.0, Vectors.dense([3.5, 40.0])),]
252252 >>> rdd = sc.parallelize(data, 4)
253253 >>> chi = Statistics.chiSqTest(rdd)
254- >>> chi[0].statistic
254+ >>> print chi[0].statistic
255255 0.75
256- >>> chi[1].statistic
256+ >>> print chi[1].statistic
257257 1.5
258258 """
259259 if isinstance (observed , RDD ):
0 commit comments