How to use the ruptures.costs.KernelMSE function in ruptures

To help you get started, we’ve selected a few ruptures examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deepcharles / ruptures / tests / test_kernel.py View on Github external
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)
github deepcharles / ruptures / tests / test_kernel.py View on Github external
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"
github deepcharles / ruptures / tests / test_kernel.py View on Github external
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)
github deepcharles / ruptures / tests / test_kernel.py View on Github external
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"