-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added transformer file with some methods (#151)
Co-authored-by: Yimeng Xie <[email protected]> Co-authored-by: Christopher <[email protected]>
- Loading branch information
1 parent
f73b5ce
commit 1088e3a
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
31 changes: 31 additions & 0 deletions
31
...ification/meal_identification/meal_identification/transformations/data_transformations.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from sktime.transformations.series.exponent import ExponentTransformer | ||
from sktime.transformations.compose import Id | ||
from sktime.transformations.compose import TransformerPipeline | ||
from sklearn.preprocessing import StandardScaler | ||
import pandas as pd | ||
|
||
def run_pipeline(pipeline, data): | ||
''' | ||
run a transformer pipeline given certain data | ||
questions: does the training script provide the pipeline, or should we build this in transformation | ||
do we want to work with only Series->Series or also Panel->Panel | ||
todo: add flag to cache transformed data | ||
add flag to run as list of Series or as Panel | ||
log transformations applied | ||
testing | ||
''' | ||
transformed_data = [] | ||
for df in data: | ||
transformed = pipeline.fit_transform(df) | ||
transformed_data.append(transformed) | ||
return transformed_data | ||
|
||
def create_pipeline(transformers): | ||
''' | ||
creates a pipeline from a list of transformers (apply all in series)? | ||
questions: how should FeatureUnions be handled? | ||
''' | ||
pipeline = TransformerPipeline(steps=transformers) | ||
return pipeline | ||
|
||
|