I have a feature for machine learning (using methods like SVM, naive bayes, neural network and random forest) called member duration as follows: Should I make it as numerical or categorical data?

enter image description here

  • $\begingroup$ It depends on your application, for me it seems to be a discrete numerical feature. $\endgroup$
    – Icyblade
    Commented Feb 23, 2017 at 3:59
  • $\begingroup$ Can you tell us what member duration represents? Is it measured in days? $\endgroup$ Commented Dec 20, 2017 at 21:00

2 Answers 2


You definitely have interval data, that is, data which takes on discrete values, as opposed to continuous data, which takes on values along a continuum.

It may be of value to additionally determine if the data is ordinal, meaning that the order of the values is important, for example if [0, 1, 2] signifies [small, medium, large] or some analogous system.

In the case of ordinal data, it may be best to keep the data as exposed to the SVM training process in integer form, as the integer representation encodes some information about the relationship between the categories.

This approach would also be more reasonable if the values that the variable could take on in a production setting could expand beyond the values you've already observed in the training set- a categorical approach would be less able to handle new values in that context.

If there are no ordinal relationships and you suspect all of the possible values are enumerated in the training set,treating the variable as categorical would be approriate.


It looks like counting data to me. Without further information in the question, I'd keep it as a categorical data and model it with discrete techniques (e.g. Poisson GLM)

  • $\begingroup$ This is to pass to the machine learning languages like SVM etc. I have updated the question, let me know if anything requires clarification. $\endgroup$
    – william007
    Commented Feb 23, 2017 at 6:33
  • $\begingroup$ @william007 To me, my answer is valid unless you want to run an algorithm only works for numerical data. At the end of the day, your distribution is very discrete. $\endgroup$
    – SmallChess
    Commented Feb 23, 2017 at 8:18

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.