# Path: pyglm/utils/basis.py
# def create_basis(prms):
#     """ Create a basis for impulse response functions
#     """
#     type = prms['type'].lower()
#     if type == 'exp':
#         basis = create_exp_basis(prms)
#     elif type == 'cosine':
#         basis = create_cosine_basis(prms)
#     elif type == 'gaussian':
#         basis = create_gaussian_basis(prms)
#     elif type == 'identity' or type == 'eye':
#         basis = create_identity_basis(prms)
#     elif type == 'file':
#         if os.path.exists(prms["fname"]):
#             basis = load_basis_from_file(prms['fname'])
#     else:
#         raise Exception("Unrecognized basis type: %s", type)
#     return basis
# 
# Path: pyglm/components/priors.py
# def create_prior(model, **kwargs):
#     typ = model['type'].lower()
#     if typ == 'normal' or \
#        typ == 'gaussian':
#        return Gaussian(model, **kwargs)
#     elif typ == 'categorical':
#        return Categorical(model, **kwargs)
#     elif typ == 'jointcategorical' or \
#          typ == 'joint_categorical':
#        return JointCategorical(model, **kwargs)
#     elif typ == 'spherical_gaussian':
#         return SphericalGaussian(model, **kwargs)
#     elif typ == 'group_lasso' or \
#          typ == 'grouplasso':
#         return GroupLasso(model, **kwargs)
#     elif typ == 'dpp':
#         return DeterminenalPointProcess(model, **kwargs)
#     elif typ == 'dirichlet':
#         return Dirichlet(model)
#     else:
#         raise Exception("Unrecognized prior type: %s" % typ)


import numpy as np
import theano.tensor as T
from component import Component
from pyglm.utils.basis import create_basis
from pyglm.components.priors import create_prior
        from pyglm.components.priors import Categorical, JointCategorical
    def sample(self, acc):
        s = {}
        for (name, comp) in self.latentdict.items():
            s[name] = comp.sample(acc)
        return s

    def set_data(self, data):
        for comp in self.latentlist:
            comp.set_data(data)

    # Allow consumers to access this container as a dict
    def __getitem__(self, item):
        return self.latentdict[item]

class LatentType(Component):
    def __init__(self, model, type_model):
        self.model = model
        self.type_model = type_model
        self.name = self.type_model['name']

        # There are N neurons to assign types to
        self.N = type_model['N']

        # There are has R latent types
        self.R = self.type_model['R']
        # Each neuron has a latent type Y
        self.Y = T.lvector('Y')

        # A probability of each type with a symmetric Dirichlet prior
        self.alpha = T.dvector('alpha')

# Path: pyglm/utils/basis.py
# def create_basis(prms):
#     """ Create a basis for impulse response functions
#     """
#     type = prms['type'].lower()
#     if type == 'exp':
#         basis = create_exp_basis(prms)
#     elif type == 'cosine':
#         basis = create_cosine_basis(prms)
#     elif type == 'gaussian':
#         basis = create_gaussian_basis(prms)
#     elif type == 'identity' or type == 'eye':
#         basis = create_identity_basis(prms)
#     elif type == 'file':
#         if os.path.exists(prms["fname"]):
#             basis = load_basis_from_file(prms['fname'])
#     else:
#         raise Exception("Unrecognized basis type: %s", type)
#     return basis
# 
# Path: pyglm/components/priors.py
# def create_prior(model, **kwargs):
#     typ = model['type'].lower()
#     if typ == 'normal' or \
#        typ == 'gaussian':
#        return Gaussian(model, **kwargs)
#     elif typ == 'categorical':
#        return Categorical(model, **kwargs)
#     elif typ == 'jointcategorical' or \
#          typ == 'joint_categorical':
#        return JointCategorical(model, **kwargs)
#     elif typ == 'spherical_gaussian':
#         return SphericalGaussian(model, **kwargs)
#     elif typ == 'group_lasso' or \
#          typ == 'grouplasso':
#         return GroupLasso(model, **kwargs)
#     elif typ == 'dpp':
#         return DeterminenalPointProcess(model, **kwargs)
#     elif typ == 'dirichlet':
#         return Dirichlet(model)
#     else:
#         raise Exception("Unrecognized prior type: %s" % typ)


# Path: pyglm/components/latent.py
import numpy as np
import theano.tensor as T
from component import Component
from pyglm.utils.basis import create_basis
from pyglm.components.priors import create_prior
        from pyglm.components.priors import Categorical, JointCategorical

    def sample(self, acc):
        s = {}
        for (name, comp) in self.latentdict.items():
            s[name] = comp.sample(acc)
        return s

    def set_data(self, data):
        for comp in self.latentlist:
            comp.set_data(data)

    # Allow consumers to access this container as a dict
    def __getitem__(self, item):
        return self.latentdict[item]

class LatentType(Component):
    def __init__(self, model, type_model):
        self.model = model
        self.type_model = type_model
        self.name = self.type_model['name']

        # There are N neurons to assign types to
        self.N = type_model['N']

        # There are has R latent types
        self.R = self.type_model['R']
        # Each neuron has a latent type Y
        self.Y = T.lvector('Y')

        # A probability of each type with a symmetric Dirichlet prior
        self.alpha = T.dvector('alpha')

        self.alpha_prior = create_prior(self.type_model['alpha_prior'])