Last active
June 1, 2019 01:37
-
-
Save xiaowei1234/1ebd91388aa1c22bb3dd0d1bc90159c5 to your computer and use it in GitHub Desktop.
Status Code aliases
This file contains hidden or 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
from sklearn.pipeline import make_pipeline | |
from sklearn2pmml.decoration import Alias | |
from sklearn.pipeline import FeatureUnion | |
wrap1 = DataFrameMapper([ | |
('Status 1', Alias(LookupTransformer({202:1}, 0), 'status_1_202', prefit=True)) | |
, ('Status 2', Alias(LookupTransformer({202:1}, 0), 'status_2_202', prefit=True)) | |
, ('Status 3', Alias(LookupTransformer({202:1}, 0), 'status_3_202', prefit=True)) | |
]) | |
union1 = Alias(ExpressionTransformer("X[0]+X[1]+X[2]"), 'expr_1', prefit=True) | |
pl1 = ('code_202', make_pipeline(wrap1, union1)) | |
wrap2 = DataFrameMapper([ | |
('Status 1', LookupTransformer({203:1}, 0)) | |
, ('Status 2', LookupTransformer({203:1}, 0)) | |
, ('Status 3', LookupTransformer({203:1}, 0)) | |
]) | |
union2 = ExpressionTransformer("X[0]+X[1]+X[2]") | |
pl2 = ('code_203', make_pipeline(wrap2, union2)) | |
ft = FeatureUnion([pl1, pl2]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment