Module Expr Str Print NameLoad Import alias identifier ImportFrom alias identifier ImportFrom alias ImportFrom alias ImportFrom alias alias Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Num Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr Num Num Num ExtSlice Slice Index AttributeLoad NameLoad attr Assign NameStore BinOpAdd BinOpMult Num Call AttributeLoad NameLoad attr BinOpMult Num SubscriptLoad NameLoad ExtSlice Slice Index Num Call AttributeLoad NameLoad attr Num Num SubscriptLoad AttributeLoad NameLoad attr Index Num Expr Call AttributeLoad NameLoad attr Num Assign NameStore BinOpAdd BinOpMult Num Call NameLoad keyword Num keyword TupleLoad Num Num Call NameLoad keyword Num keyword TupleLoad Num Num Assign NameStore Call AttributeLoad Call NameLoad keyword NameLoad keyword Num attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Num Num Num Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad ExtSlice Slice Index AttributeLoad NameLoad attr keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Str keyword Num keyword Num Expr Call AttributeLoad NameLoad attr NameLoad BinOpSub NameLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad BinOpAdd NameLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad keyword Num keyword Str Expr Call AttributeLoad NameLoad attr NameLoad BinOpMult Num Call AttributeLoad NameLoad attr BinOpMult Num NameLoad Str keyword Num keyword Num Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad ExtSlice Slice Index Num NameLoad keyword Str keyword Num keyword Num Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad NameLoad AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Num Assign NameStore BinOpAdd BinOpMult Num Call NameLoad keyword Num keyword TupleLoad Num Num Call NameLoad keyword Num keyword TupleLoad Num Num Assign NameStore Call AttributeLoad Call NameLoad keyword NameLoad keyword Num attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Num Num Num Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad ExtSlice Slice Index AttributeLoad NameLoad attr keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Str keyword Num keyword Num Expr Call AttributeLoad NameLoad attr NameLoad BinOpSub NameLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad BinOpAdd NameLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad keyword Num keyword Str Expr Call AttributeLoad NameLoad attr NameLoad BinOpMult Num Call AttributeLoad NameLoad attr BinOpMult Num NameLoad Str keyword Num keyword Num Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad ExtSlice Slice Index Num NameLoad keyword Str keyword Num keyword Num Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad NameLoad AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Num Assign NameStore Call AttributeLoad NameLoad attr Num Num Num Assign NameStore Call AttributeLoad NameLoad attr Num Num Num Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore ListComp ListComp Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr ListLoad Num SubscriptLoad NameLoad Index TupleLoad NameLoad NameLoad SubscriptLoad NameLoad Index TupleLoad NameLoad NameLoad comprehension NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num comprehension NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Assign TupleStore NameStore NameStore TupleLoad Call AttributeLoad UnaryOpUSub NameLoad attr Call AttributeLoad UnaryOpUSub NameLoad attr Assign NameStore Num Expr Call AttributeLoad NameLoad attr NameLoad NameLoad UnaryOpUSub NameLoad keyword Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr NameLoad Num keyword Call NameLoad keyword NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr
N/A N/A 
=============================================================
Gaussian process regression (GPR) with noise-level estimation
=============================================================

