Skip to content

Instantly share code, notes, and snippets.

@xiaowei1234
Last active November 8, 2018 00:18
Show Gist options
  • Save xiaowei1234/d64f22fc925b5871e1456fef599c47b6 to your computer and use it in GitHub Desktop.
Save xiaowei1234/d64f22fc925b5871e1456fef599c47b6 to your computer and use it in GitHub Desktop.
sklearn2pmml feature engineering and creation
featureU = FeatureUnion([
('transformations', DataFrameMapper([
(trend_vars, ExpressionTransformer("X[:, 0] - X[:, 1]"))
, (to_logs, make_pipeline(Imputer(strategy='median')
, FunctionTransformer(np.log1p)
))
])
)
, ('identity', DataFrameMapper([(non_trans_vars, ContinuousDomain())]))
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment