Skip to main content

Linear Segmentation

Build Status PyPI version Coffee

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.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for linear-segment 1.2.2
File Size Uploaded
linear_segment-1.2.2.tar.gz 1.2 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for linear-segment 1.2.2
File Interpreter ABI Platform
linear_segment-1.2.2-cp314-cp314-macosx_26_0_arm64.whl CPython 3.14 CPython 3.14 macOS 26.0+ ARM64 Details

Total release size: 1.2 MB

Release files / linear_segment-1.2.2.tar.gz

Download URL linear_segment-1.2.2.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
e79458972bebf51ca06f08a3ecbd50096294e17ed2b41fb34fc162cd41df1453
BLAKE2b-256 checksum
How to use checksums
445f65c5360813c2a1d396573232ae8713e99dea4b6c10b7dc170b19ae2779f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.13.9 Darwin/25.6.0

Release files / linear_segment-1.2.2-cp314-cp314-macosx_26_0_arm64.whl

Download URL linear_segment-1.2.2-cp314-cp314-macosx_26_0_arm64.whl
Size 25.8 kB
Tags CPython 3.14 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
ed0a4230e0b168cc8456c4dc421ac256fd6e7712ff296569b096f3ebc082b61e
BLAKE2b-256 checksum
How to use checksums
49f03fe9c79966cdf804fbc5bec124cadbecba2d81a67c20df347177af8e5703
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.13.9 Darwin/25.6.0

Release history Release notifications | RSS feed

1.2.3

2 release files

This release

1.2.2 This release

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page