What has to be done to text input for ANN?

Illustration
simranjeet_singh_01 - 2021-05-12T12:07:48+00:00
Question: What has to be done to text input for ANN?

I have 5 inputs and 1 output for my ANN problem. Among the 5 inputs are 2 "text". One is name of manufacturer (3 unique) and the other is specimen exposure type (acid, alkaline, alkaline+salt, water). How should these text type input be modified to train the model?  

Expert Answer

Profile picture of Neeta Dsouza Neeta Dsouza answered . 2025-11-20

The easiest approach would be to convert the text values to numeric values before feeding to the ANN. For example,
 
 
exposure_types = {'acid', 'alkaline', 'alkaline+salt', 'water'};

and input data is something like this

inputs = {'acid', 'acid', 'acid', 'water', 'alkaline', 'acid', 'alkaline+salt'}

you can get an equivalent numeric form using ismember()

[~, inputs_numeric] = ismember(inputs, exposure_types);<?pre>

Result

>> inputs_numeric
inputs_numeric =
     1     1     1     4     2     1     3


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!