# Path: reggie/core/params.py
# class Parameterized(object):
#     """
#     Representation of a parameterized object.
#     """
#     def __init__(self):
#         super(Parameterized, self).__init__()
#         self.params = Parameters(self)
# 
#     def __info__(self):
#         return []
# 
#     def __repr__(self):
#         typename = self.__class__.__name__
#         parts = []
#         for name, param in self.__info__():
#             if isinstance(param, np.ndarray):
#                 if param.shape == ():
#                     value = '{:.2f}'.format(param.flat[0])
#                 else:
#                     value = '[' * param.ndim
#                     value += ', '.join('{:.2f}'.format(_)
#                                        for _ in param.flat[:2])
#                     if param.size > 3:
#                         value += ', ..., '
#                     if param.size > 2:
#                         value += '{:.2f}'.format(param.flat[-1])
#                     value += ']' * param.ndim
#             else:
#                 value = repr(param)
#             parts.append('{:s}={:s}'.format(name, value))
#         nintro = len(typename) + 1
#         nchars = nintro + 1 + sum(len(_)+2 for _ in parts)
#         split = any('\n' in _ for _ in parts)
#         if nchars > 80 or split:
#             sep = '\n' + ' ' * nintro
#             parts = [sep.join(_.split('\n')) for _ in parts]
#             sep = ',' + sep
#         else:
#             sep = ', '
#         return typename + '(' + sep.join(parts) + ')'
# 
#     def __deepcopy__(self, memo):
#         # create a new instance of the object and save it in the memo
#         # dictionary as well. this must be done first so that when we copy the
#         # Parameters object it refers to the correct object instance.
#         obj = memo[id(self)] = type(self).__new__(type(self))
# 
#         # make sure to copy the parameters first. these are stored in the memo
#         # dictionary so we don't need to explicitly save them
#         copy.deepcopy(self.params, memo)
# 
#         # copy the rest of the objects in this Parameterized instance
#         for key, val in self.__dict__.items():
#             setattr(obj, key, copy.deepcopy(val, memo))
#         return obj
# 
#     def copy(self, theta=None, transform=False):
#         """
#         Return a copy of the object. If `theta` is given then update the
#         parameters of the copy; if `transform` is True then these parameters
#         are in the transformed space.
#         """
#         obj = copy.deepcopy(self)
#         if theta is not None:
#             obj.params.set_value(theta, transform)
#         return obj
# 
#     def _update(self):
#         """
#         Update any internal parameters (sufficient statistics, etc.).
#         """
#         pass
# 
#     def _register(self, name, param, domain=REAL, shape=()):
#         """
#         Register a real-valued set of parameters.
#         """
#         # the shape parameter should either be an integer or an iterable object
#         # of integers or characters
#         shape = (shape,) if isinstance(shape, int) else shape
#         ndmin = len(shape)
# 
#         try:
#             param = np.array(param, dtype=float, copy=True, ndmin=ndmin)
#         except (TypeError, ValueError):
#             raise ValueError("parameter '{:s}' not array-like".format(name))
# 
#         # construct the desired shape
#         shapes = dict()
#         shape_ = tuple(
#             (shapes.setdefault(d, d_) if isinstance(d, str) else d)
#             for (d, d_) in zip(shape, param.shape))
# 
#         # check the size of the parameter
#         if param.shape != shape_:
#             raise ValueError("parameter '{:s}' does not have shape ({:s})"
#                              .format(name, ', '.join(map(str, shape))))
# 
#         # save the parameter
#         # pylint: disable=protected-access
#         self.params._register(name, Parameter(param, domain))
# 
#         # return the array
#         return param
# 
#     def _register_obj(self, name, param, klass=None):
#         """
#         Register a parameterized object.
#         """
#         if klass is not None and not isinstance(param, klass):
#             msg = "'{:s}' must be of type {:s}"
#             raise ValueError(msg.format(name, klass.__name__))
# 
#         if not isinstance(param, Parameterized):
#             msg = "'{:s}' must be of type Parameterized"
#             raise ValueError(msg.format(name))
# 
#         param = param.copy()
#         # pylint: disable=protected-access
#         self.params._register(name, param.params)
#         return param


import numpy as np
from ..core.params import Parameterized
"""
Definition of the function interface.
"""

from __future__ import division
from __future__ import absolute_import
from __future__ import print_function



__all__ = ['Mean']


### BASE KERNEL INTERFACE #####################################################


