The Changepoint-Detection Workbench (CPD-Bench)
This library is a performance and test benchmark for changepoint detection algorithms, especially created for the changepoynt project.
Important links
Installation
Simply install the cpd-bench via pip and include it into your library:
pip install cpdbench
Usage
Basic usage
- Import cpdbench.CPDBench and create a CPDBench object cpdb
- Use the decorators "dataset", "algorithm", and "metric" of this cpdb object to annotate your respective changepoint dataset function, your changepoint algorithms and validation metrics. The functions have to look like this:
- dataset: def dataset_funtion() -> dataset: cpdbench.dataset.CPDDataset
- algorithm: def algorithm_function(signal: ndarray) -> changepoints: list[int], confidences: list[float]
- metric: def metric_funtion(changepoints: list[int], confidences: list[float], ground_truths: list[int]) -> result: float
- Use cpdb.start() to start the workbench
A very basic configuration created with included example functions looks like this:
from cpdbench.CPDBench import CPDBench
import cpdbench.examples.ExampleDatasets as example_datasets
import cpdbench.examples.ExampleAlgorithms as example_algorithms
import cpdbench.examples.ExampleMetrics as example_metrics
cpdb = CPDBench()
@cpdb.dataset
def get_apple_dataset():
return example_datasets.dataset_get_apple_dataset()
@cpdb.dataset
def get_bitcoin_dataset():
return example_datasets.dataset_get_bitcoin_dataset()
@cpdb.algorithm
def execute_esst_test(signal):
return example_algorithms.algorithm_execute_single_esst(signal)
@cpdb.metric
def calc_accuracy(indexes, scores, ground_truth):
return example_metrics.metric_accuracy_in_allowed_windows(indexes, scores, ground_truth, window_size=25)
if __name__ == '__main__':
cpdb.start()
Configuration
You can configure multiple settings using a config.yml file. For this create a config.yml file with the syntax/commands given in cpdbench.examples.configs.parametersConfig.yml and enter the file path when running the bench: cpdb.start(config_file)
Use of parameters
Use parameters in your own functions as global placeholders (global parameters) or to run the function multiple
times with different configurations (runtime parameters).
To use parameters declare them in your function heads as keyword-only parameters, for example:
def algorithm_function(signal, *, example_param)
Then enter the values in your config file:
- global param: user -> "param name: value"
- runtime param: user -> dataset-executions/algorithm-executions/metric-executions -> list of "param name: value" for the amount of executions/run configurations. Example:
user:
global_param1: 242
global_param2: 353
algorithm_executions:
- runtime_param1: 2424
runtime_param2: 3
- runtime_param1: 345
runtime_param2: 3
For more examples please refer to the "examples" package.
Metadata
Release files for cpdbench 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cpdbench-1.0.0.tar.gz | 1.4 MB | Without provenance | Details for cpdbench-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cpdbench-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for cpdbench-1.0.0-py3-none-any.whl |
Total release size: 1.8 MB
Release files / cpdbench-1.0.0.tar.gz
| Download URL | cpdbench-1.0.0.tar.gz |
|---|---|
| Size | 1.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
78ef33836ebd6b466a8d768b1412086fd26ca2c44b32da736d5cb4198e0b37ec
|
|
BLAKE2b-256 checksum How to use checksums |
b7329c50b7448201efad2cec4ae07df9d94d01e6a1ff94b1aee3e638ad4cfa2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.6
|
Release files / cpdbench-1.0.0-py3-none-any.whl
| Download URL | cpdbench-1.0.0-py3-none-any.whl |
|---|---|
| Size | 404.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
861512e1261ba9ec56d10a104fab1d925a7a76b4dd9303111d629bc25e4923e7
|
|
BLAKE2b-256 checksum How to use checksums |
15e593af1246fdb8131cc4ab07362aad47d1595438c1d0a57aaebd0754d4794d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.6
|
Security for cpdbench 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.