pactus


Namepactus JSON
Version 0.4.2 PyPI version JSON
download
home_page
SummaryFramework to evaluate Trajectory Classification Algorithms
upload_time2023-09-16 21:44:39
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT License Copyright (c) 2022 yupidevs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords trajectory classification
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pactus

Standing from *Path Classification Tools for Unifying Strategies*, **pactus**
is a Python library that allows testing different classification methods on
several trajectory datasets.

It comes with some built-in models and datasets according to the
state-of-the-art in trajectory classification. However, it is implemented in an
extensible way, so the users can build their own models and datasets.

> NOTE: Built-in datasets don't contain the raw trajectoy data. When a
> dataset is loaded for the first time it downloads the necessary data
> automatically.

## Installation

Make sure you have a Python interpreter newer than version 3.8:

```bash
❯ python --version
Python 3.8.0
```

Then, you can simply install pactus from pypi using pip:

```bash
pip install pactus
```

## Getting started

This is quick example of how to test a Random Forest classifier on the Animals dataset:

```python
from pactus import Dataset, featurizers
from pactus.models import RandomForestModel

SEED = 0

# Load dataset
dataset = Dataset.animals()

# Split data into train and test subsets
train, test = dataset.split(0.9, random_state=SEED)

# Convert trajectories into feature vectors
ft = featurizers.UniversalFeaturizer()

# Build and train the model
model = RandomForestModel(featurizer=ft, random_state=SEED)
model.train(train, cross_validation=5)

# Evaluate the results on the test subset
evaluation = model.evaluate(test)
evaluation.show()
```

It should produce an output as the following:

```text
General statistics:

Accuracy: 0.885
F1-score: 0.849
Mean precision: 0.865
Mean recall: 0.850

Confusion matrix:

Cattle  Deer    Elk     precision
================================
75.0    0.0     0.0     100.0
25.0    80.0    0.0     66.67
0.0     20.0    100.0   92.86
--------------------------------
75.0    80.0    100.0
```

> ℹ️ Notice that by setting the random state to a fixed seed, we ensure the
reproducibility of the results. By changing the seed value, results may be
slightly different due to the stochastic processes used when splitting the
dataset and training the model.

## Available datasets

See the whole [list of datasets](https://github.com/yupidevs/trajectory-datasets) compatible with pactus

## Contributing

Follow the guidlines from [pactus documentation](https://pactus.readthedocs.io/en/latest/)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pactus",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "trajectory,classification",
    "author": "",
    "author_email": "Jorge Morgado Vega <jorge.morgadov@gmail.com>, Gustavo Viera-L\u00f3pez <gvieralopez@gmail.com>, Alfredo Reyes <areyes@fisica.uh.cu>",
    "download_url": "https://files.pythonhosted.org/packages/41/1c/73d25c8e673489a025b3b51561b6f3ede1e75e0909847195bc605bda27f9/pactus-0.4.2.tar.gz",
    "platform": null,
    "description": "# pactus\n\nStanding from *Path Classification Tools for Unifying Strategies*, **pactus**\nis a Python library that allows testing different classification methods on\nseveral trajectory datasets.\n\nIt comes with some built-in models and datasets according to the\nstate-of-the-art in trajectory classification. However, it is implemented in an\nextensible way, so the users can build their own models and datasets.\n\n> NOTE: Built-in datasets don't contain the raw trajectoy data. When a\n> dataset is loaded for the first time it downloads the necessary data\n> automatically.\n\n## Installation\n\nMake sure you have a Python interpreter newer than version 3.8:\n\n```bash\n\u276f python --version\nPython 3.8.0\n```\n\nThen, you can simply install pactus from pypi using pip:\n\n```bash\npip install pactus\n```\n\n## Getting started\n\nThis is quick example of how to test a Random Forest classifier on the Animals dataset:\n\n```python\nfrom pactus import Dataset, featurizers\nfrom pactus.models import RandomForestModel\n\nSEED = 0\n\n# Load dataset\ndataset = Dataset.animals()\n\n# Split data into train and test subsets\ntrain, test = dataset.split(0.9, random_state=SEED)\n\n# Convert trajectories into feature vectors\nft = featurizers.UniversalFeaturizer()\n\n# Build and train the model\nmodel = RandomForestModel(featurizer=ft, random_state=SEED)\nmodel.train(train, cross_validation=5)\n\n# Evaluate the results on the test subset\nevaluation = model.evaluate(test)\nevaluation.show()\n```\n\nIt should produce an output as the following:\n\n```text\nGeneral statistics:\n\nAccuracy: 0.885\nF1-score: 0.849\nMean precision: 0.865\nMean recall: 0.850\n\nConfusion matrix:\n\nCattle  Deer    Elk     precision\n================================\n75.0    0.0     0.0     100.0\n25.0    80.0    0.0     66.67\n0.0     20.0    100.0   92.86\n--------------------------------\n75.0    80.0    100.0\n```\n\n> \u2139\ufe0f Notice that by setting the random state to a fixed seed, we ensure the\nreproducibility of the results. By changing the seed value, results may be\nslightly different due to the stochastic processes used when splitting the\ndataset and training the model.\n\n## Available datasets\n\nSee the whole [list of datasets](https://github.com/yupidevs/trajectory-datasets) compatible with pactus\n\n## Contributing\n\nFollow the guidlines from [pactus documentation](https://pactus.readthedocs.io/en/latest/)\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2022 yupidevs  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Framework to evaluate Trajectory Classification Algorithms",
    "version": "0.4.2",
    "project_urls": {
        "Homepage": "https://github.com/yupidevs/pactus"
    },
    "split_keywords": [
        "trajectory",
        "classification"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "91153643b1341e56515fae27ff27f823cbacd0cfeb9f1f2e5fbe7ffdd1afcae8",
                "md5": "952be4707e9d99c662f6a611459d79be",
                "sha256": "7adc00dfd2265cd4ad17268d0e45f03556648c20f7dc4cda77577447bd3d3a8c"
            },
            "downloads": -1,
            "filename": "pactus-0.4.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "952be4707e9d99c662f6a611459d79be",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 24262,
            "upload_time": "2023-09-16T21:44:37",
            "upload_time_iso_8601": "2023-09-16T21:44:37.419004Z",
            "url": "https://files.pythonhosted.org/packages/91/15/3643b1341e56515fae27ff27f823cbacd0cfeb9f1f2e5fbe7ffdd1afcae8/pactus-0.4.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "411c73d25c8e673489a025b3b51561b6f3ede1e75e0909847195bc605bda27f9",
                "md5": "b28e432701f2f6b4cb3896f0fdadd78a",
                "sha256": "bbd28d9fdf86a6cd840718956aec1fb512f65fcfe1dc593dd603ec203000eeed"
            },
            "downloads": -1,
            "filename": "pactus-0.4.2.tar.gz",
            "has_sig": false,
            "md5_digest": "b28e432701f2f6b4cb3896f0fdadd78a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 19914,
            "upload_time": "2023-09-16T21:44:39",
            "upload_time_iso_8601": "2023-09-16T21:44:39.050306Z",
            "url": "https://files.pythonhosted.org/packages/41/1c/73d25c8e673489a025b3b51561b6f3ede1e75e0909847195bc605bda27f9/pactus-0.4.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-16 21:44:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "yupidevs",
    "github_project": "pactus",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pactus"
}
        
Elapsed time: 0.14200s