# Gaussian process regression - how to fit a basis function but not other parameters

30 views (last 30 days)

Show older comments

I'm doing Gaussian process regression with the fitrgp function and want to manually control some parameters such as the kernel parameters and the noise parameter, but automatically fit a basis function (e.g. 'linear').

However, it seems that to fit a basis function the FitMethod parameter cannot be 'none':

1. Manual parameter settings (no parameter fitting) but no basis function

gpr_model = fitrgp(x_d, y_d, ...

'KernelParameters', [1.5; 1], ...

'Sigma', 0.1, ...

'FitMethod', 'none' ...

);

2. To fit the basis function I can't have FitMethod set to 'none' ('exact' is the default) but then it ignores my parameter values:

gpr_model = fitrgp(x_d, y_d, ...

'KernelParameters', [1.5; 1], ...

'Sigma', 0.1, ...

'BasisFunction', 'linear' ...

);

3. If I set FitMethod to none, it ignores the basis function:

gpr_model = fitrgp(x_d, y_d, ...

'KernelParameters', [1.5; 1], ...

'Sigma', 0.1, ...

'BasisFunction', 'linear', ...

'FitMethod', 'none' ...

);

(same a Fig. 1).

Is there a way to fit a basis function but not the other parameters?

##### 3 Comments

mono
on 5 Sep 2023

### Answers (2)

Vitek Stepien
on 5 Sep 2023

##### 3 Comments

mono
on 6 Sep 2023

If I understood the question correctly, @Bill Tubbs and myself are trying to perform parameters optimizations but with one or several specific paramaeters fixed.

E.g. with initial theta as theta0 = [1, 2], now only want to optimizae theta0[1] but with theta0[2] = 2 fixed without optimization.

Vitek Stepien
on 6 Sep 2023

Alan Weiss
on 5 Sep 2023

I might misunderstand what you are trying to do, but perhaps you could use the OptimizeHyperparameters name-value argument to find the parameter you are trying to optimize. I am not sure that this can give you what you want, because I don't really understand what you are doing, but you can check whether the argument might be applicable.

Good luck,

Alan Weiss

MATLAB mathematical toolbox documentation

##### 0 Comments

### See Also

### Categories

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!