Skip to content

Commit

Permalink
Cache individual preds
Browse files Browse the repository at this point in the history
  • Loading branch information
rajpurkar committed Apr 23, 2017
1 parent e8f88f1 commit d9f3ea9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions ecg/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@


@memory.cache
def get_ensemble_pred_probs(model_paths, x, geo_mean=False):
print("Averaging " + str(len(model_paths)) + " model predictions...")
def get_model_pred_probs(model_path, x):
from keras.models import load_model
model = load_model(model_path)
probs = model.predict(x, verbose=1)
return probs

def get_model_pred_probs(model_path, x):
from keras.models import load_model
model = load_model(model_path)
probs = model.predict(x, verbose=1)
return probs

def get_ensemble_pred_probs(model_paths, x, geo_mean=False):
print("Averaging " + str(len(model_paths)) + " model predictions...")
all_model_probs = [get_model_pred_probs(model_path, x)
for model_path in model_paths]
if geo_mean is True:
Expand Down

0 comments on commit d9f3ea9

Please sign in to comment.