Skip to content

Commit

Permalink
Change filter formula
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Cecchi committed May 31, 2024
1 parent eec9efa commit 7246a4c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/ruptures/costs/costgfssl2.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def filter(self, freqs, eps=0.00001):
"""
nb_zeros = np.sum(freqs < eps)
filtered_freqs = np.minimum(1, np.sqrt(self.cut_sparsity / freqs[nb_zeros:]))
return np.concatenate([np.zeros(nb_zeros), filtered_freqs])
return np.concatenate([np.ones(nb_zeros), filtered_freqs])

def fit(self, signal):
"""Performs pre-computations for per-segment approximation cost.
Expand Down Expand Up @@ -86,3 +86,9 @@ def error(self, start, end):
sub_square_sum = self.gfss_square_cumsum[end] - self.gfss_square_cumsum[start]
sub_sum = self.gfss_cumsum[end] - self.gfss_cumsum[start]
return np.sum(sub_square_sum - (sub_sum**2) / (end - start))



# %%

# %%

0 comments on commit 7246a4c

Please sign in to comment.