easy_tpp.model.torch_model.torch_fullynn

Classes

CumulHazardFunctionNetwork(model_config)

Cumulative Hazard Function Network ref: https://github.com/wassname/torch-neuralpointprocess

FullyNN(model_config)

Torch implementation of Fully Neural Network based Model for General Temporal Point Processes, NeurIPS 2019.

class easy_tpp.model.torch_model.torch_fullynn.CumulHazardFunctionNetwork(model_config)[source]

Cumulative Hazard Function Network ref: https://github.com/wassname/torch-neuralpointprocess

__init__(model_config)[source]

Initializes internal Module state, shared by both nn.Module and ScriptModule.

forward(hidden_states, time_delta_seqs)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class easy_tpp.model.torch_model.torch_fullynn.FullyNN(model_config)[source]

Torch implementation of Fully Neural Network based Model for General Temporal Point Processes, NeurIPS 2019. https://arxiv.org/abs/1905.09690

ref: https://github.com/KanghoonYoon/torch-neuralpointprocess/blob/master/module.py;

https://github.com/wassname/torch-neuralpointprocess

__init__(model_config)[source]

Initialize the model

Parameters:

model_config (EasyTPP.ModelConfig) – config of model specs.

forward(time_seqs, time_delta_seqs, type_seqs)[source]

Call the model

Parameters:
  • time_seqs (tensor) – [batch_size, seq_len], timestamp seqs.

  • time_delta_seqs (tensor) – [batch_size, seq_len], inter-event time seqs.

  • type_seqs (tensor) – [batch_size, seq_len], event type seqs.

Returns:

hidden states at event times.

Return type:

tensor

loglike_loss(batch)[source]

Compute the loglike loss.

Parameters:

batch (tuple, list) – batch input.

Returns:

loglike loss, num events.

Return type:

list

compute_intensities_at_sample_times(time_seqs, time_delta_seqs, type_seqs, sample_dtimes, **kwargs)[source]

Compute hidden states at sampled times.

Parameters:
  • time_seqs (tensor) – [batch_size, seq_len], times seqs.

  • time_delta_seqs (tensor) – [batch_size, seq_len], time delta seqs.

  • type_seqs (tensor) – [batch_size, seq_len], event type seqs.

  • sample_dtimes (tensor) – [batch_size, seq_len, num_samples], sampled inter-event timestamps.

Returns:

[batch_size, seq_len, num_samples, num_event_types], intensity at all sampled times.

Return type:

tensor