Deep generative modeling for time-stamped heterogeneous data, enabling high-fidelity models for a large variety of spatio-temporal domains.

Overview

Neural Spatio-Temporal Point Processes [arxiv]

Ricky T. Q. Chen, Brandon Amos, Maximilian Nickel

Abstract. We propose a new class of parameterizations for spatio-temporal point processes which leverage Neural ODEs as a computational method and enable flexible, high-fidelity models of discrete events that are localized in continuous time and space. Central to our approach is a combination of recurrent continuous-time neural networks with two novel neural architectures, i.e., Jump and Attentive Continuous-time Normalizing Flows. This approach allows us to learn complex distributions for both the spatial and temporal domain and to condition non-trivially on the observed event history. We validate our models on data sets from a wide variety of contexts such as seismology, epidemiology, urban mobility, and neuroscience.

TL;DR. We explore a natural extension of deep generative modeling to time-stamped heterogeneous data sets, enabling high-fidelity models for a large variety of spatio-temporal domains.

Caption. A Neural STPP modeling a process where each observation increases the probability of observing from the next cluster in a clock-wise order. Slowly reverts back to the marginal distribution after a period of no new observations.

Setup

Dependencies:

Run at the root of this repo:

python setup.py build_ext --inplace

Data

Code to automatically download and preprocess most data sets can also be found in the data folder. Simply run

python download_and_preprocess_<data>.py

where data is one of citibike|covid19|earthquakes.

The BOLD5000 dataset requires manually downloading files from their website. Specifically, the files satisfying {}_Unfilt_BOLD_CSI1_Sess-{}_Run-{} should be unzipped and placed in the data/bold5000/ folder.

Training

# data should be one of earthquakes_jp|fmri|citibikes|covid_nj_cases|pinwheel.
data=earthquakes_jp

# train a self-exciting baseline.
python train_stpp.py --data $data --model gmm --tpp hawkes

# train a time-varying CNF.
python train_stpp.py --data $data --model tvcnf

# train a Jump CNF.
python train_stpp.py --data $data --model jumpcnf --tpp neural --solve_reverse

# train an Attentive CNF.
python train_stpp.py --data $data --model attncnf --tpp neural --l2_attn

See additional arguments using python train_stpp.py --help.

Citations

If you find this repository helpful in your publications, please consider citing our paper.

@inproceedings{chen2021neuralstpp,
title={Neural Spatio-Temporal Point Processes},
author={Ricky T. Q. Chen and Brandon Amos and Maximilian Nickel},
booktitle={International Conference on Learning Representations},
year={2021},
}

Licensing

This repository is licensed under the CC BY-NC 4.0 License.

Comments
  • problem of downloading earthquake data

    problem of downloading earthquake data

    The earthquake file downloaded by ./data/download_and_preprocess_earthquakes.py : download_data can not be obtained.

    ''' Traceback (most recent call last): File "download_and_preprocess_earthquakes.py", line 65, in filenames.append(download_data(1990, 1999)) File "download_and_preprocess_earthquakes.py", line 17, in download_data urllib.request.urlretrieve(url, filename) File "/opt/anaconda3/envs/STNN/lib/python3.7/urllib/request.py", line 257, in urlretrieve tfp = open(filename, 'wb') FileNotFoundError: [Errno 2] No such file or directory: 'earthquakes/1990_1999.csv' '''

    opened by BIRD-TAO 1
  • Hawkes Process implementation is giving negative Loss

    Hawkes Process implementation is giving negative Loss

    https://github.com/facebookresearch/neural_stpp/blob/4258cee81b40e7573bd8289a74c0006d8eace722/models/temporal/basic.py#L37

    Hawkes process is giving negative loss because loglik is becoming greater than compensator.

    opened by tonygracious 0
  • Constants in the intensity function

    Constants in the intensity function

    The paper states that , where is a neural network with a softplus nonlinearity applied to the output, to ensure the intensity is positive. However, the implementation is not consistent, where a sigmoid activation function is used. In addition, it is hard to understand the constants 2.0 and 50 in the following intensity calculation function.

    def get_intensity(self, tpp_state): 
        return torch.sigmoid(self.intensity_fn(tpp_state[..., :self.hdim]) - 2.0) * 50
    
    opened by YuanYuan98 0
  • two typos

    two typos

    Hi,

    I am converting the PR into an issue. I am also seeking long-term advice for working with noncommercial licenses for academic purposes.

    Thanks, Yifei

    opened by yifeim 1
  • neural ode backpropagation error

    neural ode backpropagation error

    I'm running this code for the earthquake data and had to do some readjustments as now I'm also including depth in the dataset so spatial locations are now 3d (instead of being 2d: lat and long)

    Now I'm facing this issue which is due to backpropagation through the neural ode (odjoint_ode) and I really have no idea what the problem is. Can someone help me with this?

    -- Process 0 terminated with the following error: Traceback (most recent call last): File "/opt2/software/Anaconda3/2020.11/lib/python3.8/site-packages/torch/multiprocessing/spawn.py", line 59, in _wrap fn(i, *args) File "/home/ne12/Downloads/neural_stpp-main/train_stpp.py", line 145, in main _main(rank, world_size, args, savepath, logger) File "/home/ne12/Downloads/neural_stpp-main/train_stpp.py", line 370, in _main loss.backward() File "/opt2/software/Anaconda3/2020.11/lib/python3.8/site-packages/torch/tensor.py", line 245, in backward torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs) File "/opt2/software/Anaconda3/2020.11/lib/python3.8/site-packages/torch/autograd/init.py", line 145, in backward Variable._execution_engine.run_backward( File "/opt2/software/Anaconda3/2020.11/lib/python3.8/site-packages/torch/autograd/function.py", line 89, in apply return self._forward_cls.backward(self, *args) # type: ignore File "/opt2/software/Anaconda3/2020.11/lib/python3.8/site-packages/torchdiffeq/_impl/adjoint.py", line 126, in backward aug_state = odeint( File "/opt2/software/Anaconda3/2020.11/lib/python3.8/site-packages/torchdiffeq/_impl/odeint.py", line 77, in odeint solution = solver.integrate(t) File "/opt2/software/Anaconda3/2020.11/lib/python3.8/site-packages/torchdiffeq/_impl/solvers.py", line 28, in integrate self._before_integrate(t) File "/opt2/software/Anaconda3/2020.11/lib/python3.8/site-packages/torchdiffeq/_impl/rk_common.py", line 161, in _before_integrate f0 = self.func(t[0], self.y0) File "/opt2/software/Anaconda3/2020.11/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/opt2/software/Anaconda3/2020.11/lib/python3.8/site-packages/torchdiffeq/_impl/misc.py", line 191, in forward return self.base_func(t, y) File "/opt2/software/Anaconda3/2020.11/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/opt2/software/Anaconda3/2020.11/lib/python3.8/site-packages/torchdiffeq/_impl/misc.py", line 159, in forward return self.mul * self.base_func(-t, y) File "/opt2/software/Anaconda3/2020.11/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/opt2/software/Anaconda3/2020.11/lib/python3.8/site-packages/torchdiffeq/_impl/misc.py", line 138, in forward f = self.base_func(t, _flat_to_shape(y, (), self.shapes)) File "/opt2/software/Anaconda3/2020.11/lib/python3.8/site-packages/torchdiffeq/_impl/adjoint.py", line 93, in augmented_dynamics _params = tuple(torch.as_strided(param, (), ()) for param in adjoint_params) # noqa File "/opt2/software/Anaconda3/2020.11/lib/python3.8/site-packages/torchdiffeq/_impl/adjoint.py", line 93, in _params = tuple(torch.as_strided(param, (), ()) for param in adjoint_params) # noqa RuntimeError: setStorage: sizes [], strides [], storage offset 0, and itemsize 4 requiring a storage size of 4 are out of bounds for storage of size 0

    opened by Negar-Erfanian 0
  • Difficulty in understanding the class JumpCNF

    Difficulty in understanding the class JumpCNF

    https://github.com/facebookresearch/neural_stpp/blob/4258cee81b40e7573bd8289a74c0006d8eace722/models/spatial/jumpcnf.py#L29

    Is it possible for the authors to include for more comments for this class. I am finding it difficult to understand the logic of your code ?

    opened by tonygracious 0
  • With the trained SelfAttentiveCNF model, how would you sample/simulate a spatiotemporal series for a day?

    With the trained SelfAttentiveCNF model, how would you sample/simulate a spatiotemporal series for a day?

    Thank you for your work and clean code. From this code, I'm not sure how to sample times and locations conditioned on the times through the model. Would really appreciate some pointers from the authors.

    I'm working on citibike (trained a model already) and was trying to sample/simulate a [time, lat, long] series for a day.

    opened by CubicQubit 2
Owner
Facebook Research
Facebook Research
This is the official Pytorch implementation of the paper "Diverse Motion Stylization for Multiple Style Domains via Spatial-Temporal Graph-Based Generative Model"

Diverse Motion Stylization (Official) This is the official Pytorch implementation of this paper. Diverse Motion Stylization for Multiple Style Domains

Soomin Park 28 Dec 16, 2022
HiFi-GAN: Generative Adversarial Networks for Efficient and High Fidelity Speech Synthesis

HiFi-GAN: Generative Adversarial Networks for Efficient and High Fidelity Speech Synthesis Jungil Kong, Jaehyeon Kim, Jaekyoung Bae In our paper, we p

Rishikesh (ऋषिकेश) 31 Dec 8, 2022
HiFi-GAN: High Fidelity Denoising and Dereverberation Based on Speech Deep Features in Adversarial Networks

HiFiGAN Denoiser This is a Unofficial Pytorch implementation of the paper HiFi-GAN: High Fidelity Denoising and Dereverberation Based on Speech Deep F

Rishikesh (ऋषिकेश) 134 Dec 27, 2022
Learning Spatio-Temporal Transformer for Visual Tracking

STARK The official implementation of the paper Learning Spatio-Temporal Transformer for Visual Tracking Hiring research interns for visual transformer

Multimedia Research 484 Dec 29, 2022
Spontaneous Facial Micro Expression Recognition using 3D Spatio-Temporal Convolutional Neural Networks

Spontaneous Facial Micro Expression Recognition using 3D Spatio-Temporal Convolutional Neural Networks Abstract Facial expression recognition in video

Bogireddy Sai Prasanna Teja Reddy 103 Dec 29, 2022
Implementation of the "PSTNet: Point Spatio-Temporal Convolution on Point Cloud Sequences" paper.

PSTNet: Point Spatio-Temporal Convolution on Point Cloud Sequences Introduction Point cloud sequences are irregular and unordered in the spatial dimen

Hehe Fan 63 Dec 9, 2022
ESTDepth: Multi-view Depth Estimation using Epipolar Spatio-Temporal Networks (CVPR 2021)

ESTDepth: Multi-view Depth Estimation using Epipolar Spatio-Temporal Networks (CVPR 2021) Project Page | Video | Paper | Data We present a novel metho

null 65 Nov 28, 2022
Code for the paper "Spatio-temporal Self-Supervised Representation Learning for 3D Point Clouds" (ICCV 2021)

Spatio-temporal Self-Supervised Representation Learning for 3D Point Clouds This is the official code implementation for the paper "Spatio-temporal Se

Hesper 63 Jan 5, 2023
Digital Twin Mobility Profiling: A Spatio-Temporal Graph Learning Approach

Digital Twin Mobility Profiling: A Spatio-Temporal Graph Learning Approach This is the implementation of traffic prediction code in DTMP based on PyTo

chenxin 1 Dec 19, 2021
DeepSTD: Mining Spatio-temporal Disturbances of Multiple Context Factors for Citywide Traffic Flow Prediction

DeepSTD: Mining Spatio-temporal Disturbances of Multiple Context Factors for Citywide Traffic Flow Prediction This is the implementation of DeepSTD in

null 5 Sep 26, 2022
Codes for TIM2021 paper "Anchor-Based Spatio-Temporal Attention 3-D Convolutional Networks for Dynamic 3-D Point Cloud Sequences"

Codes for TIM2021 paper "Anchor-Based Spatio-Temporal Attention 3-D Convolutional Networks for Dynamic 3-D Point Cloud Sequences"

Intelligent Robotics and Machine Vision Lab 4 Jul 19, 2022
Spatio-Temporal Entropy Model (STEM) for end-to-end leaned video compression.

Spatio-Temporal Entropy Model A Pytorch Reproduction of Spatio-Temporal Entropy Model (STEM) for end-to-end leaned video compression. More details can

null 16 Nov 28, 2022
Self-supervised spatio-spectro-temporal represenation learning for EEG analysis

EEG-Oriented Self-Supervised Learning and Cluster-Aware Adaptation This repository provides a tensorflow implementation of a submitted paper: EEG-Orie

Wonjun Ko 4 Jun 9, 2022
[CVPR 2022 Oral] TubeDETR: Spatio-Temporal Video Grounding with Transformers

TubeDETR: Spatio-Temporal Video Grounding with Transformers Website • STVG Demo • Paper This repository provides the code for our paper. This includes

Antoine Yang 108 Dec 27, 2022
《Towards High Fidelity Face Relighting with Realistic Shadows》(CVPR 2021)

Towards High Fidelity Face-Relighting with Realistic Shadows Andrew Hou, Ze Zhang, Michel Sarkis, Ning Bi, Yiying Tong, Xiaoming Liu. In CVPR, 2021. T

null 114 Dec 10, 2022
Tensorflow python implementation of "Learning High Fidelity Depths of Dressed Humans by Watching Social Media Dance Videos"

Learning High Fidelity Depths of Dressed Humans by Watching Social Media Dance Videos This repository is the official tensorflow python implementation

Yasamin Jafarian 287 Jan 6, 2023
UnivNet: A Neural Vocoder with Multi-Resolution Spectrogram Discriminators for High-Fidelity Waveform Generation

UnivNet UnivNet: A Neural Vocoder with Multi-Resolution Spectrogram Discriminators for High-Fidelity Waveform Generation. Training python train.py --c

Rishikesh (ऋषिकेश) 55 Dec 26, 2022
Unofficial PyTorch Implementation of UnivNet: A Neural Vocoder with Multi-Resolution Spectrogram Discriminators for High-Fidelity Waveform Generation

UnivNet UnivNet: A Neural Vocoder with Multi-Resolution Spectrogram Discriminators for High-Fidelity Waveform Generation This is an unofficial PyTorch

MINDs Lab 170 Jan 4, 2023
This repository contains the code for using the H3DS dataset introduced in H3D-Net: Few-Shot High-Fidelity 3D Head Reconstruction

H3DS Dataset This repository contains the code for using the H3DS dataset introduced in H3D-Net: Few-Shot High-Fidelity 3D Head Reconstruction Access

Crisalix 72 Dec 10, 2022