8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5f7d66c commit 26384beCopy full SHA for 26384be
sklearn/_loss/_loss.pyx.tp
@@ -818,6 +818,9 @@ cdef inline double_pair cgrad_hess_exponential(
818
cdef class CyLossFunction:
819
"""Base class for convex loss functions."""
820
821
+ def __reduce__(self):
822
+ return (self.__class__, ())
823
+
824
cdef double cy_loss(self, double y_true, double raw_prediction) noexcept nogil:
825
"""Compute the loss for a single sample.
826
@@ -1013,6 +1016,11 @@ cdef class {{name}}(CyLossFunction):
1013
1016
self.{{param}} = {{param}}
1014
1017
{{endif}}
1015
1018
1019
+ {{if param is not None}}
1020
1021
+ return (self.__class__, (self.{{param}},))
1022
+ {{endif}}
1023
1024
cdef inline double cy_loss(self, double y_true, double raw_prediction) noexcept nogil:
1025
return {{closs}}(y_true, raw_prediction{{with_param}})
1026
0 commit comments