Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_exceptions(signal_bkps, kernel):
signal, bkps = signal_bkps
n_regimes = len(bkps)
method = "dynp"
a = KernelMSE(method, kernel)
with pytest.raises(NotEnoughPoints):
a.fit(signal=signal, n_regimes=n_regimes, min_size=1)
method = "pelt"
a = KernelMSE(method, kernel)
with pytest.raises(NotEnoughPoints):
a.fit(signal=signal, penalty=1, min_size=1)
def test_dynp(signal_bkps, kernel):
signal, bkps = signal_bkps
n_regimes = len(bkps)
method = "dynp"
a = KernelMSE(method, kernel)
my_bkps = a.fit(n_regimes=n_regimes, signal=signal, jump=5, min_size=2)
assert my_bkps[-1] == signal.shape[
0], "The last breakpoint must be equal to the signal length"
def test_exceptions(signal_bkps, kernel):
signal, bkps = signal_bkps
n_regimes = len(bkps)
method = "dynp"
a = KernelMSE(method, kernel)
with pytest.raises(NotEnoughPoints):
a.fit(signal=signal, n_regimes=n_regimes, min_size=1)
method = "pelt"
a = KernelMSE(method, kernel)
with pytest.raises(NotEnoughPoints):
a.fit(signal=signal, penalty=1, min_size=1)
def test_pelt(signal_bkps, penalty, kernel):
signal, bkps = signal_bkps
method = "pelt"
a = KernelMSE(method, kernel)
my_bkps = a.fit(penalty=penalty, signal=signal, jump=5, min_size=3)
assert my_bkps[-1] == signal.shape[
0], "The last breakpoint must be equal to the signal length"