Main Loops
backtest_score
backtest_score(trained_pipelines: TrainedPipelineCard, X: pd.DataFrame | None, y: pd.Series, splitter: Splitter, backend: BackendType | Backend | str = BackendType.no, events: EventDataFrame | None = None, silent: bool = False, return_artifacts: bool = False, krisi_args: dict | None = None) -> tuple[ScoreCard, OutOfSamplePredictions] | tuple[ScoreCard, OutOfSamplePredictions, Artifact]
Run backtest then scoring.
krisi
is required to be installed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trained_pipelines |
TrainedPipelineCard
|
The fitted pipelines, for all folds. |
required |
X |
DataFrame | None
|
Exogenous Data. |
required |
y |
Series
|
Endogenous Data (Target). |
required |
splitter |
Splitter
|
Defines how the folds should be constructed. |
required |
backend |
BackendType | Backend | str
|
The library/service to use for parallelization / distributed computing, by default |
no
|
events |
EventDataFrame | None
|
Events that should be passed into the pipeline, by default None. |
None
|
silent |
bool
|
Wether the pipeline should print to the console, by default False. |
False
|
return_artifacts |
bool
|
Whether to return the artifacts of the training process, by default False. |
False
|
krisi_args |
dict | None
|
Arguments that will be passed into |
None
|
Returns:
Type | Description |
---|---|
'ScoreCard'
|
A ScoreCard from |
OutOfSamplePredictions
|
Predictions for all folds, concatenated. |
train_backtest
train_backtest(pipeline: Pipeline | PipelineCard, X: pd.DataFrame | None, y: pd.Series, splitter: Splitter, backend: BackendType | Backend | str = BackendType.no, events: EventDataFrame | None = None, silent: bool = False) -> tuple[OutOfSamplePredictions, TrainedPipelineCard, Artifact, InSamplePredictions]
Run train and backtest.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pipeline |
Pipeline | PipelineCard
|
The pipeline to be fitted. |
required |
X |
DataFrame | None
|
Exogenous Data. |
required |
y |
Series
|
Endogenous Data (Target). |
required |
splitter |
Splitter
|
Defines how the folds should be constructed. |
required |
backend |
BackendType | Backend | str
|
The library/service to use for parallelization / distributed computing, by default |
no
|
events |
EventDataFrame | None
|
Events that should be passed into the pipeline, by default None. |
None
|
silent |
bool
|
Wether the pipeline should print to the console, by default False. |
False
|
return_artifacts |
Whether to return the artifacts of the process, by default False. |
required | |
return_insample |
|
required |
Returns:
Type | Description |
---|---|
OutOfSamplePredictions
|
Predictions for all folds, concatenated. |
TrainedPipelineCard
|
The fitted pipelines, for all folds. |
train_evaluate
train_evaluate(pipeline: Pipeline | PipelineCard, X: pd.DataFrame | None, y: pd.Series, splitter: Splitter, backend: BackendType | Backend | str = BackendType.no, events: EventDataFrame | None = None, silent: bool = False, krisi_args: dict | None = None) -> tuple[ScoreCard, OutOfSamplePredictions, TrainedPipelineCard, Artifact, ScoreCard]
Run train, backtest then run scoring.
krisi
needs to be installed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pipeline |
Pipeline | PipelineCard
|
The pipeline to be fitted. |
required |
X |
DataFrame | None
|
Exogenous Data. |
required |
y |
Series
|
Endogenous Data (Target). |
required |
splitter |
Splitter
|
Defines how the folds should be constructed. |
required |
backend |
BackendType | Backend | str
|
The library/service to use for parallelization / distributed computing, by default |
no
|
events |
EventDataFrame | None
|
Events that should be passed into the pipeline, by default None. |
None
|
silent |
bool
|
Wether the pipeline should print to the console, by default False. |
False
|
krisi_args |
dict | None
|
Arguments that will be passed into |
None
|
Returns:
Type | Description |
---|---|
'ScoreCard'
|
A ScoreCard from |
OutOfSamplePredictions
|
Predictions for all folds, concatenated. |
TrainedPipelineCard
|
The fitted pipelines, for all folds. |
train
train(pipelinecard: PipelineCard | Pipeline, X: pd.DataFrame | None, y: pd.Series, splitter: Splitter, events: EventDataFrame | None = None, backend: BackendType | Backend | str = BackendType.no, silent: bool = False, for_deployment: bool = False) -> tuple[TrainedPipelineCard, Artifact, InSamplePredictions]
Trains a pipeline on a given dataset, for all folds returned by the Splitter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pipeline |
The pipeline to be fitted. |
required | |
X |
DataFrame | None
|
Exogenous Data. |
required |
y |
Series
|
Endogenous Data (Target). |
required |
splitter |
Splitter
|
Defines how the folds should be constructed. |
required |
backend |
BackendType | Backend | str
|
The library/service to use for parallelization / distributed computing, by default |
no
|
events |
EventDataFrame | None
|
Events that should be passed into the pipeline, by default None. |
None
|
silent |
bool
|
Wether the pipeline should print to the console, by default False. |
False
|
return_artifacts |
Whether to return the artifacts of the training process, by default False. |
required | |
return_insample |
Whether to return the in-sample predictions of the training process, by default False. |
required | |
for_deployment |
bool
|
Whether the pipeline is being trained for deployment, meaning it'll only have the last fold, by default False. |
False
|
Returns:
Type | Description |
---|---|
TrainedPipelineCard
|
The fitted pipelines, for all folds. |
backtest
backtest(trained_pipelinecard: TrainedPipelineCard, X: pd.DataFrame | None, y: pd.Series, splitter: Splitter, backend: BackendType | Backend | str = BackendType.no, events: EventDataFrame | None = None, silent: bool = False, mutate: bool = False, return_artifacts: bool = False) -> OutOfSamplePredictions | tuple[OutOfSamplePredictions, Artifact]
Run backtest on TrainedPipelineCard and given data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trained_pipelines |
The fitted pipelines, for all folds. |
required | |
X |
DataFrame | None
|
Exogenous Data. |
required |
y |
Series
|
Endogenous Data (Target). |
required |
splitter |
Splitter
|
Defines how the folds should be constructed. |
required |
backend |
BackendType | Backend | str
|
The library/service to use for parallelization / distributed computing, by default |
no
|
sample_weights |
Weights assigned to each sample/timestamp, that are passed into models that support it, by default None. |
required | |
events |
EventDataFrame | None
|
Events that should be passed into the pipeline, by default None. |
None
|
silent |
bool
|
Wether the pipeline should print to the console, by default False. |
False
|
mutate |
bool
|
Whether |
False
|
return_artifacts |
bool
|
Whether to return the artifacts of the backtesting process, by default False. |
False
|
Returns:
Type | Description |
---|---|
OutOfSamplePredictions
|
Predictions for all folds, concatenated. |
BackendType
Bases: ParsableEnum
Parameters:
Name | Type | Description | Default |
---|---|---|---|
no |
Uses sequential processing. This is the default. |
required | |
ray |
Uses |
required | |
pathos |
Uses |
required | |
thread |
Uses |
required |
classes
InSamplePredictions
module-attribute
The backtest's resulting in-sample output.
OutOfSamplePredictions
module-attribute
The backtest's resulting out-of-sample output.
Pipeline
module-attribute
A list of fold
objects that are executed sequentially. Or a single object.
TrainedPipelines
module-attribute
A list of trained Pipeline
s, to be used for backtesting.
Composite
Bases: Block
, Clonable
, ABC
A Composite contains other transformations.
Optimizer
Transformation
Tunable
Bases: ABC
clone_with_params
The default implementation only works for Transformations, when parameters and the init parameters match 100%.
get_params
The default implementation assumes that: 1. All init parameters are stored on the object as property (with the same name/key). 2. There are no modifications/conversions of the init parameters that'd prevent them from being used again (reconstructing the object from them).