# Is it a cat? - incorrect Probability

Hi,
I am a newbie
Just started with the course 3 days back. trying to generate classifier for Cats based on Lesson 1. Everything went well, but last cell says its a cat, with probability 0? Shouldn’t it be 1?

Not sure what I am missing on

My guess at what is happening here is `0` (in `probs[0]`) is not the correct index for the `cat` class.

Try running this code:

``````is_cat, idx, probs = learn.predict('cat.jpg')
print(f"This is a: {is_cat}.")
print(f"Probability it's a cat: {probs[idx]:.4f}") # use `idx` instead of 0
``````
1 Like

It worked. Thanks a lot!

1 Like

I also tested my model with “cute” cat picture.

• `is_cat` : stores our model’s prediction (about the image) in bool.
(True: Yes its cat) , (False:its not a cat).

• `_` : stores a binary classification (not cat/ is cat) = ( 0 / 1 )

• `prob` : stores an array of probabilities for each class ~ (0/1) ~ (not cat/ is cat)
i.e. probablity of image not being a cat is very low (0.2282) ,
and probability of image being a cat is high (0.7718)

Hence ,

• When its NOT a cat , `prob[idx=0]` tells what is prob. of image not being a cat.
• When its a cat, `prob[idx=1]` tells what is the prob. of image being a cat.
2 Likes