# Path: glimix_core/link/_link.py
# class IdentityLink(object):
#     """
#     Identity link function, g(x) = x.
#     """
# 
#     @_value_doc
#     def value(self, x):
#         return asarray(x, float)
# 
#     @_inv_doc
#     @staticmethod
#     def inv(x):
#         return asarray(x, float)
# 
# class LogitLink(object):
#     """
#     Logit link function, g(x) = log(x/(1 - x)).
#     """
# 
#     @_value_doc
#     def value(self, x):
#         return asarray(log(x / (1 - x)), float)
# 
#     @_inv_doc
#     @staticmethod
#     def inv(x):
#         return asarray(1 / (1 + exp(-x)), float)
# 
# class LogLink(object):
#     """
#     Log link function, g(x) = log(x).
#     """
# 
#     @_value_doc
#     def value(self, x):
#         return asarray(log(x), float)
# 
#     @_inv_doc
#     @staticmethod
#     def inv(x):
#         return asarray(exp(x), float)


from numpy import ascontiguousarray
from ..link import IdentityLink, LogitLink, LogLink
        import scipy.stats as st
        import scipy.stats as st
        import scipy.stats as st
        r"""Mean of the number of successful trials."""
        return self._link.inv(x)

    @_sample_doc
    def sample(self, x, random_state=None):

        p = self.mean(x)
        nt = ascontiguousarray(self._ntrials, dtype=int)
        return _aca(st.binom(nt, p).rvs(random_state=random_state))

    @property
    def sample_size(self):
        r"""Get the number of samples."""
        assert self.nsuccesses is not None
        return len(self.nsuccesses)


class PoissonProdLik(object):
    r"""
    Product of Poisson likelihoods.

    Parameters
    ----------
    link : link_func
        Link function establishing :math:`g(y_i) = x_i`. Defaults to ``None``, which
        leads to the :class:`glimix_core.link.LogitLink` link function.
    """

    def __init__(self, link=None):
        if link is None:

# Path: glimix_core/link/_link.py
# class IdentityLink(object):
#     """
#     Identity link function, g(x) = x.
#     """
# 
#     @_value_doc
#     def value(self, x):
#         return asarray(x, float)
# 
#     @_inv_doc
#     @staticmethod
#     def inv(x):
#         return asarray(x, float)
# 
# class LogitLink(object):
#     """
#     Logit link function, g(x) = log(x/(1 - x)).
#     """
# 
#     @_value_doc
#     def value(self, x):
#         return asarray(log(x / (1 - x)), float)
# 
#     @_inv_doc
#     @staticmethod
#     def inv(x):
#         return asarray(1 / (1 + exp(-x)), float)
# 
# class LogLink(object):
#     """
#     Log link function, g(x) = log(x).
#     """
# 
#     @_value_doc
#     def value(self, x):
#         return asarray(log(x), float)
# 
#     @_inv_doc
#     @staticmethod
#     def inv(x):
#         return asarray(exp(x), float)


# Path: glimix_core/lik/_prod.py
from numpy import ascontiguousarray
from ..link import IdentityLink, LogitLink, LogLink
        import scipy.stats as st
        import scipy.stats as st
        import scipy.stats as st

        r"""Mean of the number of successful trials."""
        return self._link.inv(x)

    @_sample_doc
    def sample(self, x, random_state=None):

        p = self.mean(x)
        nt = ascontiguousarray(self._ntrials, dtype=int)
        return _aca(st.binom(nt, p).rvs(random_state=random_state))

    @property
    def sample_size(self):
        r"""Get the number of samples."""
        assert self.nsuccesses is not None
        return len(self.nsuccesses)


class PoissonProdLik(object):
    r"""
    Product of Poisson likelihoods.

    Parameters
    ----------
    link : link_func
        Link function establishing :math:`g(y_i) = x_i`. Defaults to ``None``, which
        leads to the :class:`glimix_core.link.LogitLink` link function.
    """

    def __init__(self, link=None):
        if link is None:

            link = LogLink()