TimeBinAggregate
Bins time series and aggregates by bin.
In transform, applies groupby with aggfunc on the temporal coordinate.
More precisely: bins encodes bins \(B_1, \dots, B_k\) where \(B_i\) are intervals, in the reals or in a temporal (time stamp) range.
In transform, the estimator TimeBinAggregate collects values at time stamps of X falling into \(B_i\) as a sample \(S_i\), and then applies aggfunc to \(S_i\) to obtain an aggregate value \(v_i\). The transformed series are values \(v_i\) at time stamps \(t_i\), determined from \(B_i\) per the rule in return_index.
Schnellstart
from sktime.transformations.binning import TimeBinAggregate
estimator = TimeBinAggregate(bins, aggfunc=None, return_index='bin_start')Parameter(3)
- bins1D array-like or pd.IntervalIndex
- if 1D array-like, is interpreted as breaks of bins breaks of bins defining intervals considered by aggfunc
- aggfunccallable * 1D array-like -> float), optional, default=np.mean
- Function used to aggregate the values in intervals. Should have signature 1D -> float and defaults to mean if None
- return_indexstr, one of the below; optional, default=”range”
“range” = RangeIndex with bins indexed in same order as in
bins“bin_start” = transformed pd.DataFrame will be indexed by bin starts “bin_end” = transformed pd.DataFrame will be indexed by bin starts “bin_mid” = transformed pd.DataFrame will be indexed by bin midpoints “bin” = transformed pd.DataFrame will havebinsasIntervalIndex
Beispiele
from sktime.datatypes import get_examples from sktime.transformations.binning import TimeBinAggregate bins = [0, 2, 4] X = get_examples(“pd.DataFrame”)[0] t = TimeBinAggregate([-1, 2, 10])