update the prediction function for back compatibility with older version of sklearn