Source code for GPy.mappings.identity

# Copyright (c) 2015, James Hensman

from ..core.mapping import Mapping
from ..core import Param

[docs]class Identity(Mapping): """ A mapping that does nothing! """ def __init__(self, input_dim, output_dim, name='identity'): super(Identity, self).__init__(input_dim, output_dim, name)
[docs] def f(self, X): return X
[docs] def update_gradients(self, dL_dF, X): pass
[docs] def gradients_X(self, dL_dF, X): return dL_dF
[docs] def to_dict(self): """ Convert the object into a json serializable dictionary. Note: It uses the private method _save_to_input_dict of the parent. :return dict: json serializable dictionary containing the needed information to instantiate the object """ input_dict = super(Identity, self)._save_to_input_dict() input_dict["class"] = "GPy.mappings.Identity" return input_dict