scikit-learn DBN encoding string labels
<p>I am quite new to both python and scikit-learn. My goal is to get a classification working that should the divide into 6 different string labels with a deep belief net.</p>
<p>Here are some samples of my data:</p>
<blockquote>
<p>uploadType,mainColorCode,allPageHeights,allPageWidths,mainAspectRatio,hasQrOrBarcode,mainFontSize,ocrWords,ocrNumber,pageCount,category</p>
<p>Filesystem,#FFFFFFFF,1115 1115,794 794,0.71,False,20.15,ocr recognized
text,14.4,2,class a Filesystem,#FFFFFFFF,1115 1115,794
794,0.71,False,20.15,ocr recognized text,0,2,class a
Filesystem,#FFFFFFFF,1056,816,0.77,False,19.61,ocr recognized
text,204.2,1,class b</p>
</blockquote>
<p>I get my supervised data that consists 11 columns (10 features and last one is the label) like that:</p>
<pre><code>input_file = &quot;Downloads/data.csv&quot;
df = pd.read_csv(input_file, header = 0)
original_headers = list(df.columns.values)
df = df._get_numeric_data()
numeric_headers = list(df.columns.values)
reverse_df = df[numeric_headers]
numpy_array = reverse_df.as_matrix()
X, Y = numpy_array[:,1:], numpy_array[:,0]
</code></pre>
<p>Then I do:</p>
<pre><code># Splitting data
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.2, random_state=0)

# Data scaling
min_max_scaler = MinMaxScaler()
X_train = min_max_scaler.fit_transform(X_train)

# Training
classifier = SupervisedDBNClassification(hidden_layers_structure=[256, 256],
                                         learning_rate_rbm=0.01,
                                         learning_rate=0.001,
                                         n_epochs_rbm=20,
                                         n_iter_backprop=100,
                                         l2_regularization=0.0,
                                         activation_function='relu')
classifier.fit(X_train, Y_train)

# Test
X_test = min_max_scaler.transform(X_test)
Y_pred = classifier.predict(X_test)
print 'Done.\nAccuracy: %f' % accuracy_score(Y_test, Y_pred)
</code></pre>
<p>But that it says me: ValueError:</p>
<blockquote>
<p>Can't handle mix of unknown and binary</p>
</blockquote>
<p>I think I have to do something like the following statements with the data, but I am not sure how to perform it on the data correctly:</p>
<pre><code>le = preprocessing.LabelEncoder()
le.fit([&quot;Class A&quot;, &quot;Class B&quot;, &quot;Class C&quot;, &quot;Class D&quot;, &quot;Class E&quot;, &quot;Class F&quot;])
</code></pre>
<p>Thank you!</p>