Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5707#discussion_r30078632
  
    --- Diff: python/pyspark/mllib/tests.py ---
    @@ -818,6 +819,40 @@ def test_model_transform(self):
             self.assertEqual(model.transform([1.0, 2.0, 3.0]), 
DenseVector([1.0, 2.0, 3.0]))
     
     
    +class MLUtilsTests(MLlibTestCase):
    +    def test_append_bias(self):
    +        data = [2.0, 2.0, 2.0]
    +        ret = MLUtils.appendBias(data)
    +        self.assertEqual(ret[3], 1.0)
    +        self.assertEqual(type(ret), list)
    +
    +    def test_append_bias_with_vector(self):
    +        data = Vectors.dense([2.0, 2.0, 2.0])
    +        ret = MLUtils.appendBias(data)
    +        self.assertEqual(ret[3], 1.0)
    +        self.assertEqual(type(ret), list)
    +
    +    def test_load_vectors(self):
    +        import shutil
    +        data = [
    +            [1.0, 2.0, 3.0],
    +            [1.0, 2.0, 3.0]
    +        ]
    +        temp_dir = tempfile.mkdtemp()
    +        load_vectors_path = os.path.join(temp_dir, "test_load_vectors")
    +        try:
    +            self.sc.parallelize(data).saveAsTextFile(load_vectors_path)
    +            ret_rdd = MLUtils.loadVectors(self.sc, load_vectors_path)
    +            ret = ret_rdd.collect()
    +            self.assertEqual(len(ret), 2)
    +            self.assertEqual(ret[0], DenseVector([1.0, 2.0, 3.0]))
    +            self.assertEqual(ret[1], DenseVector([1.0, 2.0, 3.0]))
    +        except:
    +            self.fail()
    --- End diff --
    
    Shouldn't this try to remove the load_vectors_path?  It could test to see 
if that path has been created, and if so, remove it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to