Skip to main content

Framework to evaluate Trajectory Classification Algorithms

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pactus-0.4.2.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

pactus-0.4.2-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

Details for the file pactus-0.4.2.tar.gz.

File metadata

  • Download URL: pactus-0.4.2.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.6

File hashes

Hashes for pactus-0.4.2.tar.gz
Algorithm Hash digest
SHA256 bbd28d9fdf86a6cd840718956aec1fb512f65fcfe1dc593dd603ec203000eeed
MD5 b28e432701f2f6b4cb3896f0fdadd78a
BLAKE2b-256 411c73d25c8e673489a025b3b51561b6f3ede1e75e0909847195bc605bda27f9

See more details on using hashes here.

File details

Details for the file pactus-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: pactus-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 24.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.6

File hashes

Hashes for pactus-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7adc00dfd2265cd4ad17268d0e45f03556648c20f7dc4cda77577447bd3d3a8c
MD5 952be4707e9d99c662f6a611459d79be
BLAKE2b-256 91153643b1341e56515fae27ff27f823cbacd0cfeb9f1f2e5fbe7ffdd1afcae8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page