Skip to content

Commit f8dd4ee

Browse files
iLampardclaude
andcommitted
Flatten model package: move models out of torch_model/
With TensorFlow support removed, the torch_model subpackage is a vestige. Models now live directly under easy_tpp/model/ without the torch_ filename prefix (e.g. easy_tpp/model/nhp.py). The old easy_tpp.model.torch_model.* import paths keep working through shim modules that re-export from the new locations and emit a DeprecationWarning. Internal imports, docs, README links, the generation notebook, and the reference config are updated; legacy import identity is covered by tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 49eba0c commit f8dd4ee

39 files changed

Lines changed: 4172 additions & 4047 deletions

README.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,16 @@ We provide reference implementations of various state-of-the-art TPP papers:
7272

7373
| No | Publication | Model | Paper | Implementation |
7474
|:---:|:-----------:|:-------------:|:-----------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------|
75-
| 1 | KDD'16 | RMTPP | [Recurrent Marked Temporal Point Processes: Embedding Event History to Vector](https://www.kdd.org/kdd2016/papers/files/rpp1081-duA.pdf) | [PyTorch](easy_tpp/model/torch_model/torch_rmtpp.py) |
76-
| 2 | NeurIPS'17 | NHP | [The Neural Hawkes Process: A Neurally Self-Modulating Multivariate Point Process](https://arxiv.org/abs/1612.09328) | [PyTorch](easy_tpp/model/torch_model/torch_nhp.py) |
77-
| 3 | NeurIPS'19 | FullyNN | [Fully Neural Network based Model for General Temporal Point Processes](https://arxiv.org/abs/1905.09690) | [PyTorch](easy_tpp/model/torch_model/torch_fullynn.py) |
78-
| 4 | ICML'20 | SAHP | [Self-Attentive Hawkes process](https://arxiv.org/abs/1907.07561) | [PyTorch](easy_tpp/model/torch_model/torch_sahp.py) |
79-
| 5 | ICML'20 | THP | [Transformer Hawkes process](https://arxiv.org/abs/2002.09291) | [PyTorch](easy_tpp/model/torch_model/torch_thp.py) |
80-
| 6 | ICLR'20 | IntensityFree | [Intensity-Free Learning of Temporal Point Processes](https://arxiv.org/abs/1909.12127) | [PyTorch](easy_tpp/model/torch_model/torch_intensity_free.py) |
81-
| 7 | ICLR'21 | ODETPP | [Neural Spatio-Temporal Point Processes (simplified)](https://arxiv.org/abs/2011.04583) | [PyTorch](easy_tpp/model/torch_model/torch_ode_tpp.py) |
82-
| 8 | ICLR'22 | AttNHP | [Transformer Embeddings of Irregularly Spaced Events and Their Participants](https://arxiv.org/abs/2201.00044) | [PyTorch](easy_tpp/model/torch_model/torch_attnhp.py) |
83-
| 9 | NeurIPS'24 | WSMTHP | [Is Score Matching Suitable for Estimating Point Processes?](https://arxiv.org/abs/2410.04037) | [PyTorch](easy_tpp/model/torch_model/torch_wsm_thp.py) |
84-
| 10 | NeurIPS'25 | S2P2 | [Deep Continuous-Time State-Space Models for Marked Event Sequences](https://openreview.net/pdf?id=74SvE2GZwW) | [PyTorch](easy_tpp/model/torch_model/torch_s2p2.py) |
75+
| 1 | KDD'16 | RMTPP | [Recurrent Marked Temporal Point Processes: Embedding Event History to Vector](https://www.kdd.org/kdd2016/papers/files/rpp1081-duA.pdf) | [PyTorch](easy_tpp/model/rmtpp.py) |
76+
| 2 | NeurIPS'17 | NHP | [The Neural Hawkes Process: A Neurally Self-Modulating Multivariate Point Process](https://arxiv.org/abs/1612.09328) | [PyTorch](easy_tpp/model/nhp.py) |
77+
| 3 | NeurIPS'19 | FullyNN | [Fully Neural Network based Model for General Temporal Point Processes](https://arxiv.org/abs/1905.09690) | [PyTorch](easy_tpp/model/fullynn.py) |
78+
| 4 | ICML'20 | SAHP | [Self-Attentive Hawkes process](https://arxiv.org/abs/1907.07561) | [PyTorch](easy_tpp/model/sahp.py) |
79+
| 5 | ICML'20 | THP | [Transformer Hawkes process](https://arxiv.org/abs/2002.09291) | [PyTorch](easy_tpp/model/thp.py) |
80+
| 6 | ICLR'20 | IntensityFree | [Intensity-Free Learning of Temporal Point Processes](https://arxiv.org/abs/1909.12127) | [PyTorch](easy_tpp/model/intensity_free.py) |
81+
| 7 | ICLR'21 | ODETPP | [Neural Spatio-Temporal Point Processes (simplified)](https://arxiv.org/abs/2011.04583) | [PyTorch](easy_tpp/model/ode_tpp.py) |
82+
| 8 | ICLR'22 | AttNHP | [Transformer Embeddings of Irregularly Spaced Events and Their Participants](https://arxiv.org/abs/2201.00044) | [PyTorch](easy_tpp/model/attnhp.py) |
83+
| 9 | NeurIPS'24 | WSMTHP | [Is Score Matching Suitable for Estimating Point Processes?](https://arxiv.org/abs/2410.04037) | [PyTorch](easy_tpp/model/wsm_thp.py) |
84+
| 10 | NeurIPS'25 | S2P2 | [Deep Continuous-Time State-Space Models for Marked Event Sequences](https://openreview.net/pdf?id=74SvE2GZwW) | [PyTorch](easy_tpp/model/s2p2.py) |
8585

