Metadata-Version: 2.1
Name: geot
Version: 0.1.0
Summary: Optimal Transport metrics for evaluating spatiotemporal predictions
License: MIT License
        
        Copyright (c) 2024 Mobility Information Engineering Lab at ETH Zürich
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Keywords: geographic,geospatial,optimal transport,spatiotemporal,metrics,evaluation
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: geomloss>=0.2.3
Requires-Dist: numpy>=1.21.0
Requires-Dist: pytest
Requires-Dist: wurlitzer>=3.1.0
Requires-Dist: wasserstein>=1.1.0
Requires-Dist: scipy>=1.8.0
Requires-Dist: matplotlib>=3.5.0
Requires-Dist: pandas>=1.5.3
Requires-Dist: POT>=0.9.0
Requires-Dist: notebook>=6.4.0

[![Paper](https://img.shields.io/badge/paper-arXiv-brightgreen)](https://s3.us-east-1.amazonaws.com/climate-change-ai/papers/iclr2024/41/paper.pdf)
![Tests](https://github.com/mie-lab/geospatialOT/actions/workflows/python-tests.yml/badge.svg)

# GEOT: A spatially explicit framework for evaluating spatio-temporal predictions

This repo contains code to evaluate spatiotemporal predictions with Optimal Transport (OT). In contrast to standard evaluation metrics (MSE, MAE etc), the OT error is a *spatial* metric that evaluates the spatial distribution of the errors.

![Alt text](assets/overview.png)

## Install

First, install a suitable [torch](https://pytorch.org/get-started/locally/) version. Then, install the package via pypi:

```
pip install geot
```
 
Or from source:
```
git clone https://github.com/mie-lab/geospatialOT.git
cd geospatialOT
conda create -n geot_env
conda activate geot_env
pip install .
```

Explanation of usage:
* Assume we want to predict some observations in several locations, e.g., bike sharing demand at bike sharing stations, over time
* Usually, the error is just averaged over locations (MSE between GT and prediction)
* However, in real-world applications, there are distance-based costs involved with prediction errors. For example, prediction errors cause costs for relocating bikes
* Assue we can define a *cost matrix* with the pairwise costs between locations, indicating the cost to account for errors
* With Optimal Transport, we can compute the minimum costs for transforming the predictions to the ground truth - a better indicator for the real-world costs of prediction errors than just the MSE

With this code, you can compute the OT error for your predictions. The input is usually just the `observations` at a set of location, the `predictions` and the `cost matrix`. The output is the OT error (a single number) or the optimal transport matrix T.


## Tutorial

Check out our [tutorial](tutorial.ipynb) to get started with a simple example.
