TypeError Traceback (most recent call last)
<ipython-input-76-bf32d5617a63> in <module>()
2
3 filename = "drive/My Drive/Progetto BigData/APPOGGIO/Modelli/SVM/svm_sentiment_analysis"
----> 4 pickle.dump(model, open(filename, "wb"))
TypeError: can't pickle _thread.RLock objects
可以将PICKLE与类似RandomForest的PySPark模型一起使用,还是只能与Scikit学习模型一起使用?
这是我的代码:
from pyspark.ml.classification import RandomForestClassifier
rf = RandomForestClassifier(labelCol = "label", featuresCol = "word2vect", weightCol = "classWeigth", seed = 0, maxDepth=10, numTrees=100, impurity="gini")
model = rf.fit(train_df)
# Save our model into a file with the help of pickle library
filename = "drive/My Drive/Progetto BigData/APPOGGIO/Modelli/SVM/svm_sentiment_analysis"
pickle.dump(model, open(filename, "wb"))
我的环境是Google Colab
我需要将模型转换为一个PICKLE文件来创建一个webapp,要保存它,我通常使用.save(path)方法,在这种情况下我不需要保存
PySpark模型是否可能无法转换为文件?
提前谢谢
目前没有回答
相关问题 更多 >
编程相关推荐