Skip to content

Commit

Permalink
Fixes #97, fix issue with deepcopy and criterion
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed May 3, 2021
1 parent 029928b commit 837d182
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mlinsights/mlmodel/_piecewise_tree_regression_common024.pyx
Expand Up @@ -43,6 +43,14 @@ cdef class CommonRegressorCriterion(Criterion):
def __cinit__(self, const DOUBLE_t[:, ::1] X):
self.sample_X = X

def __deepcopy__(self, memo=None):
"""
This does not a copy but mostly creates a new instance
of the same criterion initialized with the same data.
"""
inst = self.__class__(self.sample_X)
return inst

cdef void _update_weights(self, SIZE_t start, SIZE_t end, SIZE_t old_pos, SIZE_t new_pos) nogil:
"""
Updates members `weighted_n_right` and `weighted_n_left`
Expand Down

0 comments on commit 837d182

Please sign in to comment.