浏览代码

Correct GPR alpha parameter

Blaz Leban 3 年之前
父节点
当前提交
54b2a6bca3

+ 3 - 3
1-naloga-razpadi-higgsovega-bozona/fitting_example_GPR-Cern.py

@@ -111,7 +111,7 @@ else:
     )
 
 # Fit the GPR Kernel to the input template
-gpr = GaussianProcessRegressor(kernel=kernel, n_restarts_optimizer=3, alpha=2 * bin_errors)
+gpr = GaussianProcessRegressor(kernel=kernel, n_restarts_optimizer=3, alpha=bin_errors**2)
 gpr.fit(bin_centers.reshape(len(bin_centers), 1), (bin_values - myBaseLine).ravel())
 
 # Check to see if GPR Prediction is effectively the same as the exponential prior
@@ -161,8 +161,8 @@ if(calculateSystematics):
     kernel_systDown = gpr.kernel_.clone_with_theta(theta_down)
 
     # Perform the fits using the systematic kernels
-    gpr_systUp = GaussianProcessRegressor(kernel=kernel_systUp, n_restarts_optimizer=3, alpha=2 * bin_errors)
-    gpr_systDown = GaussianProcessRegressor(kernel=kernel_systDown, n_restarts_optimizer=3, alpha=2 * bin_errors)
+    gpr_systUp = GaussianProcessRegressor(kernel=kernel_systUp, n_restarts_optimizer=3, alpha=bin_errors**2)
+    gpr_systDown = GaussianProcessRegressor(kernel=kernel_systDown, n_restarts_optimizer=3, alpha=bin_errors**2)
 
     gpr_systUp.fit(bin_centers.reshape(len(bin_centers), 1), (bin_values - myBaseLine).ravel())
     gpr_systDown.fit(bin_centers.reshape(len(bin_centers), 1), (bin_values - myBaseLine).ravel())

+ 2 - 2
1-naloga-razpadi-higgsovega-bozona/fitting_example_GPR-simple.py

@@ -36,8 +36,8 @@ X = np.atleast_2d(bin_centers).T  # true datapoints
 X_to_predict = np.atleast_2d(np.linspace(110, 160, 1000)).T  # what to predict
 y = bin_values
 
-# Initialize Gaussian Process Regressor: !!! alpha = 2xbin_errors or 1xbin_errors ? Your task to figure out. !!!
-gp = GaussianProcessRegressor(kernel=kernel_RBF, n_restarts_optimizer=1, alpha=2 * bin_errors)
+# Initialize Gaussian Process Regressor: !!! alpha = bin_errors, 2*bin_errors or bin_errors**2? Your task to figure out. !!!
+gp = GaussianProcessRegressor(kernel=kernel_RBF, n_restarts_optimizer=1, alpha=bin_errors**2)
 
 # Fit on X with values y
 gp.fit(X, y)