nickgillian / grt

gesture recognition toolkit
861 stars 284 forks source link

Way to get distance from prediction to training classes in units of the null rejection threshold? #57

Open damellis opened 8 years ago

damellis commented 8 years ago

I may just be confused, but it seems like the null rejection coefficients supplied to a classifier (w/ setNullRejectionCoeff()) are in different units / scales than the class distances (reported by getClassDistances()). Is there a way to get class distances in numbers that are comparable to the null rejection coefficient supplied? Specifically I've been looking at the ANBC classifier, but maybe it's similar for others?

(It looks like there's a way to directly specify the null rejection thresholds, rather than the null rejection coefficient, but that's not really suitable for my needs because picking the right numbers requires too much knowledge of how the thresholds are calculated from the coefficient and about the actual training data.)

nickgillian commented 8 years ago

For the majority of the classifiers, the null rejection coefficients should be relative to the class distances.

For example, for ANBC, the coefficients are based on:

average_class_distance - (std_dev_class_distance * null_rejection_coeff)

where: average_class_distance: is the average class distance for class K over the training data given the model std_dev_class_distance: is the standard deviation for class K over the training data given the model null_rejection_coeff: is the null rejection scalar that controls 'how close' an input sample needs to be to the model to be considered a valid prediction.

damellis commented 8 years ago

That makes sense. My question is whether there's a standard / simple way to translate from the values returned by getClassDistances() into the range of null rejection coefficients. For instance, for ANBC, I think this would be something like: (class_distance - average_class_distance) / std_dev_class_distance. But that requires (I think) doing the calculation to figure out what average_class_distance and std_dev_class_distance are. Plus, I'm not sure if this calculation would apply to other classifiers.