hadar.workflow.pipeline.
RestrictedPlug
Bases: hadar.workflow.pipeline.Plug
hadar.workflow.pipeline.Plug
Implementation where stage expect presence of precise columns.
linkable_to
Defined if next stage is linkable with current. In this implementation, plug is linkable only if input of next stage are present in output of current stage.
next – other stage to link
True if current output contain mandatory columns for next input else False
FreePlug
Plug implementation when stage can use any kind of DataFrame, whatever columns present inside.
Defined if next stage is linkable with current. In this implementation, plug is always linkable
other – other stage to link
True whatever
Stage
Bases: abc.ABC
abc.ABC
Abstract method which represent an unit of compute. It can be addition with other to create workflow pipeline.
build_multi_index
Create column multi index.
scenarios – list of scenarios serial
names – names of data type preset inside each scenario
multi-index like [(scn, type), …]
get_names
get_scenarios
standardize_column
Timeline must have first column for scenario and second for data timeline. Add the Oth scenario index if not present.
timeline – timeline with or without scenario index
timeline with scenario index
FocusStage
Bases: hadar.workflow.pipeline.Stage, abc.ABC
hadar.workflow.pipeline.Stage
Stage focuses on same behaviour for any scenarios.
Drop
Bases: hadar.workflow.pipeline.Stage
Drop columns by name.
Rename
Rename column names.
Fault
Bases: hadar.workflow.pipeline.FocusStage
hadar.workflow.pipeline.FocusStage
Generate a random fault for each scenarios.
RepeatScenario
Repeat n-time current scenarios.
ToShuffler
Bases: hadar.workflow.pipeline.Rename
hadar.workflow.pipeline.Rename
To Connect pipeline to shuffler
Pipeline
Bases: object
object
Compute many stages sequentially.
assert_computable
Verify timeline is computable by pipeline.
timeline – timeline to check
True if computable False else
assert_to_shuffler
Clip
Cut data according to upper and lower boundaries. Same as np.clip function.
hadar.workflow.shuffler.
Shuffler
Receive all data sources like raw matrix or pipeline. Schedule pipeline generation and shuffle all timeline to create scenarios.
add_data
Add raw data by numpy array. If you generate data by pipeline use add_pipeline. It will parallelize computation and manage swap. :param name: timeline name :param data: numpy array with shape as (scenario, horizon) :return: self
add_pipeline
Add data by pipeline and input data for pipeline.
name – timeline name
data – data to use as pipeline input
pipeline – pipeline to generate data
self
shuffle
Start pipeline generation and shuffle result to create scenario sampling.
nb_scn – number of scenarios to sample
Timeline
Manage data used to generate timeline. Perform sampling too.
compute
Compute method called before sampling. For Timeline method just return data.
return data given in constructor
sample
Perform sampling. Compute data is needed before.
nb – number of sampling
scenario matrix shape like (nb, horizon)