Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up documentation website #20

Merged
merged 110 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
7dee797
docs: Add basic readthedocs setup
Tveten Oct 6, 2024
9deae61
docs: add initial index file
Tveten Oct 6, 2024
1c6b203
docs: add initial api reference
Tveten Oct 6, 2024
a2fdc3a
docs: add contents list to index
Tveten Oct 6, 2024
2d369e0
docs: extend heading lines
Tveten Oct 6, 2024
e706423
docs: update skchange dir
Tveten Oct 6, 2024
16a444d
docs: add numpydoc and other configs
Tveten Oct 6, 2024
cea2ac2
docs: add anomaly detectors section
Tveten Oct 6, 2024
c3e09dd
docs: add auto-generated doc-files to .gitignore
Tveten Oct 6, 2024
96ac7f0
docs: Add maxdepth=2 to index
Tveten Oct 6, 2024
26a727b
docs: fix source links
Tveten Oct 6, 2024
1b56232
docs: add class template and change detectors
Tveten Oct 6, 2024
e262702
docs: add html theme and sidebars options
Tveten Oct 6, 2024
cdc3dc3
doc: update Capa references
Tveten Oct 6, 2024
6df6f45
docs: reorganise modules in api reference
Tveten Oct 6, 2024
8e96449
docs: fix api reference styling
Tveten Oct 6, 2024
5e2e173
docs: fix indentation
Tveten Oct 6, 2024
cc7b09f
docs: add template for functions
Tveten Oct 6, 2024
5c483bd
feat(api): add score functions to init
Tveten Oct 6, 2024
6c31f76
docs: remove blank line
Tveten Oct 6, 2024
dbfc24e
docs: add initial scores api reference
Tveten Oct 6, 2024
cc406e2
docs: set template to functions for scores
Tveten Oct 6, 2024
0416ad7
feat(api): add costs and savings functions to init
Tveten Oct 6, 2024
7e6b12f
feat(api): add dataset functions to init
Tveten Oct 6, 2024
a815ccf
docs: correct underline length for scores heading
Tveten Oct 6, 2024
f899984
docs: add initial costs api reference
Tveten Oct 6, 2024
3aa0588
docs: put factory functions on top of docs
Tveten Oct 6, 2024
8de8dd7
docs: add initial datasets api reference
Tveten Oct 6, 2024
8ee9e8c
docs: add initial utils api reference
Tveten Oct 6, 2024
8d7730c
docs: fix header sizes
Tveten Oct 6, 2024
394e269
docs: add initial base api reference
Tveten Oct 6, 2024
90d58aa
docs: add base and reorganise anomaly detectors reference
Tveten Oct 6, 2024
1d5cfba
docs: add base and reorganise change detectors page
Tveten Oct 6, 2024
4992b96
docs: fix indentation
Tveten Oct 6, 2024
c3ac6c4
fix: add subset collective anomaly detector to init
Tveten Oct 6, 2024
0255a68
docs: fix point anomaly detector title
Tveten Oct 6, 2024
35772ae
docs: fix formatting of Capa example
Tveten Oct 8, 2024
6546aa3
docs: add copybutton options
Tveten Oct 8, 2024
a9423b1
docs: format Capa example
Tveten Oct 8, 2024
65e592e
docs: add more linebreaks in docstring
Tveten Oct 8, 2024
bd953dd
docs: Add intro text for the base module
Tveten Oct 13, 2024
e3b2f0c
docs: fix typo
Tveten Oct 13, 2024
254cc7b
docs: Improve BaseDetector docs
Tveten Oct 13, 2024
57973de
Merge branch 'make_docs_page' of https://github.com/NorskRegnesentral…
Tveten Oct 13, 2024
5da6123
docs: Add base classes header
Tveten Oct 13, 2024
8848543
docs: add new header for BaseDetector
Tveten Oct 13, 2024
458d6c7
docs: format class and method references as in-line code
Tveten Oct 13, 2024
5d31e55
docs: move developer notes to module docs or private methods
Tveten Oct 13, 2024
f2be8ec
docs: move developer notes to module docstring
Tveten Oct 13, 2024
00d0cee
docs: Improve fit documentation
Tveten Oct 13, 2024
99105fd
docs: add links and code formatting
Tveten Oct 13, 2024
20145de
docs: add additional reference
Tveten Oct 13, 2024
7d45adb
docs: Improve docs formatting
Tveten Oct 13, 2024
73ed95c
fix: Set max_interval_length to 1000
Tveten Oct 13, 2024
eae6cdb
docs: Imrpove docs formatting and example
Tveten Oct 13, 2024
74d0c27
docs: fix example
Tveten Oct 13, 2024
277832b
docs: fix missing punctuation
Tveten Oct 13, 2024
6698235
docs: fix code formatting of strings
Tveten Oct 13, 2024
34ad606
docs: Improve docs formatting and example
Tveten Oct 13, 2024
7bebb6f
docs: Improve formatting and example
Tveten Oct 13, 2024
376be72
docs: Improve docs formatting and example
Tveten Oct 13, 2024
cbc33bd
docs: fix example
Tveten Oct 13, 2024
9d95dcc
docs: Improve formatting
Tveten Oct 13, 2024
342597e
docs: Add raises section
Tveten Oct 13, 2024
7da17ea
docs: Improve formatting
Tveten Oct 13, 2024
486bc3c
docs: reformat using single backticks
Tveten Oct 14, 2024
56bcba6
docs: add raises section
Tveten Oct 14, 2024
a83aac7
docs: improve cost documentation
Tveten Oct 14, 2024
1e092bf
feat and doc: allow custom costs and rename cost_name -> cost
Tveten Oct 14, 2024
5b6e8db
docs: Improve docs formatting
Tveten Oct 14, 2024
841b4b1
feat: allow custom savings and rename saving_name -> saving
Tveten Oct 14, 2024
91efd8b
docs: improve formatting
Tveten Oct 14, 2024
47ca97c
fix: Add anomaly_score_factory which was deleted by mistake
Tveten Oct 14, 2024
1863896
feat: use plural argument names in anomaly scores
Tveten Oct 14, 2024
f1b9910
feat(api): Add generate_changing_data and rename generate_teeth_data …
Tveten Oct 14, 2024
4145d6a
docs: add generate_changing_data to docs
Tveten Oct 14, 2024
31edc2a
feat(api): exchange all occurces of generate_teeth_data with generate…
Tveten Oct 14, 2024
a0e51bf
fix: set default mean to 0.0
Tveten Oct 15, 2024
1925628
tests: add tests for data generators
Tveten Oct 15, 2024
3f86f30
tests: add tests for cost factory
Tveten Oct 15, 2024
3f357ce
tests: make invalid changepoint test simpler
Tveten Oct 15, 2024
958897c
fix: add missing init file
Tveten Oct 15, 2024
3ca65d5
fix: add missing init file
Tveten Oct 15, 2024
0282fc7
tests: add tests for saving_factory
Tveten Oct 15, 2024
7b2a5ba
docs: fix formatting error
Tveten Oct 16, 2024
ce4005a
docs: fix see also formatting error
Tveten Oct 16, 2024
14d5ae8
docs: header formatting
Tveten Oct 16, 2024
67802dc
docs: add a simple 'releases' section
Tveten Oct 16, 2024
67caccd
docs: add structure of index to be filled
Tveten Oct 16, 2024
5340a42
docs: add user and developer guide sections to be filled
Tveten Oct 16, 2024
1244af9
docs: add links to sktime and numba
Tveten Oct 16, 2024
2c17d40
docs: fix pip install
Tveten Oct 16, 2024
9c09e09
docs: change the title of the home page
Tveten Oct 16, 2024
a51557d
docs: fix numba link
Tveten Oct 16, 2024
1d1242a
docs: fix numba link
Tveten Oct 16, 2024
e64ca7d
docs: add user guide, api reference, developer guide and releases to …
Tveten Oct 16, 2024
0d55c1d
docs: reformulate package decription
Tveten Oct 16, 2024
7f8f675
feat: allow more input types for each element in the means and varian…
Tveten Oct 16, 2024
c0d7a50
docs: add key features, mission and an example
Tveten Oct 16, 2024
023fa8d
docs: add description of custom costs
Tveten Oct 16, 2024
71b0731
docs: add description of custom savings
Tveten Oct 16, 2024
f312596
docs: add a link to the API reference from the user guide
Tveten Oct 16, 2024
e92bf06
fix: delete the unused transformations module
Tveten Oct 16, 2024
770cc7f
docs: imrove mean saving documentation
Tveten Oct 16, 2024
6ef4de4
docs: add anomaly scores
Tveten Oct 16, 2024
05aeea4
docs: improve init_mean_cov_score documentation
Tveten Oct 16, 2024
f5f0e78
fix: include docs in release script
Tveten Oct 16, 2024
3e9cbb5
fix: formatting
Tveten Oct 16, 2024
4e13ee2
fix: add correct doc paths
Tveten Oct 16, 2024
fa633c6
docs: add documentation to readme
Tveten Oct 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# VS Code settings
.vscode/

