I have simple Python app. take ratings.csv which has user_id, product_id, rating which contains 4 M record then I use Spark AlS and save the model, then I load it to matrixFactorization.
my problem with method predicts which takes more than one second to predict the rating between user and product. my server is 32 G and 8 cores. any suggestion how I can enhance the prediction time to be less than 100milisecond. and what the relationship between a number of records in the data set and the prediction time.
Here is what I am doing :
spark_config = SparkConf().setAll([('spark.executor.memory', '32g'), ('spark.cores.max', '8')])
als_recommender.sc = SparkContext(conf=spark_config) #training_data is array of tulips of 4 M record
training_data = als_recommender.sc.parallelize(training_data) als_recommender.model = ALS.trainImplicit(training_data, 10, 10, nonnegative=True)
als_recommender.model.save(als_recommender.sc, "....Ameer/als_model")
als_recommender_model = MatrixFactorizationModel.load(als_recommender.sc, "....Ameer/als_model")
als_recommender_model.predict(1,2913)