Changes to return the confidence of a prediction

An example of usage is added too.