Skip to content

What is the logic behind competence_dist? #72

Description

@jgrizou

Just looked into the competence_dist function: https://github.com/flowersteam/explauto/blob/master/explauto/interest_model/competences.py#L4

def competence_dist(target, reached, dist_min=0., dist_max=1.):
    return (min(- dist_min, - np.linalg.norm(target - reached))) / dist_max

I don't get this division by dist_max, what is it meant for? Also why is the division not casted in float?
It results in very weird behavior like:

competence_dist(0,0,2,10.0) -> -0.2 (expected -2 ?)
competence_dist(0,0,2,10) -> -1 (expected -2 ?)
competence_dist(0,100,0,1) -> -100 (expected -1 ?)

I would have assumed that we rather would like to bound the error between dist_min and dist_max, isn't it? But I might be missing something deeper here.

The patch would be:

def competence_dist(target, reached, dist_min=0., dist_max=1.):
    return max((min(- dist_min, - np.linalg.norm(target - reached))), -dist_max)

I also assume the move to negative domain is because competence should improve when error reduces.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions