scramble_boy

Pipeline scikit-learn

Dec 17th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. from sklearn.pipeline import Pipeline
  2. from sklearn.preprocessing import LabelEncoder
  3. from sklearn.preprocessing import OneHotEncoder
  4.  
  5. labels = ['Orange', 'Apple', 'Tomato', 'Coconut', 'Strawberry']
  6.  
  7. en_pipeline = Pipeline([
  8.                     ('encode', LabelEncoder()),
  9.                     ('one_hot', OneHotEncoder()),
  10.                 ])
  11.  
  12. en_labels = en_pipeline.fit_transform(labels)
Add Comment
Please, Sign In to add comment