Segmentation Functionality

Contents

Segmentation Functionality#

Descriptions of the basic functions are given below.

Function descriptions:

tsam.utils.segmentation.segmentation(normalizedTypicalPeriods, noSegments, timeStepsPerPeriod, representationMethod=None, representationDict=None, distributionPeriodWise=True, predefSegmentOrder=None, predefSegmentDurations=None, predefSegmentCenters=None)[source]#

Agglomerative clustering of adjacent time steps within a set of typical periods in order to further reduce the temporal resolution within typical periods and to further reduce complexity of input data.

Parameters:
  • normalizedTypicalPeriods (pandas DataFrame) – MultiIndex DataFrame containing the typical periods as first index, the time steps within the periods as second index and the attributes as columns.

  • noSegments (integer) – Number of segments in which the typical periods should be subdivided - equivalent to the number of inner-period clusters.

  • timeStepsPerPeriod (integer) – Number of time steps per period

  • predefSegmentOrder (list or None) – Predefined segment assignments per timestep, per typical period. If provided, skips clustering and uses these assignments directly. List of lists/arrays, one per typical period.

  • predefSegmentDurations (list or None) – Predefined durations per segment, per typical period. Required if predefSegmentOrder is provided. List of lists/arrays, one per typical period.

  • predefSegmentCenters (list or None) – Predefined center indices per segment, per typical period. If provided with predefSegmentOrder, uses these as segment centers instead of calculating representations. List of lists/arrays, one per typical period.

Returns:

  • segmentedNormalizedTypicalPeriods (pandas DataFrame) – MultiIndex DataFrame similar to normalizedTypicalPeriods but with segments instead of time steps. Moreover, two additional index levels define the length of each segment and the time step index at which each segment starts.

  • predictedSegmentedNormalizedTypicalPeriods (pandas DataFrame) – MultiIndex DataFrame with the same shape of normalizedTypicalPeriods, but with overwritten values derived from segmentation used for prediction of the original periods and accuracy indicators.

  • segmentCenterIndicesList (list) – List of segment center indices per typical period. Each entry is a list of indices indicating which timestep is the representative for each segment.