from sklearn import preprocessing
label_encoder = preprocessing.LabelEncoder()
input_classes = ['suzuki', 'ford', 'suzuki', 'toyota', 'ford', 'bmw']
label_encoder.fit(input_classes)
print("\nClass mapping:")
for i, item in enumerate(label_encoder.classes_):
print(item, '-->', i)
labels = ['toyota', 'ford', 'suzuki']
encoded_labels = label_encoder.transform(labels)
print "\nLabels =", labels
print "Encoded labels =", list(encoded_labels)
######decoding
encoded_labels = [3, 2, 0, 2, 1]
decoded_labels = label_encoder.inverse_transform(encoded_labels)
print "\nEncoded labels =", encoded_labels
print "Decoded labels =", list(decoded_labels)
All information, tutorial, code and course about AI. Open for discussion about LLM, Machine learning, deep learning, Computer vision topics
Label Encoding for machine learning and data science in python using sklearn
Subscribe to:
Post Comments (Atom)
Building a CLI-Based People Tracking and Dwell Time Analytics System Using YOLOv8 and DeepSORT
Introduction Tracking people across video frames and analyzing their behavior (like dwell time ) is a crucial task for many real-world ap...
-
This is good course for deep learning from MIT. https://www.youtube.com/watch?v=njKP3FqW3Sk&list=PLtBw6njQRU-rwp5__7C0oIVt26ZgjG9NI
-
Source: https://cocodataset.org/#home COCO is a large-scale dataset. this dataset is used for the following task. Object Detection Object s...
-
Jupyter Notebook Jupyter notebook comes with anaconda and i personally prefer this notebook when i have to write a new code that may have bu...
No comments:
Post a Comment