SVC (support vector classification) with categorical (string) data as labels
<p>I use <code>scikit-learn</code> to implement a simple supervised learning algorithm. In essence I follow the tutorial <a href="http://scikit-learn.org/stable/tutorial/basic/tutorial.html#learning-and-predicting" rel="noreferrer">here</a> (but with my own data).</p>

<p>I try to fit the model:</p>

<pre><code>clf = svm.SVC(gamma=0.001, C=100.)
clf.fit(features_training,labels_training)
</code></pre>

<p>But at the second line, I get an error: <code>ValueError: could not convert string to float: 'A'</code></p>

<p>The error is expected because <code>label_training</code> contains string values which represent three different categories, such as <code>A</code>, <code>B</code>, <code>C</code>. </p>

<p><strong>So the question is:</strong> How do I use SVC (support vector classification), if the labelled data represents categories in form of strings. One intuitive solution to me seems to simply convert each string to a number. For instance, <code>A = 0</code>, <code>B = 1</code>, etc. But is this really the best solution?</p>