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

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.1
File Size Uploaded
linear_segment-1.2.1.tar.gz 641.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for linear-segment 1.2.1
File Interpreter ABI Platform
linear_segment-1.2.1-cp312-cp312-macosx_14_0_x86_64.whl CPython 3.12 CPython 3.12 macOS 14.0+ x86-64 Details

Total release size: 1.6 MB

Release files / linear_segment-1.2.1.tar.gz

Download URL linear_segment-1.2.1.tar.gz
Size 641.3 kB
Tags Source
SHA-256 checksum
How to use checksums
596dda0deb2c69e57f0d22bfb4f0145709086cfdd4dcd6cef01360d76d71cc95
BLAKE2b-256 checksum
How to use checksums
2b5c5f79733fd34c4a868575e56d9874208dac8b702716b32cdfc6c3d9f38729
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.3 Darwin/23.6.0

Release files / linear_segment-1.2.1-cp312-cp312-macosx_14_0_x86_64.whl

Download URL linear_segment-1.2.1-cp312-cp312-macosx_14_0_x86_64.whl
Size 911.7 kB
Tags CPython 3.12 macOS 14.0+ x86-64
SHA-256 checksum
How to use checksums
8fb48f4084fe912648bcd9fcb16f0dab78450b146bc197b4ce18a144af358418
BLAKE2b-256 checksum
How to use checksums
557d7b5eb34ae5e7ac7ee7da16be4e8ffedcc760bc10cb8c82243098b5cc53ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.3 Darwin/23.6.0

Release history Release notifications | RSS feed

1.2.3

2 release files

1.2.2

2 release files

This release

1.2.1 This release

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