1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Deep Learning with Keras

Connected

Exercise

Prepare your dataset

In the console you can check that your labels, darts.competitor are not yet in a format to be understood by your network. They contain the names of the competitors as strings. You will first turn these competitors into unique numbers,then use the to_categorical() function from keras.utils to turn these numbers into their one-hot encoded representation.

This is useful for multi-class classification problems, since there are as many output neurons as classes and for every observation in our dataset we just want one of the neurons to be activated.

The dart's dataset is loaded as darts. Pandas is imported as pd. Let's prepare this dataset!

Instructions 1/2

undefined XP
    1
    2
  • Use the Categorical() method from pandas to transform the competitor column.
  • Assign a number to each competitor using the cat.codes attribute from the competitor column.