?? mixexp_plot.m
字號:
function plot_mixexp(theta, eta, data)% PLOT_MIXEXP Plot the results for a piecewise linear regression model% plot_mixexp(theta, eta, data)% % data(l,:) = [x y] for example l% theta(i,:) = regression vector for expert i% eta(i,:) = softmax (gating) params for expert inumexp = size(theta, 1);mn = min(data);mx = max(data);xa = mn(1):0.01:mx(1);x = [ones(length(xa),1) xa'];% pr(i,l) = posterior probability of expert i on example lpr = exp(eta * x');pr = pr ./ (ones(numexp,1) * sum(pr));% y(i,l) = prediction of expert i for example ly = theta * x';% yg(l) = weighted prediction for example lyg = sum(y .* pr)';subplot(3,2,1);plot(xa, y(1,:));title('expert 1');subplot(3,2,2);plot(xa, y(2,:));title('expert 2');subplot(3,2,3);plot(xa, pr(1,:));title('gating 1');subplot(3,2,4);plot(xa, pr(2,:));title('gating 2');subplot(3,2,5);plot(xa, yg);axis([-1 1 -1 2])title('prediction');subplot(3,2,6);title('data');hold onplot(data(:,1), data(:,2), '+');hold off
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -