"""
Base class for standardized pipeline methods
"""
[docs]__author__ = "Elisha Yadgaran"
from typing import Any, Dict, List, Optional, Tuple
[docs]class ExternalPipelineMixin(object):
"""
Mixin to add unimplemented stubs for standardized api
"""
[docs] def fit(self, X: Any, y: Optional[Any] = None, **kwargs):
"""
Iterate through each transformation step and apply fit
"""
raise NotImplementedError
[docs] def reset(self) -> None:
"""
Command to reset any saved state in the transformers. Expects each
transformer to implement if there is any partial state (e.g. partial_fit
called)
"""
raise NotImplementedError
[docs] def partial_fit(self, X: Any, y: Optional[Any] = None, **kwargs):
"""
Iterate through each transformation step and apply partial fit
"""
raise NotImplementedError
[docs] def get_params(
self, params_only: Optional[bool] = None, **kwargs
) -> Dict[str, Any]:
"""
Iterate through transformers and return parameters
:param params_only: Unused parameter to align signature with Sklearn version
"""
raise NotImplementedError
[docs] def set_params(self, **params) -> None:
"""
Set params for transformers. Input is expected to be dict of dict
:param params: dictionary of dictionaries. each dictionary must map to
a transformer step
"""
raise NotImplementedError
[docs] def get_feature_names(self, feature_names: List[str]) -> List[str]:
"""
Iterate through each transformer and return list of resulting features
starts with empty list by default but can pass in dataset as starting
point to guide transformations
:param feature_names: list of initial feature names before transformations
:type: list
"""
raise NotImplementedError