I have been looking at the official documentation of FeatureExtract, and I'm having a bit of difficulty interpreting the output--or understanding the reasons for some of the choices that were made. Take the basic example provided at the site:

fe = FeatureExtract[{{1.4, "A"}, {1.5, "A"}, {2.3, "B"}, {5.4, "B"}}];

Then we find that the output of fe[{3.7, "A"}] is {3.7, 1., 0.}, while the output of fe[{7.1, "B"}] is {7.1, 0., 1.}.

Now, when I add {6.4, "C"} to the training set:

fe2 = FeatureExtract[{{1.4, "A"}, {1.5, "A"}, {2.3, "B"}, {5.4, "B"}, {6.4, "C"}}];

I find that fe2[{3.7, "A"}] is now {3.7, 1., 0., 0.}, and so on.

So it appears to me that FeatureExtract converts the set {"A", "B", "C"} to the set of unit vectors in 3-D space. Is there any particular reason for this? Would it not have been more efficient for almost all downstream tasks to handle the distinct symbols in the set of letters into distinct numbers: "A" -> 1, "B" -> 2, and so on?

Why did Wolfram make this particular decision? I could not find a good explanation anywhere?


A-B-C-D is one hot encoding. if a character in not in the dataset, then it'll be {0,0,0,0} it's a simple method for word-encoding or feature-encoding.

one hot encoding features can also be convert into dense or sparse vectors by other methods.

you may try

list = {{1.4, "A"}, {1.5, "A"}, {2.3, "B"}, {5.4, "B"}, {6.4,"D"}, {4, "E"}}
fe = FeatureExtraction[list];

fe@{1.4, "E"}
fe /@ list

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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