'Log-likelihood of the multinomial logit model.
Parameters
params : array-like
The parameters of the multinomial logit model.
Returns
loglike : float
The log-likelihood function of the model evaluated at `params`.
See notes.
Notes
.. math:: \ln L=\sum_{i=1}^{n}\sum_{j=0}^{J}d_{ij}\ln\left(\frac{\exp\left(\beta_{j}^{\prime}x_{i}\right)}{\sum_{k=0}^{J}\exp\left(\beta_{k}^{\prime}x_{i}\right)}\right)
where :math:`d_{ij}=1` if individual `i` chose alternative `j` and 0
if not.'

def loglike(self, params):

    params = params.reshape(self.K, (-1), order='F')
    d = self.wendog
    logprob = np.log(self.cdf(np.dot(self.exog, params)))
    return np.sum((d * logprob))
