_score inside function is NaN

Math.log producing an error NaN means that it's argument is less than 0. Do you have documents with negative scores?