title: What is the right way to save\load models in Spark\PySpark
body: <p>I'm working with Spark 1.3.0 using PySpark and MLlib and I need to save and load my models. I use code like this (taken from the official <a href="http://spark.apache.org/docs/latest/mllib-collaborative-filtering.html" rel="noreferrer">documentation</a> )</p>
  
  <pre><code>from pyspark.mllib.recommendation import ALS, MatrixFactorizationModel, Rating
  
  data = sc.textFile("data/mllib/als/test.data")
  ratings = data.map(lambda l: l.split(',')).map(lambda l: Rating(int(l[0]), int(l[1]), float(l[2])))
  rank = 10
  numIterations = 20
  model = ALS.train(ratings, rank, numIterations)
  testdata = ratings.map(lambda p: (p[0], p[1]))
  predictions = model.predictAll(testdata).map(lambda r: ((r[0], r[1]), r[2]))
  predictions.collect() # shows me some predictions
  model.save(sc, "model0")
  
  # Trying to load saved model and work with it
  model0 = MatrixFactorizationModel.load(sc, "model0")
  predictions0 = model0.predictAll(testdata).map(lambda r: ((r[0], r[1]), r[2]))
  </code></pre>
  
  <p>After I try to use model0 I get a long traceback, which ends with this:</p>
  
  <pre><code>Py4JError: An error occurred while calling o70.predict. Trace:
  py4j.Py4JException: Method predict([class org.apache.spark.api.java.JavaRDD]) does not exist
      at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:333)
      at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:342)
      at py4j.Gateway.invoke(Gateway.java:252)
      at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:133)
      at py4j.commands.CallCommand.execute(CallCommand.java:79)
      at py4j.GatewayConnection.run(GatewayConnection.java:207)
      at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>So my question is - am I doing something wrong? As far as I debugged my models are stored (locally and on HDFS) and they contain many files with some data. I have a feeling that models are saved correctly but probably they aren't loaded correctly. I also googled around but found nothing related. </p>
  
  <p>Looks like this save\load feature has been added recently in Spark 1.3.0 and because of this I have another question - what was the recommended way to save\load models before the release 1.3.0? I haven't found any nice ways to do this, at least for Python. I also tried Pickle, but faced with the same issues as described here <a href="https://stackoverflow.com/questions/28427797/save-apache-spark-mllib-model-in-python">Save Apache Spark mllib model in python</a></p>