BlueprintConverter#
- class datarobotx.BlueprintConverter#
Inherited attributes:
CATEGORICAL_COLUMN_TEMPLATE
DEFAULT_IMPORTS
STANDARD_INPUT_TEMPLATE
Methods:
build_blueprint_imports
(stages)build_preprocessor_pipeline
(stages, ...)Build a preprocessor pipeline from blueprint stages.
construct_stage_input_paths
(stages, ...)convert
(blueprint_json)Convert a blueprint to an open source representation block of code.
convert_blueprint_class_to_open_representation
(...)Extract the input parameters and values from the blueprint class representation.
extract_element_from_stage
(stage)extract_estimator_inputs
(blueprint_json)extract_stages
(blueprint_json)parse_blueprint_stage
(blueprint_stage)Convert a stage of a blueprint to an open representation mapping.
Inherited methods:
__init__
()format_code_block_with_black
(code_block)- rtype:
make_blueprint
(blueprint_imports, ...)Construct and format code to create a code representation of a blueprint.
Construct a column tranformer element from a pre-formatted transformer pipeline.
make_column_transformer_from_column_transformer_elements
(...)Return a Column Transformer representation from a pre-formatted transformer pipeline The transformer should be ultimately constructed from: make_column_transformer_element_from_pipeline_elements If starting from steps, see make_pipeline_elements_from_steps.
make_pipeline_elements_from_steps
(pipeline_steps)Build a string of pipeline elements from raw pipeline steps.
Return a Pipeline representation from a pre-formatted transformer pipeline element Elements should be created from steps with make_pipeline_elements_from_steps.
Construct a standard template for the top of the code.
- classmethod build_preprocessor_pipeline(stages, stage_input_paths)#
Build a preprocessor pipeline from blueprint stages.
- classmethod convert(blueprint_json)#
Convert a blueprint to an open source representation block of code.
- static extract_dr_class_params_from_blueprint_parts(blueprint_parts)#
Extract the input parameters and values from the blueprint class representation.
- classmethod make_blueprint(blueprint_imports, preprocessor_pipeline, estimator_element)#
Construct and format code to create a code representation of a blueprint.
- Parameters:
blueprint_imports (list[str]) – List of imports that should be added to the header
preprocessor_pipeline (list[str]) – Column Transformer code string. See make_column_transformer_from_pipeline
estimator_element (Tuple[str, str]) – A tuples represented as (estimator_name, estimator_action). The step_action can either be a class call (e.g. sklearn.impute.SimpleImputer()) or “passthrough”. The step_action is typically generated by the MappingObject.get_open_representation() function.
- Return type:
- classmethod make_column_transformer_element_from_pipeline(transformer_name, transformer_pipeline, transformer_columns=None)#
Construct a column tranformer element from a pre-formatted transformer pipeline.
Pipeline should be created from steps with: make_pipeline_elements_from_steps and make_pipeline_from_pipeline_elements
- Return type:
- static make_column_transformer_from_column_transformer_elements(column_transformer_elements)#
Return a Column Transformer representation from a pre-formatted transformer pipeline The transformer should be ultimately constructed from: make_column_transformer_element_from_pipeline_elements If starting from steps, see make_pipeline_elements_from_steps.
- Return type:
- static make_pipeline_elements_from_steps(pipeline_steps, reverse=False, index=None)#
Build a string of pipeline elements from raw pipeline steps.
- Parameters:
pipeline_steps (List[Tuple[str, str]]) – A list of tuples, where each tuple is (step_name, step_action). The step_action can either be a class call (e.g. sklearn.impute.SimpleImputer()) or “passthrough”. The step_action is typically generated by the MappingObject.get_open_representation() function.
reverse (bool) – Reverse the list. If steps are added from last to first, this should be set to True so that the final pipeline is in the correct direction.
- Return type:
- static make_pipeline_from_pipeline_elements(pipeline_element_str)#
Return a Pipeline representation from a pre-formatted transformer pipeline element Elements should be created from steps with make_pipeline_elements_from_steps.
- Return type:
- classmethod make_standard_template()#
Construct a standard template for the top of the code.
- Return type:
- classmethod parse_blueprint_stage(blueprint_stage)#
Convert a stage of a blueprint to an open representation mapping.
- Return type:
StageDict