changepoint-0.2.0
توضیحات
A Bayesian change point library
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | changepoint-0.2.0 |
| نام | changepoint |
| نسخه کتابخانه | 0.2.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Redpoll <info@redpoll.ai> |
| ایمیل نویسنده | Redpoll <info@redpoll.ai> |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/changepoint/ |
| مجوز | MIT |
# changepoint
Python bindings for important functionality of the rust library [changepoint](https://crates.io/crates/changepoint), a library for doing change point detection for steams of data.
## Installation
Install via pip with
```bash
$ python3 -m pip install "changepoint"
```
__Note__: If there is no binary distribution for your OS, architecture, and Python version, you will need the Rust compiler to build the package and install a Python tool called Maturin:
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
python3 -m pip install maturin
```
See [rustup.rs](https://rustup.rs/) for instructions on installing Rust.
## Quick Docs
By convention in these docs and examples,
```python
import changepoint as chp
```
### Models
#### Bocpd
The Bayesian change point detector, `Bocpd`, takes a prior distribution, aka one of
```python
chp.BetaBernoulli
chp.NormalGamma
chp.NormalInvChiSquared
chp.NormalInvGamma
chp.NormalInvWishart
chp.PoissonGamma
```
Then, a `Bocpd` may be created:
```python
cpd = chp.Bocpd(
prior=chp.NormalGamma(),
lam=12,
)
```
where the prior is a `NormalGamma` and the characteristic run length is `12`.
Each step of the data stream, `data`, can be processed by
```python
n = len(data)
change_point_history = np.zeros((n, n))
for i, x in enumerate(data):
change_point_history[i, : i + 1] = cpd.step(x)
```
#### ArgpCpd
`ArgpCpd` has an implicit prior as it is a Gaussian Process of the form `X_{i+1} = c X_{i-l-1, ..., i-1} + ε`
where `c` is the scale, `X_{i-l-1, ..., i-1}` is the previous vales in the sequence (`l` is the max-lag parameter), and `ε` is a white noise parameter.
It behaves similarity to the `Bocpd` class; for example,
```python
argp = chp.ArgpCpd(logistic_hazard_h=-2, scale=3, noise_level=0.01)
n = len(data)
change_point_history = np.zeros((n + 1, n + 1))
xs = []
ys = []
for i, x in enumerate(data):
cps = argp.step(x)
change_point_history[i, : len(cps)] = cps
```
## Example
An example IPython notebook can be found [here](https://gitlab.com/Redpoll/changepoint/-/blob/master/changepoint-py/ChangePointExample.ipynb).
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.7, < 4 | Python |
نحوه نصب
نصب پکیج whl changepoint-0.2.0:
pip install changepoint-0.2.0.whl
نصب پکیج tar.gz changepoint-0.2.0:
pip install changepoint-0.2.0.tar.gz