bp-kelley / descriptastorus

Descriptor computation(chemistry) and (optional) storage for machine learning
Other
220 stars 62 forks source link

Error in clip sparse? #9

Closed miquelduranfrigola closed 2 years ago

miquelduranfrigola commented 2 years ago

Hi, In the rdDescriptors.py script there is the function:

def clip_sparse(vect, nbits):
    l = [0]*nbits
    for i,v in vect.GetNonzeroElements().items():
        l[i] = v if v > 255 else 255
    return l

I wonder if the greater-than should not be smaller-than: l[i] = v if v < 255 else 255 Also, if np.int8 is used, then the upper limit is 127, right? Thanks!

bp-kelley commented 2 years ago

thanks for the eagle eye, It should be smaller. I switched it to min(v,255). That was a bit boneheaded.

The descriptors, though, are saved as np.uint8 which has range 0-255.