Skip to main content

pactus

Framework to evaluate Trajectory Classification Algorithms

QA Release Python 3.11+ License: MIT JOSS Docs PyPI
uv Ruff Checked with mypy

Installation · Getting started · Available datasets · Citing pactus · Development


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

pactus requires Python 3.11 or newer, and up to 3.13 for now, because TensorFlow has no wheels for newer versions yet.

You can install pactus from PyPI using pip:

pip install pactus

Getting started

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

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:

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 compatible with pactus

Citing pactus

If you use pactus in your research, please cite our article in the Journal of Open Source Software:

@article{pactus2023,
  title   = {pactus: A Python framework for trajectory classification},
  author  = {Viera-L{\'o}pez, G. and Morgado-Vega, J. J. and Reyes, A. and Altshuler, E. and Almeida-Cruz, Yudivi{\'a}n and Manganini, Giorgio},
  journal = {Journal of Open Source Software},
  volume  = {8},
  number  = {89},
  pages   = {5738},
  year    = {2023},
  doi     = {10.21105/joss.05738}
}

Development

Setup, QA and releases: DEVELOPMENT.md. See also the pactus documentation.

Contributing

Issues and pull requests are welcome; make qa must pass.

License

MIT: see LICENSE.


🚀 Project starter provided by Cookie Pyrate v1.1.2

Metadata

Release files for pactus 0.5.0

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

Source distribution (sdist)

Source distribution for pactus 0.5.0
File Size Uploaded Provenance Actions
pactus-0.5.0.tar.gz 649.5 kB Without provenance Details for pactus-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pactus 0.5.0
File Interpreter ABI Platform Actions
pactus-0.5.0-py3-none-any.whl Python 3 none any Details for pactus-0.5.0-py3-none-any.whl

Total release size: 674.5 kB

Release files / pactus-0.5.0.tar.gz

Download URL pactus-0.5.0.tar.gz
Size 649.5 kB
Tags Source
SHA-256 checksum
How to use checksums
afe423c5e4ac14f48c3e8d199b3fc877d46162cef114cf5e4e8031aaaf899d12
BLAKE2b-256 checksum
How to use checksums
b819652e83c903a840b303eaeca711b2fef4ea848c7945db212eb7893c95e5ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pactus-0.5.0-py3-none-any.whl

Download URL pactus-0.5.0-py3-none-any.whl
Size 25.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
790a635541d4e5531381c1c1973fc0439e5c41b46e97df487bc70b460ff6bae0
BLAKE2b-256 checksum
How to use checksums
d44c4b27ebace0f98d8f0a5b3dd34c0e8a6a1a4c9845975b2d70951502c46c26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for pactus 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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