حول
Comparative analysis of pairwise interactions in multivariate time series.
البيانات والتحليلاتالنمو المقاس للنجوم
- خلال 24 ساعة
- +٢٠
- خلال 7 أيام
- +٥٤
- خلال 15 يومًا
- +٥٥
- خلال شهر
- جارٍ جمع السجل
تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.
README.md
الأصل
pyspi: Python Toolkit of Statistics for Pairwise Interactions
Documentation · Tutorials · Nat Comp Sci Paper (free to read, arXiv preprint)
pyspi is a comprehensive python library for computing statistics of pairwise interactions (SPIs) from multivariate time-series (MTS) data. The toolbox provides easy access to hundreds of methods for evaluating the relationship between pairs of time series, from simple statistics (like correlation) to advanced multi-step algorithms (like Granger causality). The code is licensed under the GNU General Public License, version 3 or any later version (GPL-3.0-or-later).
pyspi has a sister package for univariate time series, pyhctsa, which computes over 6300 interpretable features of a single time series. The two share the highly comparative approach: a large library of interpretable methods, compared on data rather than chosen in advance. They also share a common design: method sets defined in YAML, and the same quality codes for values that are not appropriate for the input. You can use pyhctsa to characterise each time series, and pyspi to characterise how pairs of them interact, as in Bryant et al. (2024).
Feel free to reach out for help with real-world applications. Feedback is much appreciated through issues, or pull requests.
| Section | Description |
|---|---|
| Installation | Installing pyspi |
| Getting Started | A quick introduction on how to get started with pyspi |
| Choosing an SPI set | The bundled SPI sets, and how to pick one |
| Documentation | Where to find usage guides, the SPI descriptions and the API reference |
| Contributing to pyspi | How to contribute, and how to request an SPI |
| Acknowledgement | A citation for pyspi for scholarly articles |
| Our Contributors | A summary of our primary contributors |
Installation 📥
pyspi requires Python 3.11 or newer.
Upgrading from 2.x? Version 3.0 removes the Java/JIDT dependency and changes the
CalculatorAPI. See the CHANGELOG for the migration table.
pip install pyspi
Installing into a dedicated environment is strongly recommended; the installation guide covers environments, optional extras and troubleshooting. To develop pyspi itself, see CONTRIBUTING.md.
Getting Started 🚀
import numpy as np
from pyspi.calculator import Calculator
dataset = np.random.randn(5, 500) # 5 processes, 500 observations
calc = Calculator(dataset=dataset) # z-scores each process by default
calc.compute() # compute every SPI
calc.table # rows = processes, columns = (SPI, process)
calc.table["cov_EmpiricalCovariance"] # one SPI's 5x5 matrix
calc.quality # one code per cell: 0 good, else why it is NaN
calc.save("results.npz")
Or from the command line:
python -m pyspi compute --data ts.npy --config benchmarked_p90 --output results.npz
Every value is a finite number or NaN, and calc.quality says why a value is NaN: an error, or an SPI that is not appropriate for the data.
The getting-started guide covers data layout, quality codes, feature vectors for machine learning, saving and loading, and parallel computation.
The tutorial notebooks walk through the 3.0 API, and two case studies show how to find the SPIs that suit a classification problem: compute broadly, let the data select, then interpret the winners. The walkthrough tutorials in the online documentation apply pyspi to real data (some are still written for 2.x).
Choosing an SPI set
Computing all 231 SPIs is expensive, and cost grows steeply in both the number of processes M and the series length T.
config= takes either a bundled name or a path to your own YAML:
config= |
SPIs | Use when |
|---|---|---|
"full" (default) |
231 | You want everything and can afford it. |
"benchmarked_p99" |
229 | Everything except bary_softdtw_corr and gpfit_RBF, which cost more than the other 229 together. |
"benchmarked_p95" |
213 | p90 plus costlier settings of its methods. |
"benchmarked_p90" |
207 | Large batches. |
"benchmarked_p80" |
185 | Cost-constrained sweeps. |
Each benchmarked_p<N> set holds about the cheapest N% of the SPIs in full.
SPI Subsets explains how they were chosen and describes the other bundled sets; Creating a reduced SPI set shows how to build your own.
For large batches of datasets, see Running at scale.
Documentation 📖
The online documentation has the full usage guides:
- Installation and getting started
- Running at scale and frequency bands
- Table of SPIs and descriptions
- FAQ
- API Reference
- Development guide
The SPI tables and descriptions there still describe the 2.x set; for 3.0, full.yaml lists every bundled SPI, each SPI class's docstring describes it, and docs/spi_changes_2.0.2_to_3.0.0.md lists what was added, removed and renamed.
Contributing to pyspi 👨👨👦👦
Contributions are welcome: see the contribution guidelines and our code of conduct, and CONTRIBUTING.md for the code and docstring conventions. To request an SPI, please open an issue with a link to the paper that describes it.
Acknowledgement 👍
If you use this software, please read and cite this article:
- 📗 O.M. Cliff, A.G. Bryant, J.T. Lizier, N. Tsuchiya, B.D. Fulcher. Unifying pairwise interactions in complex dynamics, Nature Computational Science (2023).
Note that preprint and free-to-read versions of this article are available.
Click here for a BibTex reference:
@article{Cliff2023:UnifyingPairwiseInteractions,
title = {Unifying pairwise interactions in complex dynamics},
volume = {3},
issn = {2662-8457},
url = {https://www.nature.com/articles/s43588-023-00519-x},
doi = {10.1038/s43588-023-00519-x},
number = {10},
journal = {Nature Computational Science},
author = {Cliff, Oliver M. and Bryant, Annie G. and Lizier, Joseph T. and Tsuchiya, Naotsugu and Fulcher, Ben D.},
month = sep,
year = {2023},
pages = {883--893},
}
Other highly comparative toolboxes 🧰
If you are interested in trying other highly comparative toolboxes like pyspi, see the below list:
- pyhctsa, pyspi's sister package, computes over 6300 features of univariate time series in Python, with the same design as pyspi.
- hctsa, the highly comparative time-series analysis toolkit for Matlab, computes 6392 time-series features from univariate time series.
- hcga, a highly comparative graph analysis toolkit, computes several thousands of graph features directly from any given network.
Our Contributors 🌟
We are thankful for the contributions of each and everyone who has helped make this project better. Whether you've added a line of code, improved our documentation, or reported an issue, your contributions are greatly appreciated! Below are some of the leading contributors to pyspi:
License 🧾
pyspi is released under the GNU General Public License, version 3 or any later version (GPL-3.0-or-later); see LICENSE.txt.
استكشف مشاريع مشابهة ومرتبطة
جارٍ التحميل…