Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions matlab/@Sampling/ThompsonSampling.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
mean = model.mean;
cov_scale = alg.settings.gp_settings.cov_scale;
sigma = model.sigma;


% sigma is the posterior covariance, so factor it (L*L' = sigma) to
% sample R ~ N(mean, cov_scale^2 * sigma) via R = mean + cov_scale.*(L*X)
L = chol(sigma,'lower');

% to store the sampled reward functions:
R_models = zeros(length(mean),num_samples);

Expand All @@ -45,7 +49,7 @@

% sample reward function from GP model posterior
X = randn(num_features,1);
R = mean + cov_scale .* sigma * X;
R = mean + cov_scale .* (L * X);
R = real(R);

% to avoid certain regions of the action space or not
Expand Down