O'Reilly logo

R Machine Learning Essentials by Michele Usuelli

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Modifying the features

Our features are attributes that describe the flag, and some of them might not be in the right format. In this section, we will take a look at each feature and transform it if necessary.

In order to keep track of which features we have already processed, let's start defining an empty vector namesProcessed, which contains the features that we have already processed. When we transform a feature, we add the feature name into namesProcessed:

namesProcessed <- c()

Let's start with the numeric columns, such as red, which have two possible outcomes: 0, in case the flag contains red and 1 otherwise. The red variable defines an attribute, so it should be categorical instead of numeric. Then, we can convert red into a feature that is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required