Skip to main content

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:

❯ python --version
Python 3.8.0

Then, you can simply 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

Contributing

Follow the guidlines from pactus documentation

Metadata

Release files for pactus 0.4.3

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.4.3
File Size Uploaded
pactus-0.4.3.tar.gz 19.9 kB Details

Built distribution (wheel)

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

Total release size: 44.2 kB

Release files / pactus-0.4.3.tar.gz

Download URL pactus-0.4.3.tar.gz
Size 19.9 kB
Tags Source
SHA-256 checksum
How to use checksums
68e86ae1cf176dbd1618a4564f947cb3858c8b9b37f652bf2338499f51bcaab1
BLAKE2b-256 checksum
How to use checksums
474fe1891c994fdfaaa3591d2d8b85d64f4fe20d27165a7cc2ea29e9e1aebe72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.6

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

Download URL pactus-0.4.3-py3-none-any.whl
Size 24.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c572b9fb29f9f64151fb42962daf2fc086a4b41e2906c57eded9c01ca6b29a4c
BLAKE2b-256 checksum
How to use checksums
f764afc2beaace7ba27474fd8a820590be97432cb444bbde08c2f577e7cc0100
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.6
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