[SPARK-3550][MLLIB] fix a unresolved reference  variable 'nb' bug

variable nb is not reference in the raise log