mopipe.core.analysis.pipeline
pipeline.py
This module contains the Pipeline class, which is used to run a series of analysis steps (segments) on the data.
Pipeline Objects
class Pipeline(t.MutableSequence[Segment])
Pipeline
A pipeline is a series of segments that are run on the data.
__init__
def __init__(segments: t.Optional[t.MutableSequence[Segment]] = None,
cache_dir: t.Optional[t.Union[str, Path]] = None) -> None
Initialize a Pipeline.
Parameters
segments : MutableSequence[Segment], optional The segments to include in the pipeline. cache_dir : str or Path, optional Directory for caching segment results using joblib.Memory. If None, caching is disabled.
segments
@property
def segments() -> t.MutableSequence[Segment]
The segments in the pipeline.
cache_dir
@property
def cache_dir() -> t.Optional[t.Union[str, Path]]
The cache directory.
segment
def segment(index: int) -> Segment
Get a segment from the pipeline.
add_segment
def add_segment(segment: Segment) -> int
Add a segment to the pipeline.
clear_cache
def clear_cache() -> None
Clear the pipeline cache.
run
def run(*, cache: bool = True, **kwargs) -> t.Any
Run the pipeline.
Parameters
cache : bool, optional Whether to use caching (if cache_dir was set). Defaults to True. **kwargs Arguments passed to the segments. Must include 'x' as the input data.
Returns
Any The output of the last segment in the pipeline.