title: One hot encoding using sklearn preprocessing Label Binarizer
body: <p>I am trying to use <code>sklearn.preprocessing.LabelBinarizer()</code> to create a one hot encoding of only a two-column labels, i.e. I only want to categorize two set of objects. In this case, when I use <code>fit(range(0,2))</code>, it just returns a one dimensional array, instead of 2x1. This is fine, but when I want to use them in <code>Tensorflow</code>, the shape should really be (2,1) for dimensional consistency. Please advise how I can resolve it.</p>
  
  <p>Here is the code: </p>
  
  <pre><code>from sklearn import preprocessing
  lb = preprocessing.LabelBinarizer()
  lb.fit(range(0, 3))
  </code></pre>
  
  <p>Calling <code>lb.transform([1, 0])</code>, the result is:</p>
  
  <pre><code>[[0 1 0]
   [1 0 0]]
  </code></pre>
  
  <p>whereas when we change 3 to 2, i.e. <code>lb.fit(range(0, 2))</code>, the result would be </p>
  
  <pre><code>[[1]
   [0]]
  </code></pre>
  
  <p>instead of </p>
  
  <pre><code>[[0 1]
   [1 0]]
  </code></pre>
  
  <p>This will create problems in the algorithms that work consistently with arrays with <code>n</code> dimensions. Is it any way to resolve this issue?</p>