<p dir="auto">I posted <a href="http://stackoverflow.com/questions/35107559/scikit-learn-one-hot-encoding-of-string-categorical-features" rel="nofollow">this question</a> on stackoverflow a few days ago. Essentially, I'm trying to perform a one hot encoding for multiple features:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="data = [['a', 'dog', 'red']
        ['b', 'cat', 'green']]"><pre class="notranslate"><code class="notranslate">data = [['a', 'dog', 'red']
        ['b', 'cat', 'green']]
</code></pre></div>
<p dir="auto">The <a href="http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html" rel="nofollow">OneHotEncoder</a> only accepts integer features. But to produce the integer features, you would use a <a href="http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.LabelEncoder.html" rel="nofollow">LabelEncoder</a> for each feature. And after this process, you have to store each individual LabelEncoder, as well as a mapping to the index of the feature they encoded.</p>
<p dir="auto">We should have a class in scikit-learn to perform the entire LabelEncoding on the entire feature matrix.</p>
<p dir="auto">According to documentation:<br>
<em>The order of the columns in the transformed feature matrix follows the order of how the columns are specified in the transformers list. Columns of the original feature matrix that are not specified are dropped from the resulting transformed feature matrix, unless specified in the passthrough keyword. Those columns specified with passthrough are added at the right to the output of the transformers.</em></p>
<p dir="auto">However retrieving the ordered column names of the transformed matrix from the ColumnTransformer is not straightforward (my use case is to match the trained coefficients with the produced features).<br>
My suggestion would be to add a <code class="notranslate">get_transformed_matrix_feature_names</code> (name can be improved) to retrieve the ordered column names of the transformed matrix.</p>