Class OverlappingTimeWindowFunction
- java.lang.Object
-
- org.datavec.api.transform.sequence.window.OverlappingTimeWindowFunction
-
- All Implemented Interfaces:
Serializable
,WindowFunction
public class OverlappingTimeWindowFunction extends Object implements WindowFunction
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OverlappingTimeWindowFunction.Builder
-
Constructor Summary
Constructors Constructor Description OverlappingTimeWindowFunction(String timeColumn, long windowSize, TimeUnit windowSizeUnit, long windowSeparation, TimeUnit windowSeparationUnit)
Constructor with zero offsetOverlappingTimeWindowFunction(String timeColumn, long windowSize, TimeUnit windowSizeUnit, long windowSeparation, TimeUnit windowSeparationUnit, boolean addWindowStartTimeColumn, boolean addWindowEndTimeColumn)
Constructor with zero offset, ability to add window start/end time columnsOverlappingTimeWindowFunction(String timeColumn, long windowSize, TimeUnit windowSizeUnit, long windowSeparation, TimeUnit windowSeparationUnit, long offset, TimeUnit offsetUnit)
Constructor with optional offsetOverlappingTimeWindowFunction(String timeColumn, long windowSize, TimeUnit windowSizeUnit, long windowSeparation, TimeUnit windowSeparationUnit, long offset, TimeUnit offsetUnit, boolean addWindowStartTimeColumn, boolean addWindowEndTimeColumn, boolean excludeEmptyWindows)
Constructor with optional offset, ability to add window start/end time columns
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<List<List<Writable>>>
applyToSequence(List<List<Writable>> sequence)
Apply the windowing function to the given sequenceSchema
getInputSchema()
void
setInputSchema(Schema schema)
String
toString()
Schema
transform(Schema inputSchema)
Get the output schema, given the input schema.
-
-
-
Constructor Detail
-
OverlappingTimeWindowFunction
public OverlappingTimeWindowFunction(String timeColumn, long windowSize, TimeUnit windowSizeUnit, long windowSeparation, TimeUnit windowSeparationUnit)
Constructor with zero offset- Parameters:
timeColumn
- Name of the column that contains the time values (must be a time column)windowSize
- Numerical quantity for the size of the time window (used in conjunction with windowSizeUnit)windowSizeUnit
- Unit of the time windowwindowSeparation
- The separation between consecutive window start times (used in conjunction with WindowSeparationUnit)windowSeparationUnit
- Unit for the separation between windows
-
OverlappingTimeWindowFunction
public OverlappingTimeWindowFunction(String timeColumn, long windowSize, TimeUnit windowSizeUnit, long windowSeparation, TimeUnit windowSeparationUnit, boolean addWindowStartTimeColumn, boolean addWindowEndTimeColumn)
Constructor with zero offset, ability to add window start/end time columns- Parameters:
timeColumn
- Name of the column that contains the time values (must be a time column)windowSize
- Numerical quantity for the size of the time window (used in conjunction with windowSizeUnit)windowSizeUnit
- Unit of the time windowwindowSeparation
- The separation between consecutive window start times (used in conjunction with WindowSeparationUnit)windowSeparationUnit
- Unit for the separation between windows
-
OverlappingTimeWindowFunction
public OverlappingTimeWindowFunction(String timeColumn, long windowSize, TimeUnit windowSizeUnit, long windowSeparation, TimeUnit windowSeparationUnit, long offset, TimeUnit offsetUnit)
Constructor with optional offset- Parameters:
timeColumn
- Name of the column that contains the time values (must be a time column)windowSize
- Numerical quantity for the size of the time window (used in conjunction with windowSizeUnit)windowSizeUnit
- Unit of the time windowwindowSeparation
- The separation between consecutive window start times (used in conjunction with WindowSeparationUnit)windowSeparationUnit
- Unit for the separation between windowsoffset
- Optional offset amount, to shift start/end of the time window forward or backoffsetUnit
- Optional offset unit for the offset amount.
-
OverlappingTimeWindowFunction
public OverlappingTimeWindowFunction(String timeColumn, long windowSize, TimeUnit windowSizeUnit, long windowSeparation, TimeUnit windowSeparationUnit, long offset, TimeUnit offsetUnit, boolean addWindowStartTimeColumn, boolean addWindowEndTimeColumn, boolean excludeEmptyWindows)
Constructor with optional offset, ability to add window start/end time columns- Parameters:
timeColumn
- Name of the column that contains the time values (must be a time column)windowSize
- Numerical quantity for the size of the time window (used in conjunction with windowSizeUnit)windowSizeUnit
- Unit of the time windowwindowSeparation
- The separation between consecutive window start times (used in conjunction with WindowSeparationUnit)windowSeparationUnit
- Unit for the separation between windowsoffset
- Optional offset amount, to shift start/end of the time window forward or backoffsetUnit
- Optional offset unit for the offset amount.addWindowStartTimeColumn
- If true: add a time column (name: "windowStartTime") that contains the start time of the windowaddWindowEndTimeColumn
- If true: add a time column (name: "windowEndTime") that contains the end time of the windowexcludeEmptyWindows
- If true: exclude any windows that don't have any values in them
-
-
Method Detail
-
setInputSchema
public void setInputSchema(Schema schema)
- Specified by:
setInputSchema
in interfaceWindowFunction
-
getInputSchema
public Schema getInputSchema()
- Specified by:
getInputSchema
in interfaceWindowFunction
- Returns:
-
transform
public Schema transform(Schema inputSchema)
Description copied from interface:WindowFunction
Get the output schema, given the input schema. Typically the output schema is the same as the input schema, but not necessarily (for example, if the window function adds columns for the window start/end times)- Specified by:
transform
in interfaceWindowFunction
- Parameters:
inputSchema
- Schema of the input data- Returns:
- Schema of the output windows
-
applyToSequence
public List<List<List<Writable>>> applyToSequence(List<List<Writable>> sequence)
Description copied from interface:WindowFunction
Apply the windowing function to the given sequence- Specified by:
applyToSequence
in interfaceWindowFunction
- Parameters:
sequence
- the input sequence- Returns:
- the sequence with the window function applied
-
-