machine learning - Python program running in memory -
i have python program loads logistic regression model. trying make prediction new incoming data every 5 seconds. incoming data passed code command line argument. program runs ok dont want keep loading model every 5 seconds. there way have model loaded in memory? code below
loaded_model = joblib.load(r'c:\lr_model.sav') dataset = ast.literal_eval(sys.argv[1]) result = loaded_model.predict(dataset)
thank you
memory bound process, once process exits it's memory freed. if want keep data loaded, you'll need rewrite program server process , setup communication protocol client ask new prediction (http seems fit here).
Comments
Post a Comment