title: convert dataframe to libsvm format
body: <p>I have a dataframe resulting from a sql query</p>
  
  <pre><code>df1 = sqlContext.sql("select * from table_test")
  </code></pre>
  
  <p>I need to convert this dataframe to libsvm format so that it can be provided as an input for </p>
  
  <pre><code>pyspark.ml.classification.LogisticRegression
  </code></pre>
  
  <p>I tried to do the following. However, this resulted in the following error as I'm using spark 1.5.2</p>
  
  <pre><code>df1.write.format("libsvm").save("data/foo")
  Failed to load class for data source: libsvm
  </code></pre>
  
  <p>I wanted to use MLUtils.loadLibSVMFile instead. I'm behind a firewall and can't directly pip install it. So I downloaded the file, scp-ed it and then manually installed it. Everything seemed to work fine but I still get the following error</p>
  
  <pre><code>import org.apache.spark.mllib.util.MLUtils
  No module named org.apache.spark.mllib.util.MLUtils
  </code></pre>
  
  <p>Question 1: Is my above approach to convert dataframe to libsvm format in the right direction.
  Question 2: If "yes" to question 1, how to get MLUtils working. If "no", what is the best way to convert dataframe to libsvm format </p>