scidash / neuronunit

A package for data-driven validation of neuron and ion channel models using SciUnit
http://neuronunit.scidash.org
38 stars 24 forks source link

Double checking sciunit score sort_key values, greater distance from zero greater goodness. #87

Closed russelljjarvis closed 7 years ago

russelljjarvis commented 7 years ago

Hi @rgerkin I just wanted to double check that goodness in the context of score.sort_key.values, is distance from zero in both positive and negative directions? If so when my optimizer encounters a score, as its job is to minimize badness, I divide 1 by the absolute value of the score, and multiply by -1.0. In this way I intend to convert the goodness to absence of badness.

error.append(-1.0/np.abs(my_score))
other_mean = np.mean([i for i in score.sort_key.values.tolist()[0] if type(i) is not type(None)])
    for my_score in score.sort_key.values.tolist()[0]:
        if isinstance(my_score,sciunit.ErrorScore):
            error.append(-100.0)
        elif isinstance(my_score,type(None)):
            error.append(other_mean)
        else:
            # The further away from zero the least the error.
            # achieve this by going 1/RMS
            if my_score == 0:
                error.append(-100.0)
            else:
                error.append(-1.0/np.abs((my_score)))
    #vms.fitness.valid = True
    return error[0],error[1],error[2],error[3],error[4],error[5],error[6],error[7],
rgerkin commented 7 years ago

@russelljjarvis The sort_key should always be a value (or array of values) between 0 and 1, with 1 being good (e.g. Z=0) and 0 being bad (e.g. Z=very positive or very negative). You shouldn't have to do any transformation of it, except perhaps multiplying by -1 if you are trying to minimize the objective function.

The transformation of e.g. Z to the sort_key is done in sciunit.scores, in a different way for each score type. If you are having trouble with any of these we can consider changing it, or you can override it in your own custom Score type.