@@ -104,7 +104,7 @@ def _find_best_split(self, start: int, end: int, min_segment_length: int = 1) ->
104104 return best_k , reduction
105105
106106 def fit (self , max_change_point : int , min_fractional_reduction : float ,
107- min_segment_length : int = 1 ) -> None :
107+ min_subsequence_length : int = 1 ) -> None :
108108 """
109109 Find change points based on the provided stopping criteria.
110110
@@ -126,7 +126,7 @@ def fit(self, max_change_point: int, min_fractional_reduction: float,
126126 # largest reduction first so the fixed-K budget is spent optimally.
127127 # Each entry: (-reduction, start, end, k) — negated for min-heap ordering.
128128 heap : List [Tuple [float , int , int , int ]] = []
129- k_init , red_init = self ._find_best_split (0 , self .length , min_segment_length )
129+ k_init , red_init = self ._find_best_split (0 , self .length , min_subsequence_length )
130130 if red_init > 0 :
131131 heapq .heappush (heap , (- red_init , 0 , self .length , k_init ))
132132
@@ -135,7 +135,7 @@ def fit(self, max_change_point: int, min_fractional_reduction: float,
135135
136136 while heap and len (change_points ) < max_change_point :
137137 neg_red , start , end , k = heapq .heappop (heap )
138- if end - start < 2 * min_segment_length :
138+ if end - start < 2 * min_subsequence_length :
139139 continue # Skip segments that are too short to split into two min_segment_length pieces
140140 reduction = - neg_red
141141
@@ -146,8 +146,8 @@ def fit(self, max_change_point: int, min_fractional_reduction: float,
146146 total_abs_reduction += reduction
147147
148148 for seg_start , seg_end in ((start , k ), (k , end )):
149- if seg_end - seg_start >= 2 * min_segment_length :
150- k_sub , red_sub = self ._find_best_split (seg_start , seg_end , min_segment_length )
149+ if seg_end - seg_start >= 2 * min_subsequence_length :
150+ k_sub , red_sub = self ._find_best_split (seg_start , seg_end , min_subsequence_length )
151151 if red_sub > 0 :
152152 heapq .heappush (heap , (- red_sub , seg_start , seg_end , k_sub ))
153153
0 commit comments