I think this would be cleaner and faster with a set
```
all_classes = set(range(n_classes)
missing = all_classes.difference(estimator.classes_)
```