FIX: raise an exception if negative number of samples