# Ruff
.ruff_cache/

# Sphinx documentation
docs/source/api_reference/auto_generated/
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ python:
build:
os: ubuntu-22.04
tools:
python: "3.11"
python: "3.12"

sphinx:
configuration: docs/source/conf.py
Expand Down
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# skchange
`skchange` provides sktime-compatible change detection and changepoint-based anomaly detection algorithms.

A playground for now.
# [skchange](https://skchange.readthedocs.io/en/latest/)

[![codecov](https://codecov.io/gh/NorskRegnesentral/skchange/graph/badge.svg?token=QSS3AY45KY)](https://codecov.io/gh/NorskRegnesentral/skchange)
[![tests](https://github.com/NorskRegnesentral/skchange/actions/workflows/tests.yaml/badge.svg)](https://github.com/NorskRegnesentral/skchange/actions/workflows/tests.yaml)
[![docs](https://readthedocs.org/projects/skchange/badge/?version=latest)](https://skchange.readthedocs.io/en/latest/?badge=latest)
[![BSD 3-clause](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://github.com/sktime/sktime/blob/main/LICENSE)
[![!black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

Skchange provides sktime-compatible change detection and changepoint-based anomaly detection algorithms.

Experimental but maturing.

## [Documentation](https://skchange.readthedocs.io/en/latest/)
Now available.


## Installation
```sh
Expand All @@ -20,9 +25,9 @@ Requires Python >= 3.9, < 3.13.
### Changepoint detection / time series segmentation
```python
from skchange.change_detectors.moscore import Moscore
from skchange.datasets.generate import generate_teeth_data
from skchange.datasets.generate import generate_alternating_data

df = generate_teeth_data(n_segments=10, segment_length=50, mean=5, random_state=1)
df = generate_alternating_data(n_segments=10, segment_length=50, mean=5, random_state=1)
detector = Moscore(bandwidth=10)
detector.fit_predict(df)
>>>
Expand All @@ -41,9 +46,9 @@ Name: changepoint, dtype: int64
### Multivariate anomaly detection
```python
from skchange.anomaly_detectors.mvcapa import Mvcapa
from skchange.datasets.generate import generate_teeth_data
from skchange.datasets.generate import generate_alternating_data

df = generate_teeth_data(
df = generate_alternating_data(
n_segments=5,
segment_length=50,
p=10,
Expand Down
10 changes: 5 additions & 5 deletions build_tools/make_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class URLs:
"""Container class for URLs."""

DOCS_LOCAL = "file://" + os.path.realpath(
os.path.join(ROOT_DIR, "docs/_build/html/index.html")
os.path.join(ROOT_DIR, "docs/build/html/index.html")
)
DOCS_ONLINE = "https://www.sktime.net"
DOCS_ONLINE = "https://skchange.readthedocs.io/"
PYPI = f"https://pypi.org/simple/{PACKAGE_NAME}/"


Expand Down Expand Up @@ -337,8 +337,8 @@ def main():
CheckVersionNumber(),
UpdateReadme(),
# UpdateChangelog(),
# MakeDocs(),
# CheckLocalDocs(),
MakeDocs(),
CheckLocalDocs(),
MakeDist(),
CheckDist(),
UploadToTestPyPI(),
Expand All @@ -349,7 +349,7 @@ def main():
GitTagRelease(),
PushTagToGitHub(),
CheckCIStatus(),
# CheckOnlineDocs(),
CheckOnlineDocs(),
UploadToPyPI(),
CheckPyPIFiles(),
]
Expand Down
34 changes: 34 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Adapted from sktime docs/Makefile.

# Minimal makefile for Sphinx documentation.

# You can set these variables from the command line.
SPHINXBUILD = sphinx-build
SPHINXOPTS =
SPHINXAUTOBUILD = sphinx-autobuild
SPHINXAUTOOPTS =
SOURCEDIR = ./source
BUILDDIR = ./build
SKCHANGEDIR = ../skchange

.PHONY: help build autobuild

# "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)"

clean:
rm -rf $(BUILDDIR)
@echo "Deleted directory $(BUILDDIR)."

# $(O) is meant as a shortcut for custom options.
# i.e to log stderr into a separate file:
# make build O="--no-color 2> build_warnings.log"
html:
# ./symlink_examples.sh
$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

# $(O) is meant as a shortcut for custom options.
autobuild:
# use --pre-build COMMAND to call ./symlink_examples.sh
$(SPHINXAUTOBUILD) "$(SOURCEDIR)" "$(BUILDDIR)/html" -d "$(BUILDDIR)/doctrees" $(SPHINXAUTOOPTS) $(O) --watch "$(SKCHANGEDIR)" --re-ignore ".*\.json"
12 changes: 12 additions & 0 deletions docs/source/_templates/class.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{objname}}
{{ underline }}==============

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}

.. include:: {{module}}.{{objname}}.examples

.. raw:: html

<div class="clearer"></div>
12 changes: 12 additions & 0 deletions docs/source/_templates/functions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{objname}}
{{ underline }}====================

.. currentmodule:: {{ module }}

.. autofunction:: {{ objname }}

.. include:: {{module}}.{{objname}}.examples

.. raw:: html

<div class="clearer"></div>
25 changes: 25 additions & 0 deletions docs/source/api_reference.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.. _api_reference:

=============
API reference
=============

Welcome to the API reference for ``skchange``.

The API reference provides a technical manual.
It describes the classes and functions included in skchange.

For Python Interactive examples, see the `interactive <https://github.com/NorskRegnesentral/skchange/tree/main/interactive>`_ folder on Github.

.. include:: includes/api_css.rst

.. toctree::
:maxdepth: 1

api_reference/base
api_reference/anomaly_detectors
api_reference/change_detectors
api_reference/scores
api_reference/costs
api_reference/datasets
api_reference/utils
40 changes: 40 additions & 0 deletions docs/source/api_reference/anomaly_detectors.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.. _anomaly_detectors:

Anomaly detectors
=================


Base
----

.. currentmodule:: skchange.anomaly_detectors
.. autosummary::
:toctree: auto_generated/
:template: class.rst

CollectiveAnomalyDetector
SubsetCollectiveAnomalyDetector
PointAnomalyDetector

Collective anomaly detectors
----------------------------
.. currentmodule:: skchange.anomaly_detectors

.. autosummary::
:toctree: auto_generated/
:template: class.rst

Capa
CircularBinarySegmentation
MoscoreAnomaly
StatThresholdAnomaliser

Subset collective anomaly detectors
-----------------------------
.. currentmodule:: skchange.anomaly_detectors

.. autosummary::
:toctree: auto_generated/
:template: class.rst

Mvcapa
25 changes: 25 additions & 0 deletions docs/source/api_reference/base.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.. _base:

Base
====

The :mod:`skchange.base` module contains the abstract detector class
:class:`skchange.base.BaseDetector`. This class serves as a minimalistic template for
all the detectors in :mod:`skchange`.

For common detection tasks, like changepoint detection or anomaly detection, there
are dedicated subclasses of :class:`BaseDetector` that implement a stricter template
for these tasks. These subclasses are located in the respective modules, e.g.
:mod:`skchange.change_detectors.base` or :mod:`skchange.anomaly_detectors.base`.


Base classes
------------

.. currentmodule:: skchange.base

.. autosummary::
:toctree: auto_generated/
:template: class.rst

BaseDetector
27 changes: 27 additions & 0 deletions docs/source/api_reference/change_detectors.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.. _change_detectors:

Change detectors
================

Base
----

.. currentmodule:: skchange.change_detectors

.. autosummary::
:toctree: auto_generated/
:template: class.rst

ChangeDetector

Change detectors
----------------
.. currentmodule:: skchange.change_detectors

.. autosummary::
:toctree: auto_generated/
:template: class.rst

Moscore
Pelt
SeededBinarySegmentation
28 changes: 28 additions & 0 deletions docs/source/api_reference/costs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.. _costs:

Costs and savings
=================

Costs
-----

.. currentmodule:: skchange.costs

.. autosummary::
:toctree: auto_generated/
:template: functions.rst

cost_factory
init_mean_cost
mean_cost

Savings
-------

.. autosummary::
:toctree: auto_generated/
:template: functions.rst

saving_factory
init_mean_saving
mean_saving
15 changes: 15 additions & 0 deletions docs/source/api_reference/datasets.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.. _datasets:

Datasets
========

.. currentmodule:: skchange.datasets

.. autosummary::
:toctree: auto_generated/
:template: functions.rst

generate_anomalous_data
generate_changing_data
generate_alternating_data
add_linspace_outliers
21 changes: 21 additions & 0 deletions docs/source/api_reference/scores.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.. _scores:

Scores
======

.. currentmodule:: skchange.scores

.. autosummary::
:toctree: auto_generated/
:template: functions.rst

score_factory
anomaly_score_factory
init_mean_score
mean_score
mean_anomaly_score
init_mean_var_score
mean_var_score
mean_var_anomaly_score
init_mean_cov_score
mean_cov_score
26 changes: 26 additions & 0 deletions docs/source/api_reference/utils.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.. _utils:

Utility functions
=================

Data validation
---------------
.. currentmodule:: skchange.utils.validation.data

.. autosummary::
:toctree: auto_generated/
:template: functions.rst

check_data

Parameter validation
--------------------
.. currentmodule:: skchange.utils.validation.parameters

.. autosummary::
:toctree: auto_generated/
:template: functions.rst

check_larger_than
check_smaller_than
check_in_interval
Loading
Loading