# Path: reggie/core/params.py
# class Parameterized(object):
#     """
#     Representation of a parameterized object.
#     """
#     def __init__(self):
#         super(Parameterized, self).__init__()
#         self.params = Parameters(self)
# 
#     def __info__(self):
#         return []
# 
#     def __repr__(self):
#         typename = self.__class__.__name__
#         parts = []
#         for name, param in self.__info__():
#             if isinstance(param, np.ndarray):
#                 if param.shape == ():
#                     value = '{:.2f}'.format(param.flat[0])
#                 else:
#                     value = '[' * param.ndim
#                     value += ', '.join('{:.2f}'.format(_)
#                                        for _ in param.flat[:2])
#                     if param.size > 3:
#                         value += ', ..., '
#                     if param.size > 2:
#                         value += '{:.2f}'.format(param.flat[-1])
#                     value += ']' * param.ndim
#             else:
#                 value = repr(param)
#             parts.append('{:s}={:s}'.format(name, value))
#         nintro = len(typename) + 1
#         nchars = nintro + 1 + sum(len(_)+2 for _ in parts)
#         split = any('\n' in _ for _ in parts)
#         if nchars > 80 or split:
#             sep = '\n' + ' ' * nintro
#             parts = [sep.join(_.split('\n')) for _ in parts]
#             sep = ',' + sep
#         else:
#             sep = ', '
#         return typename + '(' + sep.join(parts) + ')'
# 
#     def __deepcopy__(self, memo):
#         # create a new instance of the object and save it in the memo
#         # dictionary as well. this must be done first so that when we copy the
#         # Parameters object it refers to the correct object instance.
#         obj = memo[id(self)] = type(self).__new__(type(self))
# 
#         # make sure to copy the parameters first. these are stored in the memo
#         # dictionary so we don't need to explicitly save them
#         copy.deepcopy(self.params, memo)
# 
#         # copy the rest of the objects in this Parameterized instance
#         for key, val in self.__dict__.items():
#             setattr(obj, key, copy.deepcopy(val, memo))
#         return obj
# 
#     def copy(self, theta=None, transform=False):
#         """
#         Return a copy of the object. If `theta` is given then update the
#         parameters of the copy; if `transform` is True then these parameters
#         are in the transformed space.
#         """
#         obj = copy.deepcopy(self)
#         if theta is not None:
#             obj.params.set_value(theta, transform)
#         return obj
# 
#     def _update(self):
#         """
#         Update any internal parameters (sufficient statistics, etc.).
#         """
#         pass
# 
#     def _register(self, name, param, domain=REAL, shape=()):
#         """
#         Register a real-valued set of parameters.
#         """
#         # the shape parameter should either be an integer or an iterable object
#         # of integers or characters
#         shape = (shape,) if isinstance(shape, int) else shape
#         ndmin = len(shape)
# 
#         try:
#             param = np.array(param, dtype=float, copy=True, ndmin=ndmin)
#         except (TypeError, ValueError):
#             raise ValueError("parameter '{:s}' not array-like".format(name))
# 
#         # construct the desired shape
#         shapes = dict()
#         shape_ = tuple(
#             (shapes.setdefault(d, d_) if isinstance(d, str) else d)
#             for (d, d_) in zip(shape, param.shape))
# 
#         # check the size of the parameter
#         if param.shape != shape_:
#             raise ValueError("parameter '{:s}' does not have shape ({:s})"
#                              .format(name, ', '.join(map(str, shape))))
# 
#         # save the parameter
#         # pylint: disable=protected-access
#         self.params._register(name, Parameter(param, domain))
# 
#         # return the array
#         return param
# 
#     def _register_obj(self, name, param, klass=None):
#         """
#         Register a parameterized object.
#         """
#         if klass is not None and not isinstance(param, klass):
#             msg = "'{:s}' must be of type {:s}"
#             raise ValueError(msg.format(name, klass.__name__))
# 
#         if not isinstance(param, Parameterized):
#             msg = "'{:s}' must be of type Parameterized"
#             raise ValueError(msg.format(name))
# 
#         param = param.copy()
#         # pylint: disable=protected-access
#         self.params._register(name, param.params)
#         return param


# Path: reggie/means/_core.py
import numpy as np
from ..core.params import Parameterized

"""
Definition of the function interface.
"""

from __future__ import division
from __future__ import absolute_import
from __future__ import print_function



__all__ = ['Mean']


### BASE KERNEL INTERFACE #####################################################


class Mean(Parameterized):