Time series cross-validation removing new categories from test
Import TimeSeriesSplit.
Then create an instance of TimeSeriesSplit (set the test size parameter to 1)
Then define a method, which filters out all the unwanted categories from the train and test dataset and outputs your filtered data.
Import cross_validate from scikit-learn, then make sure to call your custom function for every iteration of your cross_validate.

This way you can implement cross validation with minor changes rather than implementing it all from scartch.
I want to use time series cross validation to evaluate my model. I'm trying to leverage TimeSeriesSplit and cross_validate from sklearn.
Let's say my model has features A, B, and others. In practice I want my model only to give predictions for categories A and B seen during training, for all other categories it will raise an error.
How I can cross validate my model enforcing this behaviour? Could I still use the sklearn implementations, adapt them with minor changes or would I have to build my cross validation from scracth?