linear_segment


Namelinear_segment JSON
Version 1.2.1 PyPI version JSON
download
home_pagehttps://github.com/kylessmith/linear_segment
SummaryPython package for Bayesian Change Point and Circular Binary Segmentation
upload_time2024-11-20 22:22:41
maintainerKyle S. Smith
docs_urlNone
authorKyle S. Smith
requires_python>=3.10
licenseGPL-2.0-or-later
keywords cython bayesian changepoint circular segment c
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Linear Segmentation

[![Build Status](https://travis-ci.org/kylessmith/bcpseg.svg?branch=master)](https://travis-ci.org/kylessmith/linear_segmentation) [![PyPI version](https://badge.fury.io/py/bcpseg.svg)](https://badge.fury.io/py/linear_segmentation)
[![Coffee](https://img.shields.io/badge/-buy_me_a%C2%A0coffee-gray?logo=buy-me-a-coffee&color=ff69b4)](https://www.buymeacoffee.com/kylessmith)

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

```python
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)

```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/kylessmith/linear_segment",
    "name": "linear_segment",
    "maintainer": "Kyle S. Smith",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "kyle.smith@stjude.org",
    "keywords": "cython, bayesian, changepoint, circular, segment, c",
    "author": "Kyle S. Smith",
    "author_email": "kyle.smith@stjude.org",
    "download_url": "https://files.pythonhosted.org/packages/2b/5c/5f79733fd34c4a868575e56d9874208dac8b702716b32cdfc6c3d9f38729/linear_segment-1.2.1.tar.gz",
    "platform": null,
    "description": "# Linear Segmentation\n\n[![Build Status](https://travis-ci.org/kylessmith/bcpseg.svg?branch=master)](https://travis-ci.org/kylessmith/linear_segmentation) [![PyPI version](https://badge.fury.io/py/bcpseg.svg)](https://badge.fury.io/py/linear_segmentation)\n[![Coffee](https://img.shields.io/badge/-buy_me_a%C2%A0coffee-gray?logo=buy-me-a-coffee&color=ff69b4)](https://www.buymeacoffee.com/kylessmith)\n\nlinear_segmentation using Bayesian Change Point Segmentation or Circular Binary segmentation.\n\n\n## Install\n\nIf you dont already have numpy and scipy installed, it is best to download\n`Anaconda`, a python distribution that has them included.  \n```\n    https://continuum.io/downloads\n```\n\nDependencies can be installed by:\n\n```\n    pip install -r requirements.txt\n```\n\nPyPI install, presuming you have all its requirements installed:\n```\n\tpip install linear_segment\n```\n\n## Usage\n\n```python\nfrom linear_segment import segment\nimport numpy as np\n\n# Create data\nnp.random.seed(10)\nT = 50\nx = np.zeros(T)\nx[10:20] = 1.0\nx[30:40] = 1.0\n\nlabels = np.repeat(\"a\", T)   # \"a\" is a dummy label\n\n# Calculate segments\nsegments = segment(x, labels, method=\"online_both\", cutoff=0.3, offset=5)\nprint(segments)\n\nLabeledIntervalArray\n   (0-10, a)\n   (10-20, a)\n   (20-30, a)\n   (30-40, a)\n   (40-50, a)\nsegments = segment(x, labels, method=\"cbs\", shuffles=200, p=0.05)\nprint(segments)\n\nLabeledIntervalArray\n   (0-10, a)\n   (10-20, a)\n   (20-30, a)\n   (30-40, a)\n   (40-50, a)\n\n```\n\n",
    "bugtrack_url": null,
    "license": "GPL-2.0-or-later",
    "summary": "Python package for Bayesian Change Point and Circular Binary Segmentation",
    "version": "1.2.1",
    "project_urls": {
        "Documentation": "https://www.biosciencestack.com/static/linear_segment/docs/index.html",
        "Homepage": "https://github.com/kylessmith/linear_segment",
        "Repository": "https://github.com/kylessmith/linear_segment"
    },
    "split_keywords": [
        "cython",
        " bayesian",
        " changepoint",
        " circular",
        " segment",
        " c"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "557d7b5eb34ae5e7ac7ee7da16be4e8ffedcc760bc10cb8c82243098b5cc53ce",
                "md5": "85fc8e80ca12968cb857b858c923a844",
                "sha256": "8fb48f4084fe912648bcd9fcb16f0dab78450b146bc197b4ce18a144af358418"
            },
            "downloads": -1,
            "filename": "linear_segment-1.2.1-cp312-cp312-macosx_14_0_x86_64.whl",
            "has_sig": false,
            "md5_digest": "85fc8e80ca12968cb857b858c923a844",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.10",
            "size": 911694,
            "upload_time": "2024-11-20T22:22:39",
            "upload_time_iso_8601": "2024-11-20T22:22:39.747320Z",
            "url": "https://files.pythonhosted.org/packages/55/7d/7b5eb34ae5e7ac7ee7da16be4e8ffedcc760bc10cb8c82243098b5cc53ce/linear_segment-1.2.1-cp312-cp312-macosx_14_0_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2b5c5f79733fd34c4a868575e56d9874208dac8b702716b32cdfc6c3d9f38729",
                "md5": "90f93a8d67381f9274cbbd5cda7c1ab3",
                "sha256": "596dda0deb2c69e57f0d22bfb4f0145709086cfdd4dcd6cef01360d76d71cc95"
            },
            "downloads": -1,
            "filename": "linear_segment-1.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "90f93a8d67381f9274cbbd5cda7c1ab3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 641251,
            "upload_time": "2024-11-20T22:22:41",
            "upload_time_iso_8601": "2024-11-20T22:22:41.932566Z",
            "url": "https://files.pythonhosted.org/packages/2b/5c/5f79733fd34c4a868575e56d9874208dac8b702716b32cdfc6c3d9f38729/linear_segment-1.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-20 22:22:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kylessmith",
    "github_project": "linear_segment",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "linear_segment"
}
        
Elapsed time: 0.40960s