def fit(self, X, all_y): converted = False if len(all_y.shape) == 1: converted = True else: n, n_codes = all_y.shape if n_codes == 1: converted = True if converted: SparseModel.fit(self, X, all_y) else: powerset_y = self.binary_vectors_to_powerset_list(all_y) SparseModel.fit(self, X, powerset_y)