<jupyter_start><jupyter_text>anomaly → PMML (using Nyoka) Exporter: Anomaly Detection models (OneClassSVM) Data Set used: iris  **STEPS**: - Build the model using sklearn OneClassSVM- Build PMML (Data Dictionary, Mining schema, Ouput, PMML) using Nyoka classes  Pre-processing, Model building (using pipeline) for iris data set<jupyter_code>from sklearn import datasets
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler, Imputer
from sklearn.svm import OneClassSVM

irisdata = datasets.load_iris()
pipe = Pipeline([('standard_scaler',StandardScaler()), ('Imputer',Imputer()), ('model',OneClassSVM())])
pipe.fit(irisdata.data)

print("\n","Anomaly detection model is built successfully.")<jupyter_output>Anomaly detection model is built successfully.<jupyter_text>Export the Pipeline object into PMML using the Nyoka package<jupyter_code>from nyoka import skl_to_pmml
skl_to_pmml(pipeline=pipe, col_names=irisdata.feature_names, pmml_f_name="OneClassSVM_model.pmml")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09689922480620156, 'fraction_numerical': 0.0, 'mean_word_length': 8.306306306306306, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '325806', 'license': 'Apache-2.0', 'n_tokens_mistral': 336, 'n_tokens_neox': 330, 'n_words': 90, 'path': 'examples/skl/7_OneClassSVM_Model_to_PMML.ipynb', 'repo_name': 'maxibor/nyoka', 'size': '1032'}