lgb_to_pmml module

lgb_to_pmml.generate_structure_for_lgb(fetch, main_key_value, derived_col_names)[source]

It returns a List where the nodes of the model are in a structured format.

Parameters:
  • fetch (dictionary) – Contains the nodes in dictionary format.
  • main_key_value (List) – Empty list used to append the nodes.
  • derived_col_names (List) – Contains column names after preprocessing.
Returns:

Returns the nodes in a structured format inside a list.

Return type:

main_key_value

lgb_to_pmml.get_PMML_kwargs(model, derived_col_names, col_names, target_name, mining_imp_val, categoric_values)[source]
It returns all the pmml elements.
Parameters:
  • model – Contains LGB model object.
  • derived_col_names (List) – Contains column names after preprocessing
  • col_names (List) – Contains list of feature/column names.
  • target_name (String) – Name of the target column .
  • mining_imp_val (tuple) – Contains the mining_attributes,mining_strategy, mining_impute_value
  • categoric_values (tuple) – Contains Categorical attribute names and its values
Returns:

algo_kwargs – Get the PMML model argument based on LGB model object

Return type:

{ dictionary element}

lgb_to_pmml.get_ensemble_models(model, derived_col_names, col_names, target_name, mining_imp_val, categoric_values)[source]

It returns the Mining Model element of the model

Parameters:
  • model – Contains LGB model object.
  • derived_col_names (List) – Contains column names after preprocessing.
  • col_names (List) – Contains list of feature/column names.
  • target_name (String) – Name of the Target column.
  • mining_imp_val (tuple) – Contains the mining_attributes,mining_strategy, mining_impute_value.
  • categoric_values (tuple) – Contains Categorical attribute names and its values
Returns:

Returns the MiningModel of the respective LGB model

Return type:

mining_models

lgb_to_pmml.get_multiple_model_method(model)[source]

It returns the name of the Multiple Model Chain element of the model.

Parameters:model – Contains LGB model object
Returns:
  • modelChain for LGB Classifier,
  • sum for LGB Regressor,
lgb_to_pmml.get_outer_segmentation(model, derived_col_names, col_names, target_name, mining_imp_val, categoric_values)[source]

It returns the Segmentation element of the model.

Parameters:
  • model – Contains LGB model object.
  • derived_col_names (List) – Contains column names after preprocessing.
  • col_names (List) – Contains list of feature/column names.
  • target_name (String) – Name of the Target column.
  • mining_imp_val (tuple) – Contains the mining_attributes,mining_strategy, mining_impute_value
  • categoric_values (tuple) – Contains Categorical attribute names and its values
Returns:

Get the outer most Segmentation of an LGB model

Return type:

segmentation

lgb_to_pmml.get_segments(model, derived_col_names, col_names, target_name, mining_imp_val, categoric_values)[source]
It returns the Segment element of the model.
Parameters:
  • model – Contains LGB model object.
  • derived_col_names (List) – Contains column names after preprocessing.
  • col_names (List) – Contains list of feature/column names.
  • target_name (String) – Name of the Target column.
  • mining_imp_val (tuple) –

    Contains the mining_attributes,mining_strategy, mining_impute_value categoric_values : tuple

    Contains Categorical attribute names and its values
Returns:

Get the Segments for the Segmentation element.

Return type:

segment

lgb_to_pmml.get_segments_for_lgbc(model, derived_col_names, feature_names, target_name, mining_imp_val, categoric_values)[source]

It returns all the segments of the LGB classifier.

Parameters:
  • model – Contains LGB model object.
  • derived_col_names (List) – Contains column names after preprocessing.
  • feature_names (List) – Contains list of feature/column names.
  • target_name (String) – Name of the Target column.
  • mining_imp_val (tuple) – Contains the mining_attributes,mining_strategy, mining_impute_value
  • categoric_values (tuple) – Contains Categorical attribute names and its values
Returns:

Returns all the segments of the LGB model.

Return type:

regrs_models

lgb_to_pmml.get_segments_for_lgbr(model, derived_col_names, feature_names, target_name, mining_imp_val, categorical_values)[source]
It returns all the Segments element of the model
Parameters:
  • model – Contains LGB model object.
  • derived_col_names (List) – Contains column names after preprocessing.
  • feature_names (List) – Contains list of feature/column names.
  • target_name (List) – Name of the Target column.
  • mining_imp_val (tuple) –

    Contains the mining_attributes,mining_strategy, mining_impute_value categoric_values : tuple

    Contains Categorical attribute names and its values
Returns:

Get the Segmentation element which contains inner segments.

Return type:

segment

lgb_to_pmml.lgb_to_pmml(pipeline, col_names, target_name, pmml_f_name='from_lgbm.pmml')[source]

Exports LGBM pipeline object into pmml

Parameters:
  • pipeline – Contains an instance of Pipeline with preprocessing and final estimator
  • col_names (List) – Contains list of feature/column names.
  • target_name (String) – Name of the target column.
  • pmml_f_name (String) – Name of the pmml file. (Default=’from_lgbm.pmml’)
Returns:

Return type:

Returns a pmml file