# Path: pyglm/components/component.py
# class Component(object):
#     """
#     """
#     
#     def __init__(self, model):
#         """ Initialize the component with the parameters from the given model.
#         """
#         pass
#     
#     def get_variables(self):
#         """ Get a dictionary of (name : Theano variable) items for all the
#             symbolic variables associated with this component.
#         """
#         return {}
#     
#     def get_state(self):
#         return {}
# 
#     def preprocess_data(self, data):
#         """ Set the shared memory variables that depend on the data
#         """
#         pass
# 
#     def set_data(self, data):
#         """ Set the shared memory variables that depend on the data
#         """
#         pass
#     
#     def set_hyperparameters(self, model):
#         """ Set hyperparameters of the model
#         """
#         pass
# 
#     def sample(self, acc):
#         """
#         return a sample of the variables
#                 """
#         return {}


import numpy as np
import theano.tensor as T
from pyglm.components.component import Component



def create_nlin_component(model):
    type = model['nonlinearity']['type'].lower()
    if type == 'exp':
        nlin = ExpNonlinearity(model)
    elif type == 'explinear':
        nlin = ExpLinearNonlinearity(model)
    else:
        raise Exception("Unrecognized nonlinearity model: %s" % type)
    return nlin

class ExpNonlinearity(Component):
    """ Standard exponential nonlinearity.
    """

    def __init__(self, model):
        """ Initialize the component with the parameters from the given model,
        the vector of symbolic variables, vars, and the offset into that vector, offset.
        """
        self.nlin = T.exp
        self.log_p = T.constant(0.)


        self.f_nlin = np.exp



# Path: pyglm/components/component.py
# class Component(object):
#     """
#     """
#     
#     def __init__(self, model):
#         """ Initialize the component with the parameters from the given model.
#         """
#         pass
#     
#     def get_variables(self):
#         """ Get a dictionary of (name : Theano variable) items for all the
#             symbolic variables associated with this component.
#         """
#         return {}
#     
#     def get_state(self):
#         return {}
# 
#     def preprocess_data(self, data):
#         """ Set the shared memory variables that depend on the data
#         """
#         pass
# 
#     def set_data(self, data):
#         """ Set the shared memory variables that depend on the data
#         """
#         pass
#     
#     def set_hyperparameters(self, model):
#         """ Set hyperparameters of the model
#         """
#         pass
# 
#     def sample(self, acc):
#         """
#         return a sample of the variables
#                 """
#         return {}


# Path: pyglm/components/nlin.py
import numpy as np
import theano.tensor as T
from pyglm.components.component import Component




def create_nlin_component(model):
    type = model['nonlinearity']['type'].lower()
    if type == 'exp':
        nlin = ExpNonlinearity(model)
    elif type == 'explinear':
        nlin = ExpLinearNonlinearity(model)
    else:
        raise Exception("Unrecognized nonlinearity model: %s" % type)
    return nlin

class ExpNonlinearity(Component):
    """ Standard exponential nonlinearity.
    """

    def __init__(self, model):
        """ Initialize the component with the parameters from the given model,
        the vector of symbolic variables, vars, and the offset into that vector, offset.
        """
        self.nlin = T.exp
        self.log_p = T.constant(0.)


        self.f_nlin = np.exp



class ExpLinearNonlinearity(Component):