def trace_to_data(sampling_trace):
    """
    Given a sampling trace, return a list of features and rewards
    """
    features, rewards = {}, {}
    for trace in sampling_trace:
        param = trace['type']
        if param not in features:
            features[param], rewards[param] = {}, {}
        for attr in trace['data']:
            if attr not in features[param]:
                features[param][attr] = []
                rewards[param][attr] = []
            features[param][attr].append(trace['data'][attr])
            rewards[param][attr].append(trace['reward'])

    return features, rewards