I have a food alert dataset composed of nominal qualitative variables, such as type of alert, country of origin, action taken, etc. as well as the date on which the alert was recorded.

What techniques are there to predict what type of alert is most likely in a time window when there are only qualitative variables in our dataset? Or given a variable (for example, country of origin = France) predict the rest of the variables?

I have used machine learning algorithms before but not with datasets composed of nominal qualitative variables.

On the other hand, what are the most appropriate techniques for clustering and classification this kind of datasets?

I know it's a broad question, so I expect broad answers to guide me in a general way Sample data

I have about 50000 registered alerts. In the example of the image not all the variables are shown

  • $\begingroup$ any sample data? $\endgroup$
    – sai saran
    Nov 14, 2018 at 14:44
  • $\begingroup$ I added an image with some sample data. I know that the data needs treatments but I do not need concrete answers of what to do, I just need some techniques that allow to work with qualitative data $\endgroup$ Nov 15, 2018 at 10:14
  • $\begingroup$ Have you tried to dummify the data? See mode.matrix and the dummies package $\endgroup$
    – Zeus
    May 11, 2019 at 7:31

3 Answers 3


You can encode the various columns of qualitative data using LabelEncoder(). For example:

label_encoder = LabelEncoder()
risk = label_encoder.fit_transform(df['RISK_DECISION'])
action = label_encoder.fit_transform(df['ACTION_TAKEN])

You can dummify the data. See mode.matrix and the dummies1 package


Maybe you could start by actually and precisely defining what you want to do with your data.

Apparently you'd like to predict some probability for each type of alert (which I assume is given by the TYPE column), and find which one gets the highest probability (that boiling down to finding what type of alert is the most likely to happen in a given time interval). Well if it's what you want to do, maybe have a look a time series forecasting ? May be an starting point...

Considering the fact that you only have nominal qualitative variables, some kind of one-hot-encoding maybe could help with clustering, for example you could encode each variable for each observation, then compute cosine similarities. That would be a way of getting a glance at a kind of distance between your observations... even it's a very basic idea.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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