ltbio.pipeline.PipelineUnit#
Overview#
Classes#
An ApplySeparately is a collection of single units, to which each will be applied to one Timeseries at a time. |
|
An ApplyTogether is a collection of single units, to which each will be applied to all Timeseries at once. |
|
Pipeline Units are the building blocks of Pipelines. |
|
A Union is a collection of single units where the Pipeline branches to each of them. |
|
A Single Pipeline Unit is any agent that can act (use, process or make changes) to a collection (usually of Timeseries). |
Contents#
- class ltbio.pipeline.PipelineUnit.ApplySeparately(units: SinglePipelineUnit | Collection[SinglePipelineUnit], name: str = None)#
Bases:
digraph inheritancee684a37d9c { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; "ApplySeparately" [URL="#ltbio.pipeline.PipelineUnit.ApplySeparately",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An ApplySeparately is a collection of single units, to which each will be applied to one Timeseries at a time."]; "PipelineUnitsUnion" -> "ApplySeparately" [arrowsize=0.5,style="setlinewidth(0.5)"]; "PipelineUnit" [URL="#ltbio.pipeline.PipelineUnit.PipelineUnit",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Pipeline Units are the building blocks of Pipelines."]; "ABC" -> "PipelineUnit" [arrowsize=0.5,style="setlinewidth(0.5)"]; "PipelineUnitsUnion" [URL="#ltbio.pipeline.PipelineUnit.PipelineUnitsUnion",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A Union is a collection of single units where the Pipeline branches to each of them."]; "PipelineUnit" -> "PipelineUnitsUnion" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ABC" -> "PipelineUnitsUnion" [arrowsize=0.5,style="setlinewidth(0.5)"]; }PipelineUnitsUnionAn ApplySeparately is a collection of single units, to which each will be applied to one Timeseries at a time. Following the Template Method design pattern, this is a concrete class, where ‘__delegate’ is implemented.
- class ltbio.pipeline.PipelineUnit.ApplyTogether(units: SinglePipelineUnit | Collection[SinglePipelineUnit], name: str = None)#
Bases:
digraph inheritance4323be314b { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; "ApplyTogether" [URL="#ltbio.pipeline.PipelineUnit.ApplyTogether",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An ApplyTogether is a collection of single units, to which each will be applied to all Timeseries at once."]; "PipelineUnitsUnion" -> "ApplyTogether" [arrowsize=0.5,style="setlinewidth(0.5)"]; "PipelineUnit" [URL="#ltbio.pipeline.PipelineUnit.PipelineUnit",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Pipeline Units are the building blocks of Pipelines."]; "ABC" -> "PipelineUnit" [arrowsize=0.5,style="setlinewidth(0.5)"]; "PipelineUnitsUnion" [URL="#ltbio.pipeline.PipelineUnit.PipelineUnitsUnion",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A Union is a collection of single units where the Pipeline branches to each of them."]; "PipelineUnit" -> "PipelineUnitsUnion" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ABC" -> "PipelineUnitsUnion" [arrowsize=0.5,style="setlinewidth(0.5)"]; }PipelineUnitsUnionAn ApplyTogether is a collection of single units, to which each will be applied to all Timeseries at once. Following the Template Method design pattern, this is a concrete class, where ‘__delegate’ is implemented.
- class ltbio.pipeline.PipelineUnit.PipelineUnit(name: str)#
Bases:
digraph inheritance2d8b453a99 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; "PipelineUnit" [URL="#ltbio.pipeline.PipelineUnit.PipelineUnit",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Pipeline Units are the building blocks of Pipelines."]; "ABC" -> "PipelineUnit" [arrowsize=0.5,style="setlinewidth(0.5)"]; }abc.ABCPipeline Units are the building blocks of Pipelines. Following the Composite design pattern, a PipelineUnit is the abstract ‘Component’, so that Pipeline can deal with SingleUnit and Union in the same way.
SingleUnit: A single pipeline unit, that actually acts on Timeseries. It’s the ‘Leaf’ in the design pattern.
Union: A collection of single units where the Pipeline branches to each of them. It’s the ‘Composite’ in the
design pattern.
Acts as the ‘operation’ method in the design pattern, and it’s implemented in each subclass. It receives a Packet with the necessary inputs to apply the unit and returns a Packet with the relevant outputs.
- class ltbio.pipeline.PipelineUnit.PipelineUnitsUnion(units: SinglePipelineUnit | Collection[SinglePipelineUnit], name: str = None)#
Bases:
digraph inheritance1a6e49cb8c { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; "PipelineUnit" [URL="#ltbio.pipeline.PipelineUnit.PipelineUnit",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Pipeline Units are the building blocks of Pipelines."]; "ABC" -> "PipelineUnit" [arrowsize=0.5,style="setlinewidth(0.5)"]; "PipelineUnitsUnion" [URL="#ltbio.pipeline.PipelineUnit.PipelineUnitsUnion",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A Union is a collection of single units where the Pipeline branches to each of them."]; "PipelineUnit" -> "PipelineUnitsUnion" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ABC" -> "PipelineUnitsUnion" [arrowsize=0.5,style="setlinewidth(0.5)"]; }PipelineUnit,abc.ABCA Union is a collection of single units where the Pipeline branches to each of them. Following the Template Method design pattern, a Union is the abstract class, where ‘_apply’ is the ‘template’ method.
ApplyTogether: Runs all Timeseries together in a unique structure over each SingleUnit.
ApplySeparately: Runs each Timeseries separately over each SingleUnit.
1. Unpacks, 2. Delegates and 3. Packs. Unpacking and packing is similar and independent of how application is delegated. So, Step 2, ‘__delegate’ should be defined in each subclass.
This method should handle how each SingleUnit is applied to the Timeseries (when there are many) – if together or separately.
PIPELINE_INPUT_LABELS Maps every label of a needed input inside a Packet to the parameter names of the corresponding ‘apply’ methods. PIPELINE_OUTPUT_LABELS Maps every output name of the ‘apply’ methods to a label to be saved inside a Packet.
- property all_input_parameters: Tuple[inspect.Parameter]#
- property current_unit#
- PIPELINE_INPUT_LABELS: Dict[str, str]#
- PIPELINE_OUTPUT_LABELS: Dict[str, str]#
- class ltbio.pipeline.PipelineUnit.SinglePipelineUnit(name: str = None)#
Bases:
digraph inheritance1eb5524f90 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; "PipelineUnit" [URL="#ltbio.pipeline.PipelineUnit.PipelineUnit",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Pipeline Units are the building blocks of Pipelines."]; "ABC" -> "PipelineUnit" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SinglePipelineUnit" [URL="#ltbio.pipeline.PipelineUnit.SinglePipelineUnit",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A Single Pipeline Unit is any agent that can act (use, process or make changes) to a collection (usually of Timeseries)."]; "PipelineUnit" -> "SinglePipelineUnit" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ABC" -> "SinglePipelineUnit" [arrowsize=0.5,style="setlinewidth(0.5)"]; }PipelineUnit,abc.ABCA Single Pipeline Unit is any agent that can act (use, process or make changes) to a collection (usually of Timeseries). Following the Command design pattern, a SingleUnit is the abstract ‘Command’, so that Pipeline can execute various kinds of processing by calling the ‘apply’ method of each concrete unit.
E.g. Filter, Segmenter, FeatureExtractor, FeatureSelector, SupervisingTrainer, DecisionMaker Any subclass that implements ‘apply’.
Every subclass must define ‘apply’ and implement a concrete behaviour. To map the parameters’ names of ‘apply’ to the labels inside any arriving Packet, PIPELINE_INPUT_LABELS should be defined. To map the outputs to the labels of the resulting Packet, PIPELINE_OUTPUT_LABELS should be defined.
PIPELINE_INPUT_LABELS Maps every label of a needed input inside a Packet to the name of the corresponding ‘apply’ parameter. PIPELINE_OUTPUT_LABELS Maps every output name of ‘apply’ to a label to be saved inside a Packet.
- ART_PATH = 'resources/pipeline_media/nd.png'#
- PIPELINE_INPUT_LABELS: Dict[str, str]#
- PIPELINE_OUTPUT_LABELS: Dict[str, str]#
- abstract apply(**kwargs)#