{"id":15642854,"url":"https://github.com/shchur/ifl-tpp","last_synced_at":"2025-04-30T11:11:43.260Z","repository":{"id":47987886,"uuid":"211085258","full_name":"shchur/ifl-tpp","owner":"shchur","description":"Implementation of \"Intensity-Free Learning of Temporal Point Processes\" (Spotlight @ ICLR 2020)","archived":false,"fork":false,"pushed_at":"2021-02-01T07:57:43.000Z","size":41901,"stargazers_count":80,"open_issues_count":3,"forks_count":31,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-29T16:03:40.526Z","etag":null,"topics":["normalizing-flows","pytorch","temporal-point-processes"],"latest_commit_sha":null,"homepage":"https://openreview.net/forum?id=HygOjhEYDH","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shchur.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-26T12:37:24.000Z","updated_at":"2024-10-21T06:42:10.000Z","dependencies_parsed_at":"2022-08-12T16:00:45.968Z","dependency_job_id":null,"html_url":"https://github.com/shchur/ifl-tpp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shchur%2Fifl-tpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shchur%2Fifl-tpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shchur%2Fifl-tpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shchur%2Fifl-tpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shchur","download_url":"https://codeload.github.com/shchur/ifl-tpp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223779728,"owners_count":17201287,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["normalizing-flows","pytorch","temporal-point-processes"],"created_at":"2024-10-03T11:57:52.152Z","updated_at":"2024-11-09T03:14:20.075Z","avatar_url":"https://github.com/shchur.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Intensity-Free Learning of Temporal Point Processes\n\nPytorch implementation of the paper [\"Intensity-Free Learning of Temporal Point Processes\"](https://openreview.net/forum?id=HygOjhEYDH), Oleksandr Shchur, Marin Biloš and Stephan Günnemann, ICLR 2020.\n\n## Refactored code\n\nThe `master` branch contains a refactored version of the code. Some of the original functionality is missing, but the code is much cleaner and should be easier to extend.\n\nYou can find the original code (used for experiments in the paper) on branch [`original-code`](https://github.com/shchur/ifl-tpp/tree/original-code).\n\n## Usage\nIn order to run the code, you need to install the `dpp` library that contains all the algorithms described in the paper\n```bash\ncd code\npython setup.py install\n```\n\nA Jupyter notebook [`code/interactive.ipynb`](https://github.com/shchur/ifl-tpp/blob/master/code/interactive.ipynb) contains the code for training models on the datasets used in the paper.\nThe same code can also be run as a Python script [`code/train.py`](https://github.com/shchur/ifl-tpp/blob/master/code/train.py).\n\n## Using your own data\nYou can save your custom dataset in the format used in our code as follows:\n\n```python\ndataset = {\n    \"sequences\": [\n        {\"arrival_times\": [0.2, 4.5, 9.1], \"marks\": [1, 0, 4], \"t_start\": 0.0, \"t_end\": 10.0},\n        {\"arrival_times\": [2.3, 3.3, 5.5, 8.15], \"marks\": [4, 3, 2, 2], \"t_start\": 0.0, \"t_end\": 10.0},\n    ],\n    \"num_marks\": 5,\n}\ntorch.save(dataset, \"data/my_dataset.pkl\")\n```\n\n## Defining new models\n[RecurrentTPP](https://github.com/shchur/ifl-tpp/blob/master/code/dpp/models/recurrent_tpp.py) is the base class for marked TPP models.\n\nYou just need to inherit from it and implement the `get_inter_time_dist` method that defines how to obtain the distribution (an instance of [`torch.distributions.Distribution`](https://github.com/pytorch/pytorch/blob/master/torch/distributions/distribution.py)) over the inter-event times given the context vector. For example, have a look at the [LogNormMix model](https://github.com/shchur/ifl-tpp/blob/master/code/dpp/models/log_norm_mix.py) from our paper.\nYou can also change the `get_features` and `get_context` methods of `RecurrentTPP` to, for example, use a transformer instead of an RNN.\n\n\n## Mistakes in the old version\n- In the old code we used to normalize the NLL of each sequence by the number of events --- this was incorrect. When computing NLL for multiple TPP sequences, we are only allowed to divide the NLL by the same number for each sequence.\n- In the old code we didn't include the survival time of the last event (i.e. time from the last event until the end of the obseved interval) into the NLL computation. This is fixed in the refactored version (and by the way, this seems to be a common mistake in other TPP implementations online).\n\n\n## Requirements\n```\nnumpy=1.16.4\npytorch=1.2.0\nscikit-learn=0.21.2\nscipy=1.3.1\n```\n\n\n## Cite\nPlease cite our paper if you use the code or datasets in your own work\n```\n@article{\n    shchur2020intensity,\n    title={Intensity-Free Learning of Temporal Point Processes},\n    author={Oleksandr Shchur and Marin Bilo\\v{s} and Stephan G\\\"{u}nnemann},\n    journal={International Conference on Learning Representations (ICLR)},\n    year={2020},\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshchur%2Fifl-tpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshchur%2Fifl-tpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshchur%2Fifl-tpp/lists"}