Skip to content

Instantly share code, notes, and snippets.

@xiaowei1234
Last active April 18, 2019 21:04
Show Gist options
  • Save xiaowei1234/2c610403abef6aa707758060c16130c8 to your computer and use it in GitHub Desktop.
Save xiaowei1234/2c610403abef6aa707758060c16130c8 to your computer and use it in GitHub Desktop.
Binning using CutTransformer
from sklearn2pmml.preprocessing import CutTransformer
from sklearn.impute import SimpleImputer
bins = CutTransformer(bins=[0, 250, 2200], labels=[0.3, 0.4])
wrap = DataFrameMapper([
('amount', [SimpleImputer(), bins])
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment