gloria.IntermittentEvent#
- class gloria.IntermittentEvent(*, name, prior_scale, profile, t_list=[])[source]#
A regressor to model reoccuring events at given times.
The regressor is added to the
Gloria
model usingadd_event()
and does not need to be handled directly by the user.- Parameters:
name (str) – A descriptive, unique name to identify the regressor.
prior_scale (float) – Parameter modulating the strength of the regressors. Larger values allow the model to fit a larger impact of the event, smaller values dampen the impact. Must be larger than zero.
profile (Profile) – The profile that occurs at
t_anchor
. Allowed profile types are described in the Profiles section.t_list (list[
pandas.Timestamp
] | list[str]) – A list of timestamps at whichprofile
occurs. The exact meaning of each timestamp in the list depends on implementation details of the underlyingprofile
, but typically refers to its mode.
Methods
- classmethod from_dict(regressor_dict)[source]#
Creates an IntermittentEvent object from a dictionary.
The key-value pairs of the dictionary must correspond to the constructor arguments of the regressor.
- get_impact(t)[source]#
Calculate fraction of overall profiles occurring within a timerange.
- Parameters:
t (
pandas.Series
) – A series ofpandas.Timestamp
.self (Self)
- Returns:
impact – Fraction of overall profiles occurring between minimum and maximum date of
t
.- Return type:
- make_feature(t, regressor=None)[source]#
Create the feature matrix for the intermittent event regressor.
- Parameters:
t (
pandas.Series
) – A series ofpandas.Timestamp
at which the regressor has to be evaluatedregressor (
pandas.Series
) – Contains the values for the regressor that will be added to the feature matrix unchanged. Only has effect forExternalRegressor
. Any input will be ignored forIntermittentEvent
.self (Self)
- Returns:
X (
pandas.DataFrame
) – The feature matrix containing the data of the regressor.prior_scales (dict) – A map for
feature matrix column name
→prior_scale
.
- Return type: