[docs]classSkLearnParameters:""" Defines a class to store parameters of a *learner* or a *transform*. """def__init__(self,**kwargs):""" Stores parameters as members of the class itself. """self._keys=list(kwargs.keys())fork,vinkwargs.items():self.validate(k,v)setattr(self,k,v)
[docs]defvalidate(self,name,value):""" Verifies a parameter and its value. :param name: name :param value: value :raise: raises :class:`SkException` if error """ifname.startswith("_")orname.endswith("_"):raiseSkException(f"Parameter name must not start by '_': '{name}'")