def evaluate(data):
    (total, right) = (0.0, 0.0)
    for (x_true, y_true) in data:
        y_pred = model.predict(x_true).argmax(axis=1)
        y_true = y_true[:, 0]
        total += len(y_true)
        right += (y_true == y_pred).sum()
    return (right / total)
def evaluate(data):
    (total, right) = (0.0, 0.0)
    for (x_true, y_true) in data:
        y_pred = model.predict(x_true).argmax(axis=1)
        y_true = y_true[:, 0]
        total += len(y_true)
        right += (y_true == y_pred).sum()
    return (right / total)