title: Kernel parameters of Gaussian Process Regression: How to get them in Scikit-learn?
body: <p>I use the squared exponential kernel or <a href="http://scikit-learn.org/stable/modules/generated/sklearn.gaussian_process.kernels.RBF.html" rel="nofollow noreferrer">RBF</a> in my regression operation using <a href="http://scikit-learn.org/stable/modules/generated/sklearn.gaussian_process.GaussianProcessRegressor.html#sklearn.gaussian_process.GaussianProcessRegressor.get_params" rel="nofollow noreferrer">GaussianProcessRegressor</a> of Scikit-learn. In addition, I use the internally available optimizer <code>'fmin_l_bfgs_b'</code> (L-BFGS-B algorithm) to optimize the Kernel parameters. The kernel parameters are length scale and signal variance in my case. The documentation regarding <code>log_marginal_likelihood</code> is as follows:</p>
  <p><a href="https://i.stack.imgur.com/tuKmV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tuKmV.jpg" alt="enter image description here" /></a></p>
  <p>I followed this documentation to print the <code>GPML kernel</code> and <code>log_marginal_likelihood</code>. Following is the code snippet:</p>
  <pre><code>print(&quot;GPML kernel: %s&quot; % gp.kernel_)
  print(&quot;Log-marginal-likelihood:&quot;,
         gp.log_marginal_likelihood(gp.kernel_.theta, eval_gradient = True))
  </code></pre>
  <p>Following value is printed at the console:</p>
  <pre><code>    GPML kernel: 31.6**2 * RBF(length_scale=1.94)
  Log-marginal-likelihood: (-115.33295413296841, array([ 1.01038168e+02, -2.16465175e-07]))
  </code></pre>
  <p><strong>Here, I could not figure out the values printed at the Log-marginal-likelihood. What are the values inside the array?</strong></p>
  <p>My code snippet regarding the regression is as follows:</p>
  
  <pre class="lang-python prettyprint-override"><code>x_train = np.array([[0,0],[2,2],[3,3]])
  y_train = np.array([200,321,417])
  xvalues = np.array([0,1,2,3])
  yvalues = np.array([0,1,2,3])
  a,b = np.meshgrid(xvalues,yvalues)
  positions = np.vstack([a.ravel(), b.ravel()])
  x_test = (np.array(positions)).T
  kernel = C(1.0, (1e-3, 1e3)) * RBF(10)
  gp = GaussianProcessRegressor(kernel=kernel, optimizer = 'fmin_l_bfgs_b',alpha = 1.5, n_restarts_optimizer=5)
  gp.fit(x_train, y_train)
  y_pred_test, sigma = gp.predict(x_test, return_std =True)
  </code></pre>
  <p><strong>Is my approach to printing the kernel parameters correct?</strong></p>
  <p>Thank you!</p>