My question is more theoretical than practical. Let's say that I am training my cat classifier with a dataset that I feel is pretty representative of cat images in general. But then a new breed of cat is created that is distinct from other cats and it does not exist in my dataset.

My question is: is there a way to ensure that my model is still able to recognize this unseen breed, even though I didn't know it would come into existence when I originally trained my model?

I have been trying to answer this question by intentionally designing my validation and test sets such that they contain examples that are quite distantly related to those that exist in the training set (think of it like intentionally leaving out specific breeds of cats from the training set).

The results are interesting. For example, slight changes to parameters can dramatically change performance on the distantly related test examples, while not changing performance very much for the more closely related examples. I was wondering if anyone has done a deeper analysis of this phenomenon.

  • $\begingroup$ I am tempted to conclude that the best way to ensure that the network still performs well on unseen examples is to regularize it as much as possible (Dropout rate of 0.5 at every layer, for example). Do you think this intuition is correct? $\endgroup$
    – mdurrant
    Feb 25, 2020 at 18:01
  • $\begingroup$ Dropout is just one way of introducing a regularization effect. There are others. Dropout should help to avoid overfitting and thus the network shouldn't memorize the training dataset (i.e. approximate the function that the training set represents), but, instead, approximate a different function (not the one represented by the training set). Clearly, this should help to predict something that isn't in the training set, but this will not ensure that a specific unseen example will be predicted correctly. $\endgroup$
    – nbro
    Feb 25, 2020 at 18:32
  • $\begingroup$ So assume the typical train-dev-test paradigm, where all three sets have unique examples but are drawn from the same distribution. With a neural network, you can easily overfit to those particular examples that exist in the training set if you don't regularize the parameters. Regularization allows the model to learn a more generalizable function. But if an unseen example that is not well represented in the train, dev, or test sets is introduced, how can we ensure that the model will be more likely to generalize to this distantly related, new example? $\endgroup$
    – mdurrant
    Feb 25, 2020 at 21:28
  • 1
    $\begingroup$ The term regularization is often used ambiguously. For example, in L1 or L2 regularization, the goal is to constrain the parameters to lie in a certain range. In other cases, for example, in the case of dropout, the idea is that you attempt to decorrelate the units of the network (by randomly dropping or killing them during training). In the case of Bayesian neural networks, the regularisation is said to be integrated into the networks because they are based on Bayes rule, so, in a certain way, the uncertainty associated with the learned distributions depends on the available data. $\endgroup$
    – nbro
    Feb 25, 2020 at 21:38
  • 1
    $\begingroup$ To answer your question directly, regularization may help, but it may depend on the regularization that you use. $\endgroup$
    – nbro
    Feb 25, 2020 at 21:40

1 Answer 1


The comments already are giving you some good tips about how to improve what your model recognizes, but I think your question goes above that asking if there's a way to ensure that it will always recognize the cats.

The short answer is "no".

The slightly longer answer is "yes, but cheating".

Regardless, there are a lot of steps you might take to improve the generalization aspect of your model.

Long answer:

A drama: cat classification in three acts

Act I: Cat as texts

Let's start with an example. Say that your model is trained with these inputs, and learns to correctly recognize them as a cat or not a cat:

cat → yes!
Cat → yes!
ferret → no
cat. → yes!
Cat! → yes!
Three MC's and one DJ → no

Your goal is to train your model so that every new variation, even unseen ones, will correctly be identified.

With a good level of generalization, your model will correctly classify new inputs that it has never seen before:

skunk → no
cat? → yes!
dog → no
CAT → yes

With this scenario, let's say the model now finds this:

kat → ?

Is that a "cat" misspelled? Is that short for Katherine? What should the model do?

Act II: But surely this doesn't happen in real life

Leaving the analogy for a bit, will your model that's looking at domestic cats properly accommodate for Savannah Cats, or will it consider them out? (They kind of look like cheetahs.) What about Sphinx cats? (They look like raw chicken to me.) Elf cats? (They look like bats.) This is just an example, but you can probably figure out more.

And the reason behind this problem is that the distinction itself between different classifications (in real life) is not binary, but rather a transition between "yes, that's a textbook cat" and "that's a chair". Your model will output binary decisions (maybe accompanied by a confidence interval, but even with it, you'll make the call into deciding if it's a cat or not).

Setting specific boundaries will help. You can define that your model will only detect domestic cats, maybe no bigger than a certain size, only of certain colors, etc... This is limiting what the model will correctly recognize as a cat when we (humans) might disagree. For instance, I would still argue that flourescent cats are still cats.

Going back to the simple text analogy, this is similar to deciding that to be detected as a cat, it has to start with a "c". So now you've discarded ¡Cat!.

In this way, it's not possible to ensure (notice the word) that your model will detect all of these unknown variations. There will be always some room for error that needs to be accepted, as long as the errors are infrequent or rare enough that they can be accepted as a regular part of the model.

Act III: Concept drift, a cautionary tale

Finally, the problem becomes even harder as we might be dealing with concepts that change over time, outside of the knowledge of the model, and outside of the knowledge of the person that supervised the model learning.

As and the breeds of cat changes, your model will have to accommodate by what we (users of the model) consider a valid definition of cat. Which might change in really unexpected ways and not really "look" like a cat. And since your model can only learn from what "looks" like a cat, it's always held in a disadvantaged position.

This will happen with almost any machine learning model that is approximating a result, regardless of the technique/algorithm. Approximations include a level of error because reality is usually complex in ways that we either don't know about or that are too computationally expensive.

  • $\begingroup$ I think that explaining by example is usually easier to grasp, so I thought it would make a better answer. However, being an example it doesn't really tackle the underlying issues with model errors in detail, leaving it incomplete. If readers want to expand on it, please, feel free to do so. $\endgroup$
    – Alpha
    Feb 26, 2020 at 22:16
  • 1
    $\begingroup$ Thank you for this answer! Definitely got me thinking, much appreciated. $\endgroup$
    – mdurrant
    Feb 27, 2020 at 0:16
  • 1
    $\begingroup$ @mdurrant I'm glad! In your particular case, I would suggest just setting up acceptable boundaries and moving forward. Yes, the model might not be future-proof of 100% accurate... but it still might be useful! $\endgroup$
    – Alpha
    Feb 27, 2020 at 13:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .