Dummy Variables and Learning algorithms Suppose a predictor variable $x$ is nominal/categorical with three levels: $1,2,3$. Thus we create two dummy variables $x_2$ and $x_3$ with level $1$ as the reference variable. Let $y$ be a binary response variable.
Then a logistic regression model could be: $$ \text{logit}(p) = \beta_0 +\beta_1 x_{2} + \beta_{2}x_{3}$$
In SVMs and decision trees, is it necessary to create the dummy variables $x_2,x_3$ for $x$? Or can we just keep it as is?
 A: To complement the answer given by @Marc Claesen.
You don't need it for decision trees. To train a decision tree, e.g. by the ID-3 algorithm, you are interested in relative entropies with and without different variables. 
For categorical variabels, e.g.type=[brown, yellow, red], the tree branches out for each category, you do not need to index the colours. The distance problem with the SVMs or logistic regression or k-NN, is not a problem for decision trees.
A: Not sure about trees, but for SVMs you will certainly want dummy variables. The reason for this is simple: not using dummy variables leads to wrong distances. Any kernel method uses distance at some point, whether you use the linear kernel or something more fancy. 
If you do not use dummy variables, the distance that is being used by the SVM between 1 and 2 will be half of the distance between 1 and 3. You do not want this for categorical variables.
If you have dummy variables, say 1 $\rightarrow [1, 0, 0]$, 2 $\rightarrow [0, 1, 0]$ and 3 $\rightarrow [0, 0, 1]$, the distance between any two categories is equal (as is desired).
