# Path: pystruct/utils/inference.py
# def inference(model, x, w, constraints=None):
#     if constraints:
#         return model.inference(x, w, constraints=constraints)
#     else:
#         return model.inference(x, w)


import numpy as np
from sklearn.externals.joblib import Parallel, delayed
from sklearn.base import BaseEstimator
from ..utils import inference, objective_primal
    def __init__(self, model, max_iter=100, C=1.0, verbose=0,
                 n_jobs=1, show_loss_every=0, logger=None):
        self.model = model
        self.max_iter = max_iter
        self.C = C
        self.verbose = verbose
        self.show_loss_every = show_loss_every
        self.n_jobs = n_jobs
        self.logger = logger

    def predict(self, X, constraints=None):
        """Predict output on examples in X.

        Parameters
        ----------
        X : iterable
            Traing instances. Contains the structured input objects.

        constraints : None or a list of hard logic constraints

        Returns
        -------
        Y_pred : list
            List of inference results for X using the learned parameters.

        """
        verbose = max(0, self.verbose - 3)
        if self.n_jobs != 1:
            if constraints:
                prediction = Parallel(n_jobs=self.n_jobs, verbose=verbose)(

# Path: pystruct/utils/inference.py
# def inference(model, x, w, constraints=None):
#     if constraints:
#         return model.inference(x, w, constraints=constraints)
#     else:
#         return model.inference(x, w)


# Path: pystruct/learners/ssvm.py
import numpy as np
from sklearn.externals.joblib import Parallel, delayed
from sklearn.base import BaseEstimator
from ..utils import inference, objective_primal

    def __init__(self, model, max_iter=100, C=1.0, verbose=0,
                 n_jobs=1, show_loss_every=0, logger=None):
        self.model = model
        self.max_iter = max_iter
        self.C = C
        self.verbose = verbose
        self.show_loss_every = show_loss_every
        self.n_jobs = n_jobs
        self.logger = logger

    def predict(self, X, constraints=None):
        """Predict output on examples in X.

        Parameters
        ----------
        X : iterable
            Traing instances. Contains the structured input objects.

        constraints : None or a list of hard logic constraints

        Returns
        -------
        Y_pred : list
            List of inference results for X using the learned parameters.

        """
        verbose = max(0, self.verbose - 3)
        if self.n_jobs != 1:
            if constraints:
                prediction = Parallel(n_jobs=self.n_jobs, verbose=verbose)(

                    delayed(inference)(self.model, x, self.w, constraints=c)