Last active
September 8, 2018 11:15
-
-
Save baatout/a8cfd3adaff563a6e574c260c7a92864 to your computer and use it in GitHub Desktop.
PMML export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# with X_train, X_test, Y_train, Y_test | |
import numpy as np | |
from sklearn_pandas import DataFrameMapper | |
from sklearn2pmml import PMMLPipeline, sklearn2pmml | |
from sklearn.linear_model import LogisticRegression | |
from sklearn.preprocessing import FunctionTransformer | |
clf = PMMLPipeline([ | |
("mapper", DataFrameMapper([ | |
(['mass'], FunctionTransformer(np.log1p)), | |
(features, None) | |
])), | |
("classifier", LogisticRegression()) | |
]) | |
clf.fit(X_train, Y_train) | |
print(clf.score(X_test, Y_test)) | |
sklearn2pmml(clf, "Model.pmml", with_repr=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment