I'm training a model and among the features, I have the language of the users. Right now I have done one-hot encoding on the language feature. But I think it would make more sense to have the language as an embedding since some of the languages are close to each other (e.g. Portuguese and Spanish) and should be taken into account in my recommendations. I'm wondering how I can do that?

  • $\begingroup$ You could add a feature that specifies "Spanish or Portuguese," and set it to be $1$ if the language is either Spanish or Portuguese, and $0$ otherwise. $\endgroup$ – Open Season Nov 1 '17 at 16:53
  • $\begingroup$ I want to this automatically. I don't want to do something similar to word2vec, but only for languages. $\endgroup$ – Erin Nov 2 '17 at 0:01
  • $\begingroup$ You should look into the fused-lasso which will solve your problem! Or look at this post which gives a ridge regression version. $\endgroup$ – kjetil b halvorsen Mar 16 at 22:07
  • 1
    $\begingroup$ To get to something like word2vec, you need some kind of task or network structure (see net2vec, if you e.g. have some kind of hierarchical structure of languages or if you can calculate some kind of word similarity as a measure of language similarity) you want to embed. Alternatively, if you have some multiple features of languages, you could try something like UMAP to map that to a lower dimensional space. $\endgroup$ – Björn Mar 16 at 22:34

Your Answer

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

Browse other questions tagged or ask your own question.