Quickstart#

Installation#

tsl is compatible with Python>=3.8. We recommend installation on a Anaconda or Miniconda environment or a virtual env.

Before installation

tsl is built upon PyTorch>=1.9 and PyG>=2.0.3. Make sure you have both installed in your environment before installing tsl. In the following, we provide instructions on how to install them for the chosen installation procedure.

Installing using conda#

Tip

Using conda allows to automatically solve PyTorch and PyG dependencies, choosing the latest CUDA version available supported by the system.

To install tsl using conda, clone the repository, navigate to the library root directory and create a new conda environment using the provided conda configuration:

git clone https://github.com/TorchSpatiotemporal/tsl.git
cd tsl
conda env create -f conda_env.yml

Then, activate the environment and install tsl using pip.

conda activate tsl
python setup.py install  # Or 'pip install .'

Note

Installation of tsl directly from conda is on the roadmap!

Installing using pip#

Alternatively, you can install the library directly from pip. Please refer to PyTorch and PyG installation guidelines for installation without conda. After having installed the libraries, install torch-spatiotemporal using pip. For the latest version:

pip install git+https://github.com/TorchSpatiotemporal/tsl.git

For the stable version:

pip install torch-spatiotemporal

Example scripts#

The github repository hosts example scripts and notebooks on how to use the library for different use cases, such as spatiotemporal predictions and imputations. You can refer to the notebook A Gentle Introduction to tsl for an introductory overview of the library main functionalities.

Open In Colab

Citing#

If you use Torch Spatiotemporal for your research, please consider citing the library

@software{Cini_Torch_Spatiotemporal_2022,
    author = {Cini, Andrea and Marisca, Ivan},
    license = {MIT},
    month = {3},
    title = {{Torch Spatiotemporal}},
    url = {https://github.com/TorchSpatiotemporal/tsl},
    year = {2022}
}