def fit(self, X, Y, H_init=None, initialize=True):
        """Learn parameters using the concave-convex procedure.

        If no H_init is given, the latent variables are initialized
        using the ``init_latent`` method of the model.

        Parameters
        ----------
        X : iterable
            Traing instances. Contains the structured input objects.
            No requirement on the particular form of entries of X is made.

        Y : iterable
            Training labels. Contains the strctured labels for inputs in X.
            Needs to have the same length as X.

        H_init : iterable, optional
            Initial values for the latent variables.

        initialize : boolean, default=True
            Whether to initialize the model for the data.
            Leave this true except if you really know what you are doing.
        """

        self.model.initialize(X, Y)
        w = np.zeros(self.model.size_joint_feature)
        constraints = None
        ws = []
        if H_init is None:
            H_init = self.model.init_latent(X, Y)
        self.H_init_ = H_init
        H = H_init

        for iteration in range(self.latent_iter):
            if self.verbose:
                print("LATENT SVM ITERATION %d" % iteration)
            # find latent variables for ground truth:
            if iteration == 0:
                pass
            else:
                H_new = [self.model.latent(x, y, w) for x, y in zip(X, Y)]
                changes = [np.any(h_new != h) for h_new, h in zip(H_new, H)]
                if not np.any(changes):
                    if self.verbose > 0:
                        print("no changes in latent variables of ground truth."
                              " stopping.")
                    break
                if self.verbose:
                    print(np.sum(changes) % "changes in H: %d")

                # update constraints:
                if isinstance(self.base_ssvm, NSlackSSVM):
                    constraints = [[] for i in range(len(X))]
                    for sample, h, i in zip(self.base_ssvm.constraints_, H_new,
                                            np.arange(len(X))):
                        for constraint in sample:
                            const = find_constraint(self.model, X[i], h, w,
                                                    constraint[0])
                            y_hat, djoint_feature, _, loss = const
                            constraints[i].append([y_hat, djoint_feature, loss])
                H = H_new
            if iteration > 0:
                self.base_ssvm.fit(X, H, constraints=constraints,
                                   warm_start="soft", initialize=False)
            else:
                self.base_ssvm.fit(X, H, constraints=constraints,
                                   initialize=False)
            w = self.base_ssvm.w
            ws.append(w)
            if self.logger is not None:
                self.logger(self, iteration)
dataset/ETHPy150Open pystruct/pystruct/pystruct/learners/latent_structured_svm.py/LatentSSVM.fit/swapped operands of `%`