Skip to content

Commit

Permalink
chore: pre-commit autoupdate (#322)
Browse files Browse the repository at this point in the history
* chore: pre-commit autoupdate

updates:
- [github.com/psf/black: 23.12.1 → 24.3.0](psf/black@23.12.1...24.3.0)
- [github.com/PyCQA/flake8: 6.1.0 → 7.0.0](PyCQA/flake8@6.1.0...7.0.0)
- [github.com/kynan/nbstripout: 0.6.1 → 0.7.1](kynan/nbstripout@0.6.1...0.7.1)
- [github.com/nbQA-dev/nbQA: 1.7.1 → 1.8.5](nbQA-dev/nbQA@1.7.1...1.8.5)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] committed Apr 3, 2024
1 parent 2fba882 commit 68ea247
Show file tree
Hide file tree
Showing 31 changed files with 52 additions and 32 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.3.0
hooks:
- id: black
language_version: python3
Expand All @@ -25,20 +25,20 @@ repos:
args: [--in-place]
exclude: mkdocs_macros.py
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8
# additional_dependencies: [flake8-docstrings, flake8-bugbear, flake8-spellcheck, flake8-import-order]
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
rev: 0.7.1
hooks:
- id: nbstripout
- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.1
rev: 1.8.5
hooks:
- id: nbqa-black
args: [--nbqa-mutate]
Expand Down
40 changes: 20 additions & 20 deletions docs/examples/merging-cost-functions.ipynb
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "e07961b1-a84a-4749-ad7f-0d3fc617efd3",
"id": "0",
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -36,7 +36,7 @@
},
{
"cell_type": "markdown",
"id": "dbdf7dce-47f1-415b-9d89-e2899b1f4e6c",
"id": "1",
"metadata": {},
"source": [
"## Setup\n",
Expand All @@ -47,7 +47,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "0998be59-5a69-4617-b931-2c9d4fd6595d",
"id": "2",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -72,7 +72,7 @@
},
{
"cell_type": "markdown",
"id": "11388466-a41d-4e44-9789-0161e3cc5e88",
"id": "3",
"metadata": {},
"source": [
"The merging procedure of cost functions is applied on the following 2D toy signal, where each dimension contains three mean-shifts.\n",
Expand All @@ -82,7 +82,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "84089dda-f638-42a2-a429-b5365860cd1f",
"id": "4",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -104,7 +104,7 @@
},
{
"cell_type": "markdown",
"id": "e43b33e1-f056-4d23-ad58-d7e5da754347",
"id": "5",
"metadata": {},
"source": [
"## Detection with a single cost function\n",
Expand All @@ -115,7 +115,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "64e93a45-7a4c-42f8-b7aa-95365e831203",
"id": "6",
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -159,7 +159,7 @@
},
{
"cell_type": "markdown",
"id": "78eaafde-ae84-4ff1-9c80-426040185d90",
"id": "7",
"metadata": {},
"source": [
"Combining this cost function with the [window search method](../user-guide/detection/window.md) yields the following change-points.\n",
Expand All @@ -169,7 +169,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "63af12a7-bd4a-4732-92eb-a8599999a82c",
"id": "8",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -194,7 +194,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "dfceeaa3-2c26-48ea-8af9-5cfa8d0fcdbe",
"id": "9",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -218,7 +218,7 @@
},
{
"cell_type": "markdown",
"id": "ce63eac0-5cd5-474a-bafa-2b4c53425d57",
"id": "10",
"metadata": {},
"source": [
"Observe that, depending on the considered cost function (`CostL2OnSingleDim(dim=0)` or `CostL2OnSingleDim(dim=1)`), the detected changes are not the same even though the input signal is the same.\n",
Expand All @@ -229,7 +229,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "03da2de4-9339-4280-afa8-b04d094213e4",
"id": "11",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -242,7 +242,7 @@
},
{
"cell_type": "markdown",
"id": "5b967d36-1dfa-42e8-a5e1-3085d4325624",
"id": "12",
"metadata": {},
"source": [
"\n",
Expand All @@ -251,7 +251,7 @@
},
{
"cell_type": "markdown",
"id": "7fb9ee7e-469e-4a11-a48b-6e3f152aa6d1",
"id": "13",
"metadata": {},
"source": [
"## Detection with an aggregated cost function\n",
Expand All @@ -265,7 +265,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "1b8ffd8d-8d41-4189-ba25-16ddaf09c063",
"id": "14",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -298,7 +298,7 @@
},
{
"cell_type": "markdown",
"id": "71c261aa-9287-4e47-b331-28ddb3a66c06",
"id": "15",
"metadata": {},
"source": [
"### Union\n",
Expand All @@ -312,7 +312,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "f1571dca-0674-45d8-b9aa-e4200eed3e78",
"id": "16",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -339,7 +339,7 @@
},
{
"cell_type": "markdown",
"id": "ffff426b-2ab7-41fb-972c-2ef9ade72ed8",
"id": "17",
"metadata": {},
"source": [
"## Conclusion\n",
Expand All @@ -355,7 +355,7 @@
},
{
"cell_type": "markdown",
"id": "1a6d5256-67f3-4d3c-8192-4043ff6abce5",
"id": "18",
"metadata": {},
"source": [
"## Authors\n",
Expand All @@ -365,7 +365,7 @@
},
{
"cell_type": "markdown",
"id": "e100e594-eced-42db-9841-4bff2d737c1d",
"id": "19",
"metadata": {},
"source": [
"## References\n",
Expand Down
1 change: 0 additions & 1 deletion docs/user-guide/costs/costcustom.md
Expand Up @@ -25,7 +25,6 @@ from ruptures.base import BaseCost


class MyCost(BaseCost):

"""Custom cost for exponential signals."""

# The 2 following attributes must be specified for compatibility.
Expand Down
1 change: 1 addition & 0 deletions src/ruptures/base.py
Expand Up @@ -3,6 +3,7 @@
[`BaseEstimator`][ruptures.base.BaseEstimator] and
[`BaseCost`][ruptures.base.BaseCost] respectively.
"""

import abc
from ruptures.utils import pairwise

Expand Down
1 change: 1 addition & 0 deletions src/ruptures/costs/costclinear.py
@@ -1,4 +1,5 @@
r"""Continuous linear change."""

import numpy as np

from ruptures.base import BaseCost
Expand Down
1 change: 1 addition & 0 deletions src/ruptures/costs/costcosine.py
@@ -1,4 +1,5 @@
r"""CostCosine (kernel change point detection with the cosine similarity)"""

import numpy as np
from ruptures.base import BaseCost
from ruptures.costs import NotEnoughPoints
Expand Down
1 change: 1 addition & 0 deletions src/ruptures/costs/costl1.py
@@ -1,4 +1,5 @@
r"""CostL1 (least absolute deviation)"""

import numpy as np

from ruptures.base import BaseCost
Expand Down
1 change: 1 addition & 0 deletions src/ruptures/costs/costl2.py
@@ -1,4 +1,5 @@
r"""CostL2 (least squared deviation)"""

from ruptures.costs import NotEnoughPoints

from ruptures.base import BaseCost
Expand Down
1 change: 1 addition & 0 deletions src/ruptures/costs/costlinear.py
@@ -1,4 +1,5 @@
r"""Linear model change."""

from numpy.linalg import lstsq

from ruptures.base import BaseCost
Expand Down
1 change: 1 addition & 0 deletions src/ruptures/costs/costml.py
@@ -1,4 +1,5 @@
r"""Change detection with a Mahalanobis-type metric."""

import numpy as np
from numpy.linalg import inv

Expand Down
1 change: 1 addition & 0 deletions src/ruptures/costs/costnormal.py
@@ -1,4 +1,5 @@
r"""Gaussian process changes (CostNormal)"""

import warnings

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions src/ruptures/costs/costrank.py
@@ -1,4 +1,5 @@
r"""Rank-based cost function (CostRank)"""

import numpy as np
from numpy.linalg import pinv, LinAlgError
from scipy.stats.mstats import rankdata
Expand Down
1 change: 1 addition & 0 deletions src/ruptures/costs/costrbf.py
@@ -1,4 +1,5 @@
r"""Kernelized mean change."""

import numpy as np
from scipy.spatial.distance import pdist, squareform

Expand Down
1 change: 1 addition & 0 deletions src/ruptures/datasets/__init__.py
@@ -1,4 +1,5 @@
"""Utility functions to load or generate data sets."""

from .pw_constant import pw_constant
from .pw_linear import pw_linear
from .pw_normal import pw_normal
Expand Down
1 change: 1 addition & 0 deletions src/ruptures/datasets/pw_linear.py
@@ -1,4 +1,5 @@
r"""Shift in linear model."""

import numpy as np

from . import pw_constant
Expand Down
1 change: 1 addition & 0 deletions src/ruptures/datasets/pw_normal.py
@@ -1,4 +1,5 @@
"""2D piecewise Gaussian process (pw_normal)"""

from itertools import cycle

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions src/ruptures/datasets/pw_wavy.py
@@ -1,4 +1,5 @@
"""Piecewise sinusoidal (pw_wavy)"""

from itertools import cycle

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions src/ruptures/detection/binseg.py
@@ -1,4 +1,5 @@
r"""Binary segmentation."""

from functools import lru_cache

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions src/ruptures/detection/bottomup.py
@@ -1,4 +1,5 @@
r"""Bottom-up segmentation."""

import heapq
from bisect import bisect_left
from functools import lru_cache
Expand Down
1 change: 1 addition & 0 deletions src/ruptures/detection/dynp.py
@@ -1,4 +1,5 @@
r"""Dynamic programming."""

from functools import lru_cache

from ruptures.utils import sanity_check
Expand Down
1 change: 1 addition & 0 deletions src/ruptures/detection/pelt.py
@@ -1,4 +1,5 @@
r"""Pelt."""

from math import floor

from ruptures.costs import cost_factory
Expand Down
1 change: 0 additions & 1 deletion src/ruptures/detection/window.py
@@ -1,6 +1,5 @@
r"""Window-based change point detection."""


import numpy as np
from scipy.signal import argrelmax

Expand Down
1 change: 1 addition & 0 deletions src/ruptures/metrics/__init__.py
Expand Up @@ -16,6 +16,7 @@
display
"""

from .hausdorff import hausdorff
from .timeerror import meantime
from .precisionrecall import precision_recall
Expand Down
1 change: 1 addition & 0 deletions src/ruptures/metrics/hamming.py
@@ -1,4 +1,5 @@
"""Hamming metric for segmentation."""

from ruptures.metrics.randindex import randindex


Expand Down
1 change: 1 addition & 0 deletions src/ruptures/metrics/hausdorff.py
@@ -1,4 +1,5 @@
r"""Hausdorff metric."""

import numpy as np
from scipy.spatial.distance import cdist
from ruptures.metrics.sanity_check import sanity_check
Expand Down
1 change: 1 addition & 0 deletions src/ruptures/metrics/precisionrecall.py
@@ -1,4 +1,5 @@
r"""Precision and recall."""

from itertools import product

from ruptures.metrics.sanity_check import sanity_check
Expand Down
1 change: 1 addition & 0 deletions src/ruptures/metrics/randindex.py
@@ -1,4 +1,5 @@
r"""Rand index (`randindex`)"""

from ruptures.metrics.sanity_check import sanity_check


Expand Down
1 change: 1 addition & 0 deletions src/ruptures/metrics/timeerror.py
@@ -1,4 +1,5 @@
"""Mean time error."""

import numpy as np
from scipy.spatial.distance import cdist

Expand Down
1 change: 1 addition & 0 deletions src/ruptures/utils/__init__.py
@@ -1,4 +1,5 @@
"""Import utils functions."""

from ruptures.utils._utils.convert_path_matrix import from_path_matrix_to_bkps_list

from .bnode import Bnode
Expand Down
1 change: 1 addition & 0 deletions src/ruptures/utils/bnode.py
@@ -1,4 +1,5 @@
"""Binary node."""

import functools
import numpy as np

Expand Down

0 comments on commit 68ea247

Please sign in to comment.