<jupyter_start><jupyter_text>LGBMClassifier → PMML Exporter: LGBMClassifier  Data Set used: Iris, Auto-mpg **STEPS**: - Build the Pipeline with model using LGBMClassifier- Build PMML using Nyoka exporter  LGBMClassifier Model building (using pipeline) for Iris data set<jupyter_code>import pandas as pd
from sklearn import datasets
from sklearn.pipeline import Pipeline
from lightgbm import LGBMRegressor,LGBMClassifier


iris = datasets.load_iris()
irisd = pd.DataFrame(iris.data,columns=iris.feature_names)
irisd['Species'] = iris.target

features = irisd.columns.drop('Species')
target = 'Species'

pipeline_obj = Pipeline([
    ('lgbmc',LGBMClassifier())
])

pipeline_obj.fit(irisd[features],irisd[target])
irisd.to_csv("iris.csv")
import nyoka
nyoka.__version__
import lightgbm
lightgbm.__version__<jupyter_output><empty_output><jupyter_text>Export the Pipeline object into PMML using the Nyoka package<jupyter_code>from nyoka import lgb_to_pmml

lgb_to_pmml(pipeline_obj,features,target,"lgbmc_pmml.pmml")<jupyter_output><empty_output><jupyter_text>LGBMRegressor Model building (using pipeline) for Auto-mpg data set<jupyter_code>auto = pd.read_csv('auto-mpg.csv')
X = auto.drop(['mpg','car name'], axis=1)
y = auto['mpg']

feature_names = [name for name in auto.columns if name not in ('mpg','car name')]
target_name='mpg'

pipeline_obj = Pipeline([
    ('lgbmr',LGBMRegressor())
])

pipeline_obj.fit(auto[feature_names],auto[target_name])<jupyter_output><empty_output><jupyter_text>Export the Pipeline object into PMML using the Nyoka package<jupyter_code>lgb_to_pmml(pipeline_obj,feature_names,target_name,"lgbmr_pmml.pmml")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11124473842453397, 'fraction_numerical': 0.0006013229104028864, 'mean_word_length': 8.244444444444444, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '34702', 'license': 'Apache-2.0', 'n_tokens_mistral': 612, 'n_tokens_neox': 606, 'n_words': 122, 'path': 'examples/lgbm/1_lgbm.ipynb', 'repo_name': 'vishalbelsare/nyoka', 'size': '1663'}