title: How can I read LIBSVM models (saved using LIBSVM) into PySpark?
body: <p>I have a LIBSVM scaling model (generated with svm-scale) that I would like to port over to PySpark. I've naively tried the following:</p>
  
  <pre><code>scaler_path = "path to model"
  a = MinMaxScaler().load(scaler_path)
  </code></pre>
  
  <p>But I'm thrown an error, expecting a metadata directory:</p>
  
  <pre><code>Py4JJavaErrorTraceback (most recent call last)
  &lt;ipython-input-22-1942e7522174&gt; in &lt;module&gt;()
  ----&gt; 1 a = MinMaxScaler().load(scaler_path)
  
  /srv/data/spark/spark-2.0.0-bin-hadoop2.6/python/pyspark/ml/util.pyc in load(cls, path)
      226     def load(cls, path):
      227         """Reads an ML instance from the input path, a shortcut of `read().load(path)`."""
  --&gt; 228         return cls.read().load(path)
      229 
      230 
  
  /srv/data/spark/spark-2.0.0-bin-hadoop2.6/python/pyspark/ml/util.pyc in load(self, path)
      174         if not isinstance(path, basestring):
      175             raise TypeError("path should be a basestring, got type %s" % type(path))
  --&gt; 176         java_obj = self._jread.load(path)
      177         if not hasattr(self._clazz, "_from_java"):
      178             raise NotImplementedError("This Java ML type cannot be loaded into Python currently: %r"
  
  /usr/local/lib/python2.7/dist-packages/py4j/java_gateway.pyc in __call__(self, *args)
     1131         answer = self.gateway_client.send_command(command)
     1132         return_value = get_return_value(
  -&gt; 1133             answer, self.gateway_client, self.target_id, self.name)
     1134 
     1135         for temp_arg in temp_args:
  
  /srv/data/spark/spark-2.0.0-bin-hadoop2.6/python/pyspark/sql/utils.pyc in deco(*a, **kw)
       61     def deco(*a, **kw):
       62         try:
  ---&gt; 63             return f(*a, **kw)
       64         except py4j.protocol.Py4JJavaError as e:
       65             s = e.java_exception.toString()
  
  /usr/local/lib/python2.7/dist-packages/py4j/protocol.pyc in get_return_value(answer, gateway_client, target_id, name)
      317                 raise Py4JJavaError(
      318                     "An error occurred while calling {0}{1}{2}.\n".
  --&gt; 319                     format(target_id, ".", name), value)
      320             else:
      321                 raise Py4JError(
  
  Py4JJavaError: An error occurred while calling o321.load.
  : org.apache.hadoop.mapred.InvalidInputException: Input path does not exist: file:[filename]/metadata
  </code></pre>
  
  <p>```</p>
  
  <p>Is there a simple work-around for loading this? The format of the LIBSVM model is</p>
  
  <pre><code>x
  0 1
  1 -1050 1030
  2 0 1
  3 0 3
  4 0 1
  5 0 1
  </code></pre>