Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[patch:lib] Allow array-like of transforms instead of list #113

Merged
merged 16 commits into from
Dec 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lib/sequentia/preprocessing/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class Preprocess:

Parameters
----------
steps : list of Transform
A list of preprocessing transformations.
steps : array-like of Transform
An ordered collection of preprocessing transformations.

Examples
--------
Expand All @@ -33,9 +33,10 @@ class Preprocess:
"""

def __init__(self, steps):
if not (isinstance(steps, list) and all(isinstance(step, Transform) for step in steps)):
raise TypeError("Expected steps to be list of Transform objects")
self._val = _Validator()
steps = list(self._val.iterable(steps, 'transformation steps'))
if not all(isinstance(transform, Transform) for transform in steps):
raise TypeError('Expected all transformation steps to be Transform objects')
self.steps = steps

def transform(self, X, verbose=False):
Expand Down