Search code examples
pythonscikit-learnregressiongaussian-process

SKlearn: Gaussian Process Regression (legth scale value


I'm trying to fit a GP using a GaussianProcessRegressor, and tryind to get the lenght scale value (hyperparameters). I tried the gp.kernel_.get_params() and I get all the parameters (the result below). However, I would like to save the vector only length_scale=[7.68, 100, 6.04] into a file or variable so that I could use it in the post-processing traitment. If you have any Idea, I would be me than grateful.

gp.params_:
 {'k1': 2.11**2, 'k2': RBF(length_scale=[7.68, 100, 6.04]), 'k1__constant_value': 4.445109596469165, 'k1__constant_value_bounds': (0.001, 1000.0), 'k2__length_scale':  array([  7.67686023, 100.        ,   6.04453717]), 'k2__length_scale_bounds': (0.01, 100.0)}

Solution

  • I Found the answer. We could save the vector if we write the command :

    length_scale_vec = gp.kernel_.get_params()['k2__length_scale'] The result of print('length_scale_vec=',length_scale_vec) :

    length_scale_vec= [7.68 100 6.04]