Guest User

Untitled

a guest
May 27th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. import pickle
  2. import os
  3.  
  4.  
  5. class PredictionModel:
  6. model = None
  7.  
  8. def __init__(self, id_model="rf_model"):
  9.  
  10. with open(os.path.join(os.path.dirname(__file__), id_model + ".pkl"), 'rb') as fin:
  11. self.model = pickle.load(fin)
  12.  
  13. def predict(self, testing_data):
  14. prediction = self.model.predict(testing_data)
  15. return prediction
  16.  
  17. def convert_to_json(self, df):
  18. return df.to_json()
Add Comment
Please, Sign In to add comment