liveBook · Manning

Hyperparameter

As explained in Experimentation for Engineers

A hyperparameter is a setting that controls the behavior or structure of a statistical model rather than representing an observed system input.

A hyperparameter controls a model’s behavior or structure rather than representing an observed system input. In Gaussian process regression, sigma is a hyperparameter controlling surrogate smoothness: larger values produce smoother surfaces. section 6.2.1

Choosing sigma in Gaussian process regression

A kernel weights measurements by distance after scaling that distance with sigma. With parameters 0.5 and 0.0, measurements 1.52 and 1.21, and sigma 0.25, the weighted model estimates 1.365 at 0.25 and 1.448 at 0.4. Leave-one-out cross-validation can select sigma by maximizing prediction accuracy for each held-out measurement. section 6.2.1

Listing 6.3 GPR with a weighted average
class GPR2:
    def __init__(self, parameters, measurements, sigma):        
        self.x = parameters
        self.y = np.array(measurements)
        self.sigma = sigma
        
        self.mean_y = self.y.mean()
        self.y -= self.mean_y                        #1
        
    def kernel(self, x1, x2):                        #2
        distance_squared = ((x1-x2)**2).sum()
        return np.exp( -distance_squared/(2*self.sigma**2) )
 
    def estimate(self, query_parameter):
        weights = [
            self.kernel(x, query_parameter)
            for x in self.x
        ]                                            #3
        weights = np.array(weights)
        weights = weights / weights.sum()            #4
        return self.mean_y + weights @ self.y        #5

Inspect the compact Python implementation that stores sigma, computes the kernel, normalizes weights, and estimates from weighted residuals. section 6.2.1

How Experimentation for Engineers covers it

How deep it goes
Defines sigma, explains its kernel effect, demonstrates weighted estimates, and defers LOOCV details.
Examples
Uses sigma values, two parameter measurements, weighted kernel estimates, and a Python Gaussian process regression implementation.
What it assumes
Assumes measurements and distance-based weighting, while introducing sigma through Gaussian process regression examples.
What you can do after
Apply it via Python to adjust Gaussian process smoothness and estimate measurements from nearby observations.
How it connects
Connects hyperparameters to Gaussian process regression, kernel functions, residuals, surrogate functions, and leave-one-out cross-validation.

Also explained in

Compare how 19 books explain hyperparameter →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Experimentation for Engineers. The section links point to the parts of the book it draws on.