Skip to content

Commit

Permalink
fixes: #19 : modified check for predict_fmlearn() check for model exi…
Browse files Browse the repository at this point in the history
…stence
  • Loading branch information
mukeshmk committed Jul 20, 2020
1 parent 9295170 commit da8bf30
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def predict_fmlearn():

data = {}

if fml._new_recs == math.inf:
if not fml.is_model_trained():
data['response'] = 'Model not trained!'
return json.dumps(data)

Expand Down
3 changes: 3 additions & 0 deletions src/fmlearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ def new_record_added(self):
self._new_recs += 1
return

def is_model_trained(self):
return self._model is not None

def load_data(self):
# force new model to be trained once data has been reloaded
# retraining of model occurs only when the predict() function is being called
Expand Down

0 comments on commit da8bf30

Please sign in to comment.