Linear Segmentation
linear_segmentation using Bayesian Change Point Segmentation or Circular Binary segmentation.
Install
If you dont already have numpy and scipy installed, it is best to download
Anaconda, a python distribution that has them included.
https://continuum.io/downloads
Dependencies can be installed by:
pip install -r requirements.txt
PyPI install, presuming you have all its requirements installed:
pip install linear_segment
Usage
from linear_segment import segment
import numpy as np
# Create data
np.random.seed(10)
T = 50
x = np.zeros(T)
x[10:20] = 1.0
x[30:40] = 1.0
labels = np.repeat("a", T) # "a" is a dummy label
# Calculate segments
segments = segment(x, labels, method="online_both", cutoff=0.3, offset=5)
print(segments)
LabeledIntervalArray
(0-10, a)
(10-20, a)
(20-30, a)
(30-40, a)
(40-50, a)
segments = segment(x, labels, method="cbs", shuffles=200, p=0.05)
print(segments)
LabeledIntervalArray
(0-10, a)
(10-20, a)
(20-30, a)
(30-40, a)
(40-50, a)
Metadata
Release files for linear-segment 1.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| linear_segment-1.2.3.tar.gz | 24.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| linear_segment-1.2.3-cp314-cp314-macosx_11_0_arm64.whl | CPython 3.14 | CPython 3.14 | macOS 11.0+ ARM64 | Details |
Total release size: 667.8 kB
Release files / linear_segment-1.2.3.tar.gz
| Download URL | linear_segment-1.2.3.tar.gz |
|---|---|
| Size | 24.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
546870082b6cf2096526841bfea30baea86cc96f0f0405880f54567d525b3a08
|
|
BLAKE2b-256 checksum How to use checksums |
54a5d170a4b0e3c9e73d6b0d75f0e1f1490c6fcc3e7e0213e2fdb6b80b02f5b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / linear_segment-1.2.3-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | linear_segment-1.2.3-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 643.6 kB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b173501593e8cf9d61699cd762b988c50dd53341d82b6b14f85cbdd52fe8d339
|
|
BLAKE2b-256 checksum How to use checksums |
c8dbfc0ee608877e98761d10d68df917bc3d309319ad30251da8b3b8eefffb12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|