LCSL / GURLS

GURLS: a Least Squares Library for Supervised Learning
http://lcsl.mit.edu/#/downloads/gurls
63 stars 37 forks source link

"set accuracy =1 on classes with no samples" *may* not be correct #31

Open raffaello-camoriano opened 6 years ago

raffaello-camoriano commented 6 years ago

I might be wrong, but this line doesn't seem to be setting the right elements of perClass to 1.

https://github.com/LCSL/GURLS/blob/d9d0d311dda967b2967979e74591c4a68e2518b2/gurls%2B%2B/include/gurls%2B%2B/macroavg.h#L312

I suggest to do:

        if (*den == 0.0)
        {
            // Set accuracy =1 on classes with no sampless
            perClass[i] = (T)1.0;
        }
        else
        {
            perClass[i] = ((T)(*num))/((*den) + std::numeric_limits<T>::epsilon());
        }