Menu

Understanding the Target Labels

Understanding the Target Labels

Machine learning models require numerical labels. Before converting them, let's examine the unique values in the label column.

Code

df['label'].value_counts()

Converting Labels into Numbers

Machine learning algorithms work with numerical values rather than text labels.

If your dataset uses CG (Computer Generated/Fake) and OR (Original/Real), convert them as follows:

df['label'] = df['label'].replace({
'CG':1,
'OR':0
})

Verify Conversion

df.head()