ml4gw.transforms.integrator

Classes

LeakyIntegrator(threshold, decay, ...)

This integrator accumulates evidence when the input exceeds a threshold and decays linearly.

TophatIntegrator(sample_rate, integration_length)

Applies a causal boxcar (moving-average) filter along the last dimension of the input tensor.

class ml4gw.transforms.integrator.LeakyIntegrator(threshold, decay, lower_bound, integrate_value)

Bases: Module

This integrator accumulates evidence when the input exceeds a threshold and decays linearly. The accumulator can either increment by a constant value (event counting) or by the input score itself.

Parameters:
  • threshold (float) -- Minimum value required to contribute to the accumulator.

  • decay (float) -- Amount subtracted per timestep when the threshold condition is not met.

  • lower_bound (float) -- Lowest allowed value of the cumulative accumulator. The output is clipped so it never falls below this value.

  • integrate_value (Literal["count", "score"]) --

    Integration mode. Must be one of:
    • "count": increment by 1 per threshold crossing

    • "score": increment by the input value per

      threshold crossing

Shape:
  • Input: (..., T)

  • Output: (..., T)

Returns:

Cumulative leaky integral of the input sequence.

Return type:

torch.Tensor

Parameters:
  • threshold (float)

  • decay (float)

  • lower_bound (float)

  • integrate_value (Literal['count', 'score'])

forward(x)
Return type:

Tensor

Parameters:

x (Tensor)

class ml4gw.transforms.integrator.TophatIntegrator(sample_rate, integration_length)

Bases: Module

Applies a causal boxcar (moving-average) filter along the last dimension of the input tensor. Each output sample represents the average of the previous integration_length seconds of data. Zero-padding is applied on the left so that the output has the same length as the input. As a result, the first few samples are computed from partial windows and therefore have smaller magnitude.

Parameters:
  • sample_rate (int) -- Sampling rate (Hz) of the input timeseries.

  • integration_length (int) -- Integration window length in seconds.

Shape:
  • Input: (..., T)

  • Output: (..., T)

Returns:

Integrated timeseries with the same length as the input.

Return type:

torch.Tensor

Parameters:
  • sample_rate (int)

  • integration_length (int)

forward(x)
Return type:

Tensor

Parameters:

x (Tensor)