Skip to main content

Implementation of Traclus for 2-D trajectories

Project description

# traclus_impl

### Purpose This is a Python implementation of the Traclus algorithm. It works for 2-D trajectories. Note that this was written as a piece of a senior project. This traclus implementation should functionally work, but it is currently slow on larger sets of trajectories.

### Install The easiest way to install is with pip install traclus_impl.

### Usage To run the Traclus algorithm, run traclus_impl.main.py, passing it the name of an input file and output file. The input file contains a json object with parameters to traclus and the raw trajectories. See “traclus_impl.integ_tests.raw_campus_trajectories.txt” for an example input file. The output file will contain a json list of representative trajectories. Optionally, provide names of files to dump the output from the partitioning and clustering stages to.

Example: navigate to directory where traclus_impl.main.py is and run “python main.py -i ./raw_traj_input -o ./traclus_output

Note that the actual entry point function of the real computation is “run_traclus” in traclus_impl.coordination.py. The “run_traclus” function takes Traclus arguments and a list of trajectories. The list of trajectories input to “run_traclus” is a list of traclus_impl.geometry.Point objects, and it returns a list of representative line segments as this same type of object.

main.py only parses arguments to traclus, calls run_traclus, and writes them to a file. It is mostly just an example of a way to use the “run_traclus” function.

The best example of complete usage is the test in “traclus_impl.integ_tests.campus_trajectories_processing_test.py”.

### Intermediate output hooks ### The “run_traclus” function in traclus_impl.coordination.py optionally takes hooks for the output of the partitioning stage and clustering stage. The hook functions for these in main.py and the “traclus_impl.integ_tests.campus_trajectories_processing_test.py” tests show some example usage.

### Running the tests. Tests exist under the traclus_impl.tests and traclus_impl.integ_tests. To run all of the tests from the commandline, navigate to the package’s root and run: python -m unittest discover -p “_test.py”

### Notes on Performance ### * Currently, the main bottleneck seems to be the quadratic clustering, and future work includes improving this. For some larger trajectory sets such as the elk file under integ_tests/deer_tests, this implementation will take a very long time. * traclus_impl.integ_tests.deer_tests.run_traclus.py is mostly used for profiling this traclus implementation on the trajectories in that folder.

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

traclus_impl-0.9.5.zip (478.9 kB view details)

Uploaded Source

File details

Details for the file traclus_impl-0.9.5.zip.

File metadata

  • Download URL: traclus_impl-0.9.5.zip
  • Upload date:
  • Size: 478.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for traclus_impl-0.9.5.zip
Algorithm Hash digest
SHA256 3ceea5fd68ee8938ca6a21a9e669804767a0cfdffba3d6c6b98cd3eb4224ba91
MD5 eff43a45be82d6b64fcb455694ed18ed
BLAKE2b-256 a557fd30bee41fc66e7d8a263b69c8841357e3447e3563ea0cb683b98e58ec97

See more details on using hashes here.

Supported by

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