Пример #1
0
def get_ensemble_models(model, derived_col_names, col_names, target_name,
                        mining_imp_val, categoric_values):
    """
    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
    -------
    mining_models :
        Returns the MiningModel of the respective LGB model
    """
    model_kwargs = sklToPmml.get_model_kwargs(model, col_names, target_name,
                                              mining_imp_val)
    mining_models = list()
    mining_models.append(
        pml.MiningModel(modelName="LightGBModel",
                        Segmentation=get_outer_segmentation(
                            model, derived_col_names, col_names, target_name,
                            mining_imp_val, categoric_values),
                        **model_kwargs))
    return mining_models
Пример #2
0
def get_ensemble_models(model, derived_col_names, col_names, target_name, mining_imp_val,categoric_values,tasktype,modelPath):
    """
    It returns the Mining Model element of the model

    Parameters
    ----------
    model :
        Contains Xgboost 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
    -------
    mining_models :
        Returns the MiningModel of the respective Xgboost model
    """
    model_kwargs = skl_to_pmml.get_model_kwargs(model, col_names, target_name, mining_imp_val, categoric_values)
    if 'XGBRegressor' in str(model.__class__):
        model_kwargs['Targets'] = skl_to_pmml.get_targets(model, target_name)
    mining_models = list()
    mining_models.append(pml.MiningModel(
        modelName="XGBoostModel",
        Segmentation=get_outer_segmentation(model, col_names, col_names, target_name, mining_imp_val,categoric_values,tasktype,modelPath),
        **model_kwargs
    ))
    return mining_models