Solved – Neural Network: MLP for regression with 3 continuous features, 1 categorical

classificationmachine learningneural networksregression

I am starting to study Neural Network. I want to build a MLP where I will feed it:

  • 3 features which are continuous
  • one feature which is categorical (48 classes)

How can I do this?

Before adding the categorical feature, I was using 'relu' activation function and 'lbfgs' as a solver in MLPRegrssor in sklearn.

I was wondering: how can I integrate this variable into the network? Should I do one-hot encoding? Should I keep relu as activation function or should I try sigmoid, softmax or something like that?

Best Answer

The standard approach is to one-hot encode your categorical variable. Suppose that categorical variable has $k$ categories. You'll have $k +3$ input neurons: one for each category, and three for your continuous-valued features.

Related Question