Temporospatial clustering in Python. Well suited for mobility data.
Project description
Infostop
Python package for detecting stop locations in mobility data
This package implements the algorithm described in (paper not written yet), for detecting stop locations in time-ordered location data.
Usage
Given a location trace such as:
>>> data
array([[ 55.75259295, 12.34353885 ],
[ 55.7525908 , 12.34353145 ],
[ 55.7525876 , 12.3435386 ],
...,
[ 63.40379175, 10.40477095 ],
[ 63.4037841 , 10.40480265 ],
[ 63.403787 , 10.4047871 ]])
Or with time information
>>> data
array([[ 55.75259295, 12.34353885, 1581401760 ],
[ 55.7525908 , 12.34353145, 1581402760 ],
[ 55.7525876 , 12.3435386 , 1581403760 ],
...,
[ 63.40379175, 10.40477095, 1583401760 ],
[ 63.4037841 , 10.40480265, 1583402760 ],
[ 63.403787 , 10.4047871 , 1583403760 ]])
A stop location solution can be obtained using:
>>> from infostop import Infostop
>>> model = Infostop()
>>> labels = model.fit_predict(data)
Alternatively, data
can also be a list of numpy.array
s, in which case it is assumed that list elements are seperate traces in the same space. In this multi segment (or multi user) case, Infostop finds stop locations that are shared by different segments.
Solutions can be plotted using:
>>> from infostop import plot_map
>>> folmap = plot_map(model)
>>> folmap.m
Plotting this onto a map:
For more examples and full documentation check out the documentation page.
Advantages
- Simplicity: At its core, the method works by two steps. (1) Reducing the location trace to the medians of each stationary event and (2) embedding the resulting locations into a network that connects locations that are within a user-defined distance and clustering that network.
- Multi-trace support: Currently, no other libraries support clustering multiple traces at once to find global stop locations. Infostop does. The image above visualizes stop locations at a campus for a population of almost 1000 university students.
- Flow based: Spatial clusters correspond to collections of location points that contain large amounts of flow when represented as a network. This enables the recovery of locations where traces slightly overlap.
- Speed: First the point space is reduced to the median of stationary points (executed in a fast C++ module), then spatially neighboring points connected using a Ball search tree algorithm, and finally the network is clustered using the C++ based Infomap program. For example, clustering 100.000 location points takes about a second.
Installation
pip install infostop
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file infostop-0.1.1.tar.gz
.
File metadata
- Download URL: infostop-0.1.1.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fe7de6d25e0224f96c969c05884e4c8d8716bb3660f1c53009185041ed2bd38 |
|
MD5 | 80e06ed63617120ff15b247e0473170b |
|
BLAKE2b-256 | 898843b41438b344e2180d9ceff5af368585ba6ef2cbccd1967c66ef89ff28fc |
File details
Details for the file infostop-0.1.1-cp37-cp37m-macosx_10_7_x86_64.whl
.
File metadata
- Download URL: infostop-0.1.1-cp37-cp37m-macosx_10_7_x86_64.whl
- Upload date:
- Size: 67.8 kB
- Tags: CPython 3.7m, macOS 10.7+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11503253d920d906d763f80fd82ecbf1d8616b91329069e95fd76e15ad87280e |
|
MD5 | 01ae4a47742dc2448b53e994673698a1 |
|
BLAKE2b-256 | f4cb828fa5b7e3d083decce13ac40d5da71d5855af12dfae1b48b45679be7e6f |