Advertisement
KodingKid

Quest to Learn and Master AI in Python - Script #2

Dec 17th, 2021
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. import numpy as np
  2. from sklearn import preprocessing
  3. input_colours = ['red','white','green','black','yellow', 'blue']
  4. encoder = preprocessing.ColourEncoder()
  5. encoder.fit(input_colours)
  6. test_colours = ['red', 'yellow', 'white']
  7. encoded_colours = encoder.transform(test_colours)
  8. print("\nColours =", test_colours)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement