1
$\begingroup$

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?

$\endgroup$
1
$\begingroup$

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.

$\endgroup$
1
$\begingroup$

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

You can certainly use ordinal variables too.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.