title: Scikit-learn grid search with SVM regression
body: <p>I am learning cross validation-grid search  and came across this <a href="https://www.youtube.com/playlist?list=PL5-da3qGB5ICeMbQuqbbCOQWcS6OYBr5A" rel="noreferrer">youtube playlist</a> and the tutorial also has been uploaded to the <a href="https://github.com/justmarkham/scikit-learn-videos/blob/master/08_grid_search.ipynb" rel="noreferrer">github</a> as an ipython notebook. I am trying to recreate the codes in the <strong>Searching multiple parameters simultaneously</strong> section but instead of using knn i am using SVM Regression. This is my code</p>
  
  <pre><code>from sklearn.datasets import load_iris
  from sklearn import svm
  from sklearn.grid_search import GridSearchCV
  import matplotlib.pyplot as plt
  import numpy as np
  iris = load_iris()
  X = iris.data
  y = iris.target
  
  k=['rbf', 'linear','poly','sigmoid','precomputed']
  c= range(1,100)
  g=np.arange(1e-4,1e-2,0.0001)
  g=g.tolist()
  param_grid=dict(kernel=k, C=c, gamma=g)
  print param_grid
  svr=svm.SVC()
  grid = GridSearchCV(svr, param_grid, cv=5,scoring='accuracy')
  grid.fit(X, y)  
  print()
  print("Grid scores on development set:")
  print()  
  print grid.grid_scores_  
  print("Best parameters set found on development set:")
  print()
  print(grid.best_params_)
  print("Grid best score:")
  print()
  print (grid.best_score_)
  # create a list of the mean scores only
  grid_mean_scores = [result.mean_validation_score for result in grid.grid_scores_]
  print grid_mean_scores
  </code></pre>
  
  <p>But its giving this error</p>
  
  <blockquote>
    <p>raise ValueError("X should be a square kernel matrix") ValueError: X
    should be a square kernel matrix</p>
  </blockquote>