import json


def _scalar_metrics(metrics):
    """ Extract all scalar valued metrics from a MODEL_VALIDATON. """

    data = json.loads(metrics['data'])
    data = json.loads(data['data'])
    
    valid_metrics = []
    for metric,val in data.items():
        # If it can be converted to a float it is a valid, scalar metric
        try:
            val = float(val)
            valid_metrics.append(metric)
        except:
            pass

    return valid_metrics