Class SequenceMovingWindowReduceTransform
- java.lang.Object
-
- org.datavec.api.transform.transform.sequence.SequenceMovingWindowReduceTransform
-
public class SequenceMovingWindowReduceTransform extends Object implements Transform
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SequenceMovingWindowReduceTransform.EdgeCaseHandling
Enumeration to specify how each cases are handled: For example, for a look back period of 20, how should the first 19 output values be calculated?
Default: Perform your former reduction as normal, with as many values are available
SpecifiedValue: use the given/specified value instead of the actual output value.
-
Constructor Summary
Constructors Constructor Description SequenceMovingWindowReduceTransform(String columnName, int lookback, ReduceOp op)
SequenceMovingWindowReduceTransform(String columnName, String newColumnName, int lookback, ReduceOp op, SequenceMovingWindowReduceTransform.EdgeCaseHandling edgeCaseHandling, Writable edgeCaseValue)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
columnName()
Returns a singular column name this op is meant to run onString[]
columnNames()
Returns column names this op is meant to run onstatic String
defaultOutputColumnName(String originalName, int lookback, ReduceOp op)
Schema
getInputSchema()
Getter for input schemaObject
map(Object input)
Transform an object in to another objectList<Writable>
map(List<Writable> writables)
Transform a writable in to another writableObject
mapSequence(Object sequence)
Transform a sequenceList<List<Writable>>
mapSequence(List<List<Writable>> sequence)
Transform a sequenceString
outputColumnName()
The output column name after the operation has been appliedString[]
outputColumnNames()
The output column names This will often be the same as the inputvoid
setInputSchema(Schema inputSchema)
Set the input schema.String
toString()
Schema
transform(Schema inputSchema)
-
-
-
Constructor Detail
-
SequenceMovingWindowReduceTransform
public SequenceMovingWindowReduceTransform(String columnName, int lookback, ReduceOp op)
- Parameters:
columnName
- Column name to perform windowing onlookback
- Look back period for windowingop
- Reduction operation to perform on each window
-
SequenceMovingWindowReduceTransform
public SequenceMovingWindowReduceTransform(String columnName, String newColumnName, int lookback, ReduceOp op, SequenceMovingWindowReduceTransform.EdgeCaseHandling edgeCaseHandling, Writable edgeCaseValue)
- Parameters:
columnName
- Column name to perform windowing onnewColumnName
- Name of the new output column (with results)lookback
- Look back period for windowingop
- Reduction operation to perform on each windowedgeCaseHandling
- How the 1st steps should be handled (positions in sequence with indices less then the look-back period)edgeCaseValue
- Used only with EdgeCaseHandling.SpecifiedValue, maybe null otherwise
-
-
Method Detail
-
defaultOutputColumnName
public static String defaultOutputColumnName(String originalName, int lookback, ReduceOp op)
-
setInputSchema
public void setInputSchema(Schema inputSchema)
Description copied from interface:ColumnOp
Set the input schema.- Specified by:
setInputSchema
in interfaceColumnOp
-
getInputSchema
public Schema getInputSchema()
Description copied from interface:ColumnOp
Getter for input schema- Specified by:
getInputSchema
in interfaceColumnOp
- Returns:
-
map
public List<Writable> map(List<Writable> writables)
Description copied from interface:Transform
Transform a writable in to another writable
-
mapSequence
public List<List<Writable>> mapSequence(List<List<Writable>> sequence)
Description copied from interface:Transform
Transform a sequence- Specified by:
mapSequence
in interfaceTransform
-
mapSequence
public Object mapSequence(Object sequence)
Transform a sequence- Specified by:
mapSequence
in interfaceTransform
- Parameters:
sequence
-
-
outputColumnName
public String outputColumnName()
The output column name after the operation has been applied- Specified by:
outputColumnName
in interfaceColumnOp
- Returns:
- the output column name
-
outputColumnNames
public String[] outputColumnNames()
The output column names This will often be the same as the input- Specified by:
outputColumnNames
in interfaceColumnOp
- Returns:
- the output column names
-
columnNames
public String[] columnNames()
Returns column names this op is meant to run on- Specified by:
columnNames
in interfaceColumnOp
- Returns:
-
columnName
public String columnName()
Returns a singular column name this op is meant to run on- Specified by:
columnName
in interfaceColumnOp
- Returns:
-
-