src.pipeline.predictive_pipeline
Classes
|
- class src.pipeline.predictive_pipeline.PredictivePipeline(pipeline, pps, **kwargs)
- Author:
Alberto M. Esmoris Pena
A predictive pipeline is any pipeline that can be used as an estimator.
In other words, the predictive pipeline can be seen as a map \(f\) from a given input \(x\) that yields the corresponding estimations, aiming to approximate as much as possible the actual values \(y\).
More formally:
\[f(x) \approx y\]However, the predictive pipeline itself is not limited to the predictive model \(\hat{y}\). It also accounts for other components such as the data mining, imputation, and feature transformation.
For instance, let \(m_1\) represent a data miner, \(m_2\) another data miner, and \(i\) represent a data imputer. For this case, the composition of these components with the estimator \(\hat{y}\) would lead to a sequential predictive pipeline that can be described as follows:
\[f(x) = (\hat{y} \circ i \circ m_2 \circ m_1)(x)\]Note that predictive pipelines can also be composed without \(\hat{y}\) for the sake of convenience. This can be explained because, sometimes, the desired answer is given by a data miner instead of a machine learning model. Alternatively, sometimes it is convenient to store a pre-processing as a pipeline so it can be used in other pipelines. For the sake of simplicity, the predictive pipeline can conver these cases too (so there is no need to implement further classes).
- Variables:
pipeline (.Pipeline) – The wrapped pipeline. It must be possible to use it to compute predictions. For example, a pipeline made of data mining components only will fail.
pps (.PipelinePredictiveStrategy) – The pipeline’s predictive strategy. It must be compatible with the wrapped pipeline. The strategy defines how to use the pipeline to make predictions.
- __init__(pipeline, pps, **kwargs)
Handles the root-level (most basic) initialization of any pipeline.
- Parameters:
kwargs – The attributes for the Pipeline.
- run()
Predictive pipelines are not run, instead the
src.pipeline.predictive_pipeline.PredictivePipeline.predict()method is often used.
- build_pipeline_input(**kwargs)
See
npu.pipeline.pipeline.Pipeline,npu.pipeline.pipeline.Pipeline.build_pipeline_input(),src.pipeline.pipeline_input.PipelineInput().
- build_pipeline_output(**kwargs)
See
npu.pipeline.pipeline.Pipeline,npu.pipeline.pipeline.Pipeline.build_pipeline_output(), andsrc.pipeline.pipeline_output.PipelineOutput().
- predict(pcloud, out_prefix=None)
The predict method computes the predictions from the wrapped pipeline.
- Parameters:
pcloud (
src.pcloud.point_cloud.PointCloud) – The point cloud to be predicted.out_prefix – Optional argument to update the output path of the predictive pipeline strategy that is used as the output prefix for its components.
- Returns:
The predictions.
- Return type:
np.ndarray
- get_first_model()
Obtain the first model that appears in the predictive pipeline components.
- Returns:
The first found model in the predictive pipeline. None if no model was found.
- Return type:
ModelOpor None
- is_using_deep_learning()
See
src.pipeline.pipeline.Pipeline.is_using_deep_learning().
- write_deep_learning_model(path)
See
src.pipeline.pipeline.Pipeline.write_deep_learning_model().