JuliaStats/Stats.jl — pull request #22 by AlexanderFabisch (2013-09-03 21:01:13+00:00)
Title: Add one-hot scheme / one-of-C encoding

`onehot(y)` will convert a vector of categories (e.g. `[0, 1, 0, 2, 1]`) to the one-hot scheme (aka one-of-C encoding; e.g. `[1 0 0; 0 1 0; 1 0 0; 0 0 1; 0 1 0]'`).

This encoding is common for artificial neural networks and multinomial logistic regression and has been proposed here: https://github.com/johnmyleswhite/MNIST.jl/pull/4