Python Exercise for Beginners - One Hot Encoding (Learn Python #3)

Published: 23 April 2022
on channel: CODE MENTAL
272
6

#python #pythonforbeginners #pandas #machinelearning #keras #tensorflow #pandas #sklearn

In today's Python exercise we will create a one-hot encoding algorithm to convert categorical data to a numerical format.
The reason why we need to do this is that machine learning algorithms only can deal with numbers, not strings.

I show you first how to create one-hot encodings manually, than for larger categories using NumPy, and then using the most popular data science frameworks, like Keras, Pandas, and Sklearn.

⭐ DON'T KNOW PYTHON?

Python for Everybody 👉🏼 https://coursera.pxf.io/mgJKke

⭐ Do you want to learn Deep Learning?

Neural Networks and Deep Learning by Andrew Ng 👉🏼 https://imp.i384100.net/6b1e6K

Note: I will get an affiliate commission if you sign up for the course. So that's one way for you to support the channel.

✅ Source Code and Article:

https://spltech.co.uk/python-exercise...

✅ CONTACT ME FOR CONSULTING AND ANY OTHER BUSINESS ENQUIRIES

codemental@spltech.co.uk

✅ SUPPORT THE CHANNEL or get MENTORING

  / codemental  

✅ FOLLOW ME

Instagram:   / codemental  
Blog: https://spltech.co.uk/blog/

✅ Timestamps:

0:00 What is One-Hot Encoding
1:29 One-Hot-Encoding for a simple category
1:54 Counting number of elements in category
2:09 Creating a unique words index
3:13 Why Manual One-Hot-Encoding with Binary numbers alone is not feasible
3:56 Web Scraping Genesis chapter from the Bible using requests library
5:07 Cleansing data - removing verse numbers from text
8:08 string.punctuation
8:32 Removing punctuation using str.strip() and string.punctuation
09:26 Generating unique words index for bible text
11:04 One-hot encoding implemented using NumPy
11:21 Initialising NumPy array to zeros using numpy.zeros
13:28 Setting 1s in the Numpy array
15:54 One-Hot Encoding with Pandas library using get_dummies() function
20:57 Sklearn One-Hot encoding implementation
24:34 One-Hot Encoding with Tensorflow Keras library


On this page of the site you can watch the video online Python Exercise for Beginners - One Hot Encoding (Learn Python #3) with a duration of hours minute second in good quality, which was uploaded by the user CODE MENTAL 23 April 2022, share the link with friends and acquaintances, this video has already been watched 272 times on youtube and it was liked by 6 viewers. Enjoy your viewing!