Skip to content

Commit a57f096

Browse files
committed
TST: python test for setWeightCol
1 parent 00a7ed8 commit a57f096

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

python/pyspark/ml/tests.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,15 +1255,16 @@ def test_output_columns(self):
12551255
output = model.transform(df)
12561256
self.assertEqual(output.columns, ["label", "features", "prediction"])
12571257

1258-
def test_cache_weightCol_if_necessary(self):
1258+
def test_support_for_weightCol(self):
12591259
df = self.spark.createDataFrame([(0.0, Vectors.dense(1.0, 0.8), 1.0),
12601260
(1.0, Vectors.sparse(2, [], []), 1.0),
12611261
(2.0, Vectors.dense(0.5, 0.5), 1.0)],
12621262
["label", "features", "weight"])
12631263
lr = LogisticRegression(maxIter=5, regParam=0.01)
12641264
ovr = OneVsRest(classifier=lr, weightCol="weight")
1265-
model = ovr.fit(df)
1266-
self.assertIsNotNone(model)
1265+
self.assertIsNotNone(ovr.fit(df))
1266+
ovr2 = OneVsRest(classifier=lr).setWeightCol("weight")
1267+
self.assertIsNotNone(ovr2.fit(df))
12671268

12681269

12691270
class HashingTFTest(SparkSessionTestCase):

0 commit comments

Comments
 (0)