Nyoka's Pre-Processing Module

class Lag(aggregation, value=1, copy=True)[source]

Bases: sklearn.base.TransformerMixin

The Lag class takes value number of previous record of the fields where it is applied and applies aggregation to those values.

  • aggregation (String) – aggregation type. The valid types are [“min”, “max”, “sum”, “avg”, “median”, “product”, “stddev”]
  • value (Integer (default = 1)) – The number of previous record to aggregate
def fit(X, y=None)[source]

Does nothing.

Return type:The same object
def transform(X, y=None)[source]

Trasforms the given X by taking value number of previous records and applying aggregation method

  • X (Pandas DataFrame or numpy array) – The input data
  • y – It is ignored.

Return type:

Transformed X as numpy array