File tree Expand file tree
Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -818,6 +818,9 @@ cdef inline double_pair cgrad_hess_exponential(
818
818
cdef class CyLossFunction:
819
819
"""Base class for convex loss functions."""
820
820
821
+ def __reduce__(self):
822
+ return (self.__class__, ())
823
+
821
824
cdef double cy_loss(self, double y_true, double raw_prediction) noexcept nogil:
822
825
"""Compute the loss for a single sample.
823
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
+ def __reduce__(self):
1021
+ return (self.__class__, (self.{{param}},))
1022
+ {{endif}}
1023
+
1016
1024
cdef inline double cy_loss(self, double y_true, double raw_prediction) noexcept nogil:
1017
1025
return {{closs}}(y_true, raw_prediction{{with_param}})
1018
1026
You can’t perform that action at this time.
0 commit comments