Hi, I am trying to save a TF-IDF model in PySpark. Looks like this is not supported.
Using `model.save()` causes: AttributeError: 'IDFModel' object has no attribute 'save' Using `pickle` causes: TypeError: can't pickle lock objects Does anyone have suggestions Thanks! Asim Here is the full repro. Start pyspark shell and then run this code in it. ``` # Imports from pyspark import SparkContext from pyspark.mllib.feature import HashingTF from pyspark.mllib.regression import LabeledPoint from pyspark.mllib.regression import Vectors from pyspark.mllib.feature import IDF # Create some data n = 4 freqs = [ Vectors.sparse(n, (1, 3), (1.0, 2.0)), Vectors.dense([0.0, 1.0, 2.0, 3.0]), Vectors.sparse(n, [1], [1.0])] data = sc.parallelize(freqs) idf = IDF() model = idf.fit(data) tfidf = model.transform(data) # View for r in tfidf.collect(): print(r) # Try to save it model.save("foo.model") # Try to save it with Pickle import pickle pickle.dump(model, open("model.p", "wb")) pickle.dumps(model) ```