Factorize common classes checks in partial_fit implementations