This example illustrates that GPR with a sum-kernel including a WhiteKernel can
estimate the noise level of data. An illustration of the
log-marginal-likelihood (LML) landscape shows that there exist two local
maxima of LML. The first corresponds to a model with a high noise level and a
large length scale, which explains all variations in the data by noise. The
second one has a smaller noise level and shorter length scale, which explains
most of the variation by the noise-free functional relationship. The second
model has a higher likelihood; however, depending on the initial value for the
hyperparameters, the gradient-based optimization might also converge to the
high-noise solution. It is thus important to repeat the optimization several
times for different initializations.
 N/A __doc__ N/A numpy np matplotlib pyplot plt matplotlib.colors LogNorm sklearn.gaussian_process GaussianProcessRegressor sklearn.gaussian_process.kernels RBF WhiteKernel N/A rng N/A N/A N/A np random RandomState 0 N/A X N/A N/A N/A rng uniform 0 5 20 N/A N/A N/A N/A np newaxis N/A y N/A N/A 0.5 N/A N/A np sin N/A 3 N/A X N/A N/A N/A 0 N/A N/A rng normal 0 0.5 N/A N/A X shape N/A 0 N/A N/A N/A plt figure 0 N/A kernel N/A N/A 1.0 N/A RBF length_scale 100.0 length_scale_bounds N/A 0.01 1000.0 N/A WhiteKernel noise_level 1 noise_level_bounds N/A 1e-10 10.0 N/A gp N/A N/A N/A GaussianProcessRegressor kernel kernel alpha 0.0 fit X y N/A X_ N/A N/A np linspace 0 5 100 N/A N/A y_mean y_cov N/A N/A gp predict N/A X_ N/A N/A N/A N/A np newaxis return_cov True N/A N/A N/A plt plot X_ y_mean k lw 3 zorder 9 N/A N/A N/A plt fill_between X_ N/A y_mean N/A N/A np sqrt N/A N/A np diag y_cov N/A y_mean N/A N/A np sqrt N/A N/A np diag y_cov alpha 0.5 color k N/A N/A N/A plt plot X_ N/A 0.5 N/A N/A np sin N/A 3 X_ r lw 3 zorder 9 N/A N/A N/A plt scatter N/A X N/A N/A N/A 0 y c r s 50 zorder 10 N/A N/A N/A plt title N/A Initial: %s
Optimum: %s
Log-Marginal-Likelihood: %s N/A kernel N/A gp kernel_ N/A N/A gp log_marginal_likelihood N/A N/A gp kernel_ theta N/A N/A N/A plt tight_layout N/A N/A N/A plt figure 1 N/A kernel N/A N/A 1.0 N/A RBF length_scale 1.0 length_scale_bounds N/A 0.01 1000.0 N/A WhiteKernel noise_level 1e-05 noise_level_bounds N/A 1e-10 10.0 N/A gp N/A N/A N/A GaussianProcessRegressor kernel kernel alpha 0.0 fit X y N/A X_ N/A N/A np linspace 0 5 100 N/A N/A y_mean y_cov N/A N/A gp predict N/A X_ N/A N/A N/A N/A np newaxis return_cov True N/A N/A N/A plt plot X_ y_mean k lw 3 zorder 9 N/A N/A N/A plt fill_between X_ N/A y_mean N/A N/A np sqrt N/A N/A np diag y_cov N/A y_mean N/A N/A np sqrt N/A N/A np diag y_cov alpha 0.5 color k N/A N/A N/A plt plot X_ N/A 0.5 N/A N/A np sin N/A 3 X_ r lw 3 zorder 9 N/A N/A N/A plt scatter N/A X N/A N/A N/A 0 y c r s 50 zorder 10 N/A N/A N/A plt title N/A Initial: %s
Optimum: %s
Log-Marginal-Likelihood: %s N/A kernel N/A gp kernel_ N/A N/A gp log_marginal_likelihood N/A N/A gp kernel_ theta N/A N/A N/A plt tight_layout N/A N/A N/A plt figure 2 N/A theta0 N/A N/A np logspace -2 3 49 N/A theta1 N/A N/A np logspace -2 0 50 N/A N/A Theta0 Theta1 N/A N/A np meshgrid theta0 theta1 N/A LML N/A N/A N/A N/A gp log_marginal_likelihood N/A N/A np log N/A 0.36 N/A Theta0 N/A N/A i j N/A Theta1 N/A N/A i j N/A i N/A range N/A N/A Theta0 shape N/A 0 N/A j N/A range N/A N/A Theta0 shape N/A 1 N/A LML N/A N/A N/A np array LML T N/A N/A vmin vmax N/A N/A N/A N/A LML min N/A N/A N/A LML max N/A vmax 50 N/A N/A N/A plt contour Theta0 Theta1 N/A LML levels N/A N/A np logspace N/A N/A np log10 vmin N/A N/A np log10 vmax 50 norm N/A LogNorm vmin vmin vmax vmax N/A N/A N/A plt colorbar N/A N/A N/A plt xscale log N/A N/A N/A plt yscale log N/A N/A N/A plt xlabel Length-scale N/A N/A N/A plt ylabel Noise-level N/A N/A N/A plt title Log-marginal-likelihood N/A N/A N/A plt tight_layout N/A N/A N/A plt show