# Path: deepcpg/models/utils.py
# class Model(object):
#     """Abstract model call.
# 
#     Abstract class of DNA, CpG, and Joint models.
# 
#     Parameters
#     ----------
#     dropout: float
#         Dropout rate.
#     l1_decay: float
#         L1 weight decay.
#     l2_decay: float
#         L2 weight decay.
#     init: str
#         Name of Keras initialization.
#     """
# 
#     def __init__(self, dropout=0.0, l1_decay=0.0, l2_decay=0.0,
#                  init='glorot_uniform'):
#         self.dropout = dropout
#         self.l1_decay = l1_decay
#         self.l2_decay = l2_decay
#         self.init = init
#         self.name = self.__class__.__name__
#         self.scope = None
# 
#     def inputs(self, *args, **kwargs):
#         """Return list of Keras model inputs."""
#         pass
# 
#     def _build(self, input, output):
#         """Build final model at the end of `__call__`."""
#         model = km.Model(input, output, name=self.name)
#         if self.scope:
#             for layer in model.layers:
#                 if not is_input_layer(layer):
#                     layer.name = '%s/%s' % (self.scope, layer.name)
#         return model
# 
#     def __call__(self, inputs=None):
#         """Build model.
# 
#         Parameters
#         ----------
#         inputs: list
#             Keras model inputs
#         """
#         pass
# 
# Path: deepcpg/utils.py
# def get_from_module(identifier, module_params, ignore_case=True):
#     """Return object from module.
# 
#     Return object with name `identifier` from module with items `module_params`.
# 
#     Parameters
#     ----------
#     identifier: str
#         Name of object, e.g. a function, in module.
#     module_params: dict
#         `dict` of items in module, e.g. `globals()`
#     ignore_case: bool
#         If `True`, ignore case of `identifier`.
# 
#     Returns
#     -------
#     object
#         Object with name `identifier` in module, e.g. a function or class.
#     """
#     if ignore_case:
#         _module_params = dict()
#         for key, value in six.iteritems(module_params):
#             _module_params[key.lower()] = value
#         _identifier = identifier.lower()
#     else:
#         _module_params = module_params
#         _identifier = identifier
#     item = _module_params.get(_identifier)
#     if not item:
#         raise ValueError('Invalid identifier "%s"!' % identifier)
#     return item


import inspect
from keras import layers as kl
from keras import models as km
from keras import regularizers as kr
from keras.layers.merge import concatenate
from .utils import Model
from ..utils import get_from_module
    def __init__(self, *args, **kwargs):
        super(JointL2h512, self).__init__(*args, **kwargs)
        self.nb_layer = 2


class JointL3h512(JointL1h512):
    """Three fully-connected layers with 512 units.

    .. code::

        Parameters: 1,000,000
        Specification: fc[512]_fc[512]_fc[512]
    """

    def __init__(self, *args, **kwargs):
        super(JointL3h512, self).__init__(*args, **kwargs)
        self.nb_layer = 3


def list_models():
    """Return the name of models in the module."""
    models = dict()
    for name, value in globals().items():
        if inspect.isclass(value) and name.lower().find('model') == -1:
            models[name] = value
    return models


def get(name):
    """Return object from module by its name."""

# Path: deepcpg/models/utils.py
# class Model(object):
#     """Abstract model call.
# 
#     Abstract class of DNA, CpG, and Joint models.
# 
#     Parameters
#     ----------
#     dropout: float
#         Dropout rate.
#     l1_decay: float
#         L1 weight decay.
#     l2_decay: float
#         L2 weight decay.
#     init: str
#         Name of Keras initialization.
#     """
# 
#     def __init__(self, dropout=0.0, l1_decay=0.0, l2_decay=0.0,
#                  init='glorot_uniform'):
#         self.dropout = dropout
#         self.l1_decay = l1_decay
#         self.l2_decay = l2_decay
#         self.init = init
#         self.name = self.__class__.__name__
#         self.scope = None
# 
#     def inputs(self, *args, **kwargs):
#         """Return list of Keras model inputs."""
#         pass
# 
#     def _build(self, input, output):
#         """Build final model at the end of `__call__`."""
#         model = km.Model(input, output, name=self.name)
#         if self.scope:
#             for layer in model.layers:
#                 if not is_input_layer(layer):
#                     layer.name = '%s/%s' % (self.scope, layer.name)
#         return model
# 
#     def __call__(self, inputs=None):
#         """Build model.
# 
#         Parameters
#         ----------
#         inputs: list
#             Keras model inputs
#         """
#         pass
# 
# Path: deepcpg/utils.py
# def get_from_module(identifier, module_params, ignore_case=True):
#     """Return object from module.
# 
#     Return object with name `identifier` from module with items `module_params`.
# 
#     Parameters
#     ----------
#     identifier: str
#         Name of object, e.g. a function, in module.
#     module_params: dict
#         `dict` of items in module, e.g. `globals()`
#     ignore_case: bool
#         If `True`, ignore case of `identifier`.
# 
#     Returns
#     -------
#     object
#         Object with name `identifier` in module, e.g. a function or class.
#     """
#     if ignore_case:
#         _module_params = dict()
#         for key, value in six.iteritems(module_params):
#             _module_params[key.lower()] = value
#         _identifier = identifier.lower()
#     else:
#         _module_params = module_params
#         _identifier = identifier
#     item = _module_params.get(_identifier)
#     if not item:
#         raise ValueError('Invalid identifier "%s"!' % identifier)
#     return item


# Path: deepcpg/models/joint.py
import inspect
from keras import layers as kl
from keras import models as km
from keras import regularizers as kr
from keras.layers.merge import concatenate
from .utils import Model
from ..utils import get_from_module

    def __init__(self, *args, **kwargs):
        super(JointL2h512, self).__init__(*args, **kwargs)
        self.nb_layer = 2


class JointL3h512(JointL1h512):
    """Three fully-connected layers with 512 units.

    .. code::

        Parameters: 1,000,000
        Specification: fc[512]_fc[512]_fc[512]
    """

    def __init__(self, *args, **kwargs):
        super(JointL3h512, self).__init__(*args, **kwargs)
        self.nb_layer = 3


def list_models():
    """Return the name of models in the module."""
    models = dict()
    for name, value in globals().items():
        if inspect.isclass(value) and name.lower().find('model') == -1:
            models[name] = value
    return models


def get(name):
    """Return object from module by its name."""

    return get_from_module(name, globals())