# Ranked-categorical variables in Artificial Neural Networks?

As far as I understand, input variables in Artificial Neural Networks (ANN) must be continuous, right? (And there are a number of methods to convert categorical to continuous variables described in the literature.) However, I wonder if ranked-categorical variables (e.g., with classes 1, 2, and 3, where is 1 = low, 2 = average, 3 = high) should also be transformed into continuous variables before they can be included into an ANN?

Categorical features can be nominal (no ordering, like race, gender, religion, etc.), or ordinal (ranked, like in Likert scale).

The method to feed in nominal variables is by one-hot encoding, which is straight-forward. So in the case you have a Colour feature consisting of Red, Blue, Green, you would just create 3-1 binary features to represent the feature. Here 3 is the cardinality of your nominal feature. There are readily available pre-processing functions in many languages that do this for you, e.g. in Python.

For ordinal variables, you could still feed in the feature using one-hot encoding. However, this would come at the expense of losing the ranking in between the feature values. For instance movie review as a feature can have the following values rubbish, bad, mediocre, good, sensational. In this case, you are better of using label-encoding, where you map each category to, e.g. an integer, in a way that preserves the distances between feature values.

Finally, in answer to your question, the mapped values from label-encoding, which you would feed into neural networks or GLM's in general, do not need to be (and indeed cannot be) continuous.

Inputs to neural networks do not have to be continuous. Other examples are binary or integer variables.

You can certainly use ordinal variables too.

• How? please provide some evidence or support. – Seymour Apr 26 '20 at 15:43