1
$\begingroup$

I have a set of about 20000 objects, with 35 features. Some of the features are numeric, and some of the features are like 'gthad12ja'. (There are a finite number of this strings, for example feature_14 can be 'gthad12ja', 'a11qwzxcja', 'plzxq11qqz'.) Can I encode 'gthad12ja' as 0, 'a11qwzxcja' as 1, 'plzxq11qqz' as 2, and use this feature as numeric?

What else can I do with them?

$\endgroup$
5
  • 4
    $\begingroup$ In R, you would encode such features as factors. Why language are you using? $\endgroup$
    – Creosote
    Sep 16, 2015 at 15:17
  • 4
    $\begingroup$ It's worth noting that factor coding in R is just a data type that is typically subsequently expanded to dummy coding. $\endgroup$
    – Sycorax
    Sep 16, 2015 at 15:30
  • $\begingroup$ I use python-language $\endgroup$
    – pandreym
    Sep 16, 2015 at 15:53
  • 1
    $\begingroup$ What information relevant to the classification you're going to perform do the different strings contain? Can 'gthad12ja' be seen as twice 'a11qwzxcja', or as greater than it? If there's nothing more than possession of different attributes to consider, treat them as categorical variables & use a dummy coding system - see: eg Contrast Coding Systems for categorical variables & here. $\endgroup$ Sep 21, 2015 at 10:01
  • 1
    $\begingroup$ Dummy coding is not specific to any software environment. $\endgroup$
    – Sycorax
    Sep 21, 2015 at 13:29

1 Answer 1

-2
$\begingroup$

Advice: try it, build a model from the change and see what effect it has. These is data-specific question that must be tested.

Also usefull links: http://machinelearningmastery.com/discover-feature-engineering-how-to-engineer-features-and-how-to-get-good-at-it/

$\endgroup$
3
  • $\begingroup$ (-1) There's no reason to suppose 'gthad12ja' &c. even represent ordered categories. $\endgroup$ Sep 21, 2015 at 9:47
  • $\begingroup$ These is data-specific question that must be tested. $\endgroup$
    – pandreym
    Sep 21, 2015 at 13:22
  • $\begingroup$ If there are, say, 20 string features, each with 3 levels, then there are 120 different representations of this form (each as 1, 2, or 3), none with any particular justification. Do you test all of them? From your link:-"Feature importance and selection can inform you about the objective utility of features, but those features have to come from somewhere. You need to manually create them. This requires spending a lot of time [...] thinking about the underlying form of the problem, structures in the data and how best to expose them to predictive modeling algorithms". $\endgroup$ Sep 21, 2015 at 13:37

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.