8686

8787

@@ -280,4 +280,3 @@ The following repositories are used in `EasyTPP`, either in close to original fo
280280
<span id='star-history'/>
281281

282282
![Star History Chart](https://api.star-history.com/svg?repos=ant-research/EasyTemporalPointProcess&type=Date)
283-

docs/source/advanced/implementation.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Model Implementation Details
55
Basic structure
66
===================================
77

8-
In the model folder, ``torch_basemodel.py`` implements shared likelihood,
8+
In the model folder, ``basemodel.py`` implements shared likelihood,
99
sampling, and generation utilities. Concrete model classes inherit from
1010
``TorchBaseModel`` and may use or override those utilities.
1111

@@ -136,7 +136,7 @@ Fully Neural Network based Model for General Temporal Point Processes (FullyNN)
136136
===============================================================================
137137

138138
The implementation follows the paper's cumulative-hazard construction and the
139-
torch references linked in ``torch_fullynn.py``.
139+
torch references linked in ``fullynn.py``.
140140

141141

142142
ODE-based Temporal Point Process (ODETPP)

docs/source/advanced/thinning_algo.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Thinning Algorithm for Sampling Event Sequences
55
EasyTPP's ``EventSampler`` implements the thinning procedure associated with
66
Algorithm 2 of `The Neural Hawkes Process: A Neurally Self-Modulating
77
Multivariate Point Process <https://arxiv.org/abs/1612.09328>`_. Its torch
8-
implementation is in ``easy_tpp/model/torch_model/torch_thinning.py``.
8+
implementation is in ``easy_tpp/model/thinning.py``.
99

1010

1111
Implementation

docs/source/dev_guide/model_custom.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ Create a new TPP Model Class
1111
=============================
1212

1313
New models inherit from
14-
`easy_tpp.model.torch_model.TorchBaseModel <../ref/models.html>`_.
14+
`easy_tpp.model.TorchBaseModel <../ref/models.html>`_.
1515

1616
.. code-block:: python
1717
18-
from easy_tpp.model.torch_model.torch_basemodel import TorchBaseModel
18+
from easy_tpp.model.basemodel import TorchBaseModel
1919
2020
# Custom Torch TPP implementations need to
2121
# inherit from the TorchBaseModel interface

easy_tpp/model/__init__.py

Lines changed: 51 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,52 @@
1-
from easy_tpp.model.torch_model.torch_anhn import ANHN as TorchANHN
2-
from easy_tpp.model.torch_model.torch_attnhp import AttNHP as TorchAttNHP
3-
from easy_tpp.model.torch_model.torch_basemodel import TorchBaseModel
4-
from easy_tpp.model.torch_model.torch_fullynn import FullyNN as TorchFullyNN
5-
from easy_tpp.model.torch_model.torch_intensity_free import IntensityFree as TorchIntensityFree
6-
from easy_tpp.model.torch_model.torch_nhp import NHP as TorchNHP
7-
from easy_tpp.model.torch_model.torch_ode_tpp import ODETPP as TorchODETPP
8-
from easy_tpp.model.torch_model.torch_rmtpp import RMTPP as TorchRMTPP
9-
from easy_tpp.model.torch_model.torch_s2p2 import S2P2 as TorchS2P2
10-
from easy_tpp.model.torch_model.torch_sahp import SAHP as TorchSAHP
11-
from easy_tpp.model.torch_model.torch_thp import THP as TorchTHP
12-
from easy_tpp.model.torch_model.torch_wsm_thp import WSMTHP as TorchWSMTHP
1+
from easy_tpp.model.anhn import ANHN
2+
from easy_tpp.model.attnhp import AttNHP
3+
from easy_tpp.model.basemodel import TorchBaseModel
4+
from easy_tpp.model.fullynn import FullyNN
5+
from easy_tpp.model.intensity_free import IntensityFree
6+
from easy_tpp.model.nhp import NHP
7+
from easy_tpp.model.ode_tpp import ODETPP
8+
from easy_tpp.model.rmtpp import RMTPP
9+
from easy_tpp.model.s2p2 import S2P2
10+
from easy_tpp.model.sahp import SAHP
11+
from easy_tpp.model.thinning import EventSampler
12+
from easy_tpp.model.thp import THP
13+
from easy_tpp.model.wsm_thp import WSMTHP
1314

14-
__all__ = ['TorchBaseModel',
15-
'TorchNHP',
16-
'TorchAttNHP',
17-
'TorchTHP',
18-
'TorchSAHP',
19-
'TorchFullyNN',
20-
'TorchIntensityFree',
21-
'TorchODETPP',
22-
'TorchRMTPP',
23-
'TorchANHN',
24-
'TorchS2P2',
25-
'TorchWSMTHP']
15+
TorchANHN = ANHN
16+
TorchAttNHP = AttNHP
17+
TorchFullyNN = FullyNN
18+
TorchIntensityFree = IntensityFree
19+
TorchNHP = NHP
20+
TorchODETPP = ODETPP
21+
TorchRMTPP = RMTPP
22+
TorchS2P2 = S2P2
23+
TorchSAHP = SAHP
24+
TorchTHP = THP
25+
TorchWSMTHP = WSMTHP
26+
27+
__all__ = [
28+
'ANHN',
29+
'AttNHP',
30+
'FullyNN',
31+
'IntensityFree',
32+
'NHP',
33+
'ODETPP',
34+
'RMTPP',
35+
'S2P2',
36+
'SAHP',
37+
'THP',
38+
'WSMTHP',
39+
'TorchBaseModel',
40+
'EventSampler',
41+
'TorchANHN',
42+
'TorchAttNHP',
43+
'TorchFullyNN',
44+
'TorchIntensityFree',
45+
'TorchNHP',
46+
'TorchODETPP',
47+
'TorchRMTPP',
48+
'TorchS2P2',
49+
'TorchSAHP',
50+
'TorchTHP',
51+
'TorchWSMTHP',
52+
]

0 commit comments

Comments
 (0)