Skip to content

Commit

Permalink
syntax and spell checks
Browse files Browse the repository at this point in the history
  • Loading branch information
evenmatencio committed May 30, 2024
1 parent d92e869 commit d47d7da
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/user-guide/costs/costgfssl2.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

This cost function is specifically designed to detect localized mean-shifts in a graph signal. It relies on the least squared deviation of a graph signal filtered with a low-pass graph spectral filter $h$.

Formally, let $G = (V, E, W)$ a graph containing $p =|V|$ nodes, with a weighted adjacency matrix $W$. We define its combinatorial Laplacian matrix $L$ as classicaly done in Graph Signal Processing [[Shuman2013](#Shuman2013)]:
Formally, let $G = (V, E, W)$ a graph containing $p =|V|$ nodes, with a weighted adjacency matrix $W$. We define its combinatorial Laplacian matrix $L$ as classically done in Graph Signal Processing [[Shuman2013](#Shuman2013)]:

$$
L = D - W = U \Lambda U^T,
Expand All @@ -19,10 +19,10 @@ where
Let $\{y_t\}_t, ~ y_t \in \mathbb{R}^p$, a multivariate signal on an interval $I$. The Graph Fourier Scan Statistic (GFSS) [[Sharpnack2016](#Sharpnack2016)] of a graph signal $y_t$ is $\|G(y_t)\|_2^2$ with:

$$
G(y) = \sum_{i=2}^p h(\lambda_i) (u_i^T y) u_i \quad \text{ and } \quad h(\lambda) = \min \left\{ 1, \sqrt{\frac{\rho}{\lambda}} \right\}
G(y) = \sum_{i=2}^p h(\lambda_i) (u_i^T y) u_i \quad \text{ and } \quad h(\lambda) = \min \left( 1, \sqrt{\frac{\rho}{\lambda}} \right)
$$

where $\rho$ is the so-called cut-sparsity. The cost function [`CostGFSSL2`][ruptures.costs.costrbf.CostGFSSL2] over interval $I$ is given by:
where $\rho$ is the so-called cut-sparsity. The cost function [`CostGFSSL2`][ruptures.costs.costgfssl2.CostGFSSL2] over interval $I$ is given by:

$$
c(y_{I}) = \sum_{t\in I} \|G(y_t - \bar{y})\|_2^2
Expand All @@ -48,11 +48,11 @@ G = nx.gnp_random_graph(n=nb_nodes, p=0.5)

# creation of the signal
n, dim = 500, nb_nodes # number of samples, dimension
n_bkps, sigma = 3, 1 # number of change points, noise standart deviation
n_bkps, sigma = 3, 1 # number of change points, noise standard deviation
signal, bkps = rpt.pw_constant(n, dim, n_bkps, noise_std=sigma)
```

Then create a [`CostGFSSL2`][ruptures.costs.costrbf.CostGFSSL2] instance and print the cost of the sub-signal `signal[50:150]`. The initialization of the class requires the Laplacian matrix of the underlying graph and the value of the cut-sparsity $\rho$ should be set based on the eigenvalues of $L$ (see [Graph signal change point detection](../../examples/merging-cost-functions.ipynb)).
Then create a [`CostGFSSL2`][ruptures.costs.costgfssl2.CostGFSSL2] instance and print the cost of the sub-signal `signal[50:150]`. The initialization of the class requires the Laplacian matrix of the underlying graph and the value of the cut-sparsity $\rho$ should be set based on the eigenvalues of $L$ (see [Graph signal change point detection](../../examples/merging-cost-functions.ipynb)).

```python
# creation of the cost function instance
Expand All @@ -69,7 +69,7 @@ print(c.sum_of_costs(bkps))
print(c.sum_of_costs([10, 100, 200, 250, n]))
```

In order to use this cost class in a change point detection algorithm (inheriting from [`BaseEstimator`][ruptures.base.BaseEstimator]), pass a [`CostGFSSL2`][ruptures.costs.costrbf.CostGFSSL2] instance (through the argument `custom_cost`).
In order to use this cost class in a change point detection algorithm (inheriting from [`BaseEstimator`][ruptures.base.BaseEstimator]), pass a [`CostGFSSL2`][ruptures.costs.costgfssl2.CostGFSSL2] instance (through the argument `custom_cost`).

```python
c = rpt.costs.CostL2()
Expand Down

0 comments on commit d47d7da

Please sign in to comment.