title: ValueError: could not convert string to float: yes while fitting a model using gridsearch from scikit learn
body: <p>I have this assignment where I use SVC() and best gridsearchCV() from scikit learn to fit a model. Bit I am getting can not convert string to float. All my X_train data seem to int64 and float64. But y_train data are "yes" and "no". I wonder some how I have to turn them into numbers before calling clf.fit(), not sure what function to run on y_train to turn the labels. </p>
  
  <p>I get the error on the last line where I call the fit on grid_obj. I am not sure where the strings are that can not be converted!? Thanks.</p>
  
  <pre><code>from sklearn.grid_search import GridSearchCV
  from sklearn.metrics import make_scorer
  from sklearn.metrics import r2_score
  
  def performance_metric(y_true, y_predict):
      """ Calculates and returns the performance score between 
          true and predicted values based on the metric chosen. """  
      score = r2_score(y_true,y_predict)        
      # Return the score
      return score 
  
  
  # TODO: Create the parameters list you wish to tune
  parameters =  parameters = {'kernel':('linear', 'rbf'), 'gamma':[1,100,1000],'C':[1, 10,100]}
  
  
  # TODO: Initialize the classifier
  clf = clf_A
  
  # TODO: Make an f1 scoring function using 'make_scorer' 
  f1_scorer = make_scorer(performance_metric, greater_is_better=True)  # None
  
  from sklearn import svm
  regressor = svm.SVR() #SVM regression
  
  # TODO: Perform grid search on the classifier using the f1_scorer as the scoring method
  grid_obj = GridSearchCV(estimator=regressor, param_grid=parameters, scoring=f1_scorer) 
  
  # TODO: Fit the grid search object to the training data and find the optimal parameters
  datasets = [train_test_split(X_all, y_all, train_size=x, test_size=95) for x in [100, 200, 300]]
  #print datasets
  X_train, X_test, y_train, y_test = datasets[2]
  print X_train
  grid_obj = grid_obj.fit(X_train, y_train) 
  </code></pre>
  
  <p>X_all data:
  Feature values:</p>
  
  <pre><code>  school sex  age address famsize Pstatus  Medu  Fedu     Mjob      Fjob  \
  0     GP   F   18       U     GT3       A     4     4  at_home   teacher   
  1     GP   F   17       U     GT3       T     1     1  at_home     other   
  2     GP   F   15       U     LE3       T     1     1  at_home     other   
  3     GP   F   15       U     GT3       T     4     2   health  services   
  4     GP   F   16       U     GT3       T     3     3    other     other   
  
      ...    higher internet  romantic  famrel  freetime goout Dalc Walc health  \
  0   ...       yes       no        no       4         3     4    1    1      3   
  1   ...       yes      yes        no       5         3     3    1    1      3   
  2   ...       yes      yes        no       4         3     2    2    3      3   
  3   ...       yes      yes       yes       3         2     2    1    1      5   
  4   ...       yes       no        no       4         3     2    1    2      5   
  
    absences  
  0        6  
  1        4  
  2       10  
  3        2  
  4        4  
  </code></pre>
  
  <p>X_train:</p>
  
  <pre><code>   school_GP  school_MS  sex_F  sex_M  age  address_R  address_U  \
  130        1.0        0.0    1.0    0.0   15        1.0        0.0   
  230        1.0        0.0    1.0    0.0   17        0.0        1.0   
  318        1.0        0.0    1.0    0.0   17        1.0        0.0   
  365        0.0        1.0    0.0    1.0   18        1.0        0.0   
  345        1.0        0.0    1.0    0.0   18        0.0        1.0   
  295        1.0        0.0    0.0    1.0   17        0.0        1.0
       famsize_GT3  famsize_LE3  Pstatus_A    ...     higher  internet  \
  130          1.0          0.0        0.0    ...          1         1   
  230          0.0          1.0        0.0    ...          1         1   
  318          1.0          0.0        0.0    ...          1         1   
  365          1.0          0.0        0.0    ...          1         0   
  345          1.0          0.0        0.0    ...          1         1  
       romantic  famrel  freetime  goout  Dalc  Walc  health  absences  
  130         1       4         2      2     2     2       5         0  
  230         1       3         2      3     1     2       3        14  
  318         0       4         3      4     2     5       5         0  
  365         0       3         3      4     2     4       3         4  
  345         1       5         4      3     2     3       1         7  
  295         0       4         4      3     1     3       5         4  
  </code></pre>