Skip to content

Commit

Permalink
fix: Fixed transformations
Browse files Browse the repository at this point in the history
  • Loading branch information
da-the-dev committed Jul 24, 2024
1 parent 043aa82 commit d39c2c7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions src/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,18 +159,25 @@ def preprocess_data(
(f"hhmm_{feature}", dtf.hhmm_transformer(feature)) for feature in cfg.hhmm
]

# Assembling the pipeline
pipeline = Pipeline(
[
feature_extractor,
*cyclic_transformers,
*hhmm_transformers,
]
)

X = pipeline.transform(X)

# Transformers for hashing
hash_transformers = [
(f"hash_{feature}", dtf.hash_transformer(feature))
for feature in df.columns[df.dtypes == "object"]
for feature in X.columns[X.dtypes == "object"]
]

# Assembling the pipeline
pipeline = Pipeline(
[
feature_extractor,
*cyclic_transformers,
*hhmm_transformers,
*hash_transformers,
]
)
Expand Down
2 changes: 1 addition & 1 deletion src/data_transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self, features: list[str]):
def transform(self, X):
columns_to_drop = set(X) - set(self.features)

X_transformed = X[list[columns_to_drop]]
X_transformed = X.drop(columns_to_drop, axis=1)

return X_transformed

Expand Down

0 comments on commit d39c2c7

Please sign in to comment.