How to do prediction with Sklearn Model inside Spark?
问题 I have trained a model in python using sklearn. How we can use same model to load in Spark and generate predictions on a spark RDD ? 回答1: Well, I will show an example of linear regression in Sklearn and show you how to use that to predict elements in Spark RDD. First training the model with sklearn example: # Create linear regression object regr = linear_model.LinearRegression() # Train the model using the training sets regr.fit(diabetes_X_train, diabetes_y_train) Here we just have the fit,