'Transform constrained parameters used in likelihood evaluation
to unconstrained parameters used by the optimizer
Parameters
constrained : array_like
Array of constrained parameters used in likelihood evalution, to be
transformed.
Returns
unconstrained : array_like
Array of unconstrained parameters used by the optimizer.
Notes
In the base class, this only untransforms the transition-probability-
related parameters.'

def untransform_params(self, constrained):

    unconstrained = np.array(constrained, copy=True)
    unconstrained = unconstrained.astype(np.promote_types(np.float64, unconstrained.dtype))
    if self.tvtp:
        unconstrained[self.parameters['regime_transition']] = constrained[self.parameters['regime_transition']]
    else:
        for i in range(self.k_regimes):
            s = self.parameters[(i, 'regime_transition')]
            if (self.k_regimes == 2):
                unconstrained[s] = (- np.log(((1.0 / constrained[s]) - 1)))
            else:
                from scipy.optimize import root
                out = root(self._untransform_logistic, np.zeros(unconstrained[s].shape, unconstrained.dtype), args=(constrained[s],))
                if (not out['success']):
                    raise ValueError('Could    not    untransform    parameters.')
                unconstrained[s] = out['x']
    return unconstrained
