📄 demo_mmgauss.html
字号:
<html><head> <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=ISO-8859-1"> <title>demo_mmgauss.m</title><link rel="stylesheet" type="text/css" href="../../m-syntax.css"></head><body><code><span class=defun_kw>function</span> <span class=defun_name>demo_mmgauss</span>(<span class=defun_in>action,hfigure,varargin</span>)<br><span class=h1>% DEMO_MMGAUSS Demo on minimax estimation for Gaussian.</span><br><span class=help>%</span><br><span class=help>% <span class=help_field>Synopsis:</span></span><br><span class=help>% demo_mmgauss</span><br><span class=help>% </span><br><span class=help>% <span class=help_field>Description:</span></span><br><span class=help>% demo_mmgauss demonstrates the minimax estimation algorithm </span><br><span class=help>% [SH10] for bivariate Gaussian distribution. The training data </span><br><span class=help>% is supposed to contain samples which well describing the </span><br><span class=help>% probability distribution function (pdf), i.e., which have </span><br><span class=help>% high value of pdf. The samples do not have to be i.i.d. in </span><br><span class=help>% contrast to the ML estimation.</span><br><span class=help>% </span><br><span class=help>% The estimated model is visualized as an ellipsoid:</span><br><span class=help>% shape is influenced by the covariance matrix and the center</span><br><span class=help>% corresponds to the mean vector.</span><br><span class=help>% The lower (red) and upper (blue) bound on the optimal value </span><br><span class=help>% of the optimized minimax criterion is displayed at the bottom</span><br><span class=help>% part of the window.</span><br><span class=help>%</span><br><span class=help>% <span class=help_field>Control:</span></span><br><span class=help>% Epsilon - Stopping condition. The algorithm stops if the </span><br><span class=help>% difference between lower and the upper bound</span><br><span class=help>% is less then the epsilon.</span><br><span class=help>% </span><br><span class=help>% Iterations - Number of iterations after which the model </span><br><span class=help>% is re-displayed.</span><br><span class=help>%</span><br><span class=help>% FIG2EPS - Exports figure to the PostScript file.</span><br><span class=help>% Load data - Loads input data sample from file.</span><br><span class=help>% Create data - Invokes program for creating data sample.</span><br><span class=help>% Reset - Resets the demo.</span><br><span class=help>% Play - Runs the algorithm.</span><br><span class=help>% Stop - Stops the running algorithm.</span><br><span class=help>% Step - Performs one iteration of the algorithm.</span><br><span class=help>% Info - Invokes the info box.</span><br><span class=help>% Close - Closes the program.</span><br><span class=help>%</span><br><span class=help>% See also MMGAUSS.</span><br><span class=help>%</span><br><hr><span class=help1>% <span class=help1_field>About:</span> Statistical Pattern Recognition Toolbox</span><br><span class=help1>% (C) 1999-2003, Written by Vojtech Franc and Vaclav Hlavac</span><br><span class=help1>% <a href="http://www.cvut.cz">Czech Technical University Prague</a></span><br><span class=help1>% <a href="http://www.feld.cvut.cz">Faculty of Electrical Engineering</a></span><br><span class=help1>% <a href="http://cmp.felk.cvut.cz">Center for Machine Perception</a></span><br><br><span class=help1>% <span class=help1_field>Modifications:</span></span><br><span class=help1>% 2-may-2004, VF</span><br><span class=help1>% 19-sep-2003, VF</span><br><span class=help1>% 3-mar-2003, VF</span><br><span class=help1>% 11-june-2001, V.Franc, comments added.</span><br><span class=help1>% 24. 6.00 V. Hlavac, comments polished.</span><br><br><hr><span class=comment>% Used functions: PPOINTS, ELLIPS</span><br><br>BORDER=0.25; <span class=comment>% space between window limits and the points</span><br>CENTERSIZE=10; <span class=comment>% size of center point</span><br>LINE_WIDTH=1;<br>AXIST_ADD=10;<br>DATA_IDENT=<span class=quotes>'Finite sets, Enumeration'</span>; <span class=comment>% file identifier</span><br><br><span class=keyword>if</span> <span class=stack>nargin</span> < 1,<br> action = <span class=quotes>'initialize'</span>;<br><span class=keyword>end</span><br><br><span class=comment>% what action is required ?</span><br><span class=keyword>switch</span> lower(action)<br><br><span class=label>case</span> <span class=quotes>'initialize'</span><br> <span class=comment>% == Initialize user interface control and figure window ================</span><br><br> <span class=comment>% == Figure =============================================================</span><br> left=0.2;<br> width=0.6;<br> bottom=0.1;<br> height=0.8;<br> hfigure=<span class=graph>figure</span>(<span class=quotes>'Name'</span>,<span class=quotes>'Minimax learning'</span>, ...<br> <span class=quotes>'Visible'</span>,<span class=quotes>'off'</span>,...<br> <span class=quotes>'NumberTitle'</span>,<span class=quotes>'off'</span>, ...<br> <span class=quotes>'Units'</span>,<span class=quotes>'normalized'</span>, ...<br> <span class=quotes>'Position'</span>,[left bottom width height],...<br> <span class=quotes>'tag'</span>,<span class=quotes>'Demo_mmgauss'</span>,...<br> <span class=quotes>'doublebuffer'</span>,<span class=quotes>'on'</span>,...<br> <span class=quotes>'backingstore'</span>,<span class=quotes>'off'</span>);<br><br> <span class=comment>% == Axes ===============================================================</span><br> <span class=comment>% axes with prob.</span><br> left=0.1;<br> width=0.65;<br> bottom=0.1;<br> height=0.28;<br> haprob=<span class=graph>axes</span>(...<br> <span class=quotes>'Units'</span>,<span class=quotes>'normalized'</span>, ...<br> <span class=quotes>'NextPlot'</span>,<span class=quotes>'add'</span>,...<br> <span class=quotes>'Position'</span>,[left bottom width height]);<br> title(<span class=quotes>'blue - log p(x), red - \Sigma \alpha(x) log p(x)'</span>,...<br> <span class=quotes>'Parent'</span>,haprob,...<br> <span class=quotes>'VerticalAlignment'</span>,<span class=quotes>'bottom'</span>,...<br> <span class=quotes>'Units'</span>,<span class=quotes>'normalized'</span>,...<br> <span class=quotes>'HorizontalAlignment'</span>,<span class=quotes>'left'</span>,...<br> <span class=quotes>'Position'</span>,[0 1 0]);<br> htxsteps=xlabel(<span class=quotes>'step number'</span>);<br><br> <span class=comment>% points</span><br> height=0.45;<br> bottom=0.5;<br><span class=comment>% 'XTick',[],'YTick',[], ...</span><br> haset=<span class=graph>axes</span>(...<br> <span class=quotes>'Units'</span>,<span class=quotes>'normalized'</span>, ...<br> <span class=quotes>'NextPlot'</span>,<span class=quotes>'add'</span>,...<br> <span class=quotes>'Position'</span>,[left bottom width height]);<br> ylabel(<span class=quotes>'feature y'</span>);<br> xlabel(<span class=quotes>'feature x'</span>);<br><br> <span class=comment>% == Buttons ===========================================================</span><br> <span class=comment>% -- Export to EPS ---------</span><br> width=0.1;<br> left=0.75-width;<br> bottom=0.95;<br> height=0.04;<br> hbtclose = <span class=graph>uicontrol</span>(...<br> <span class=quotes>'Units'</span>,<span class=quotes>'Normalized'</span>, ...<br> <span class=quotes>'Callback'</span>,<span class=quotes>'fig2eps(gcf)'</span>,...<br> <span class=quotes>'ListboxTop'</span>,0, ...<br> <span class=quotes>'Position'</span>,[left bottom width height], ...<br> <span class=quotes>'String'</span>,<span class=quotes>'FIG2EPS'</span>);<br> <span class=comment>%----------------------------------</span><br><br> <span class=comment>% Close button</span><br> left=0.8;<br> bottom=0.05;<br> height=0.05;<br> width=0.15;<br> hbtclose = <span class=graph>uicontrol</span>(...<br> <span class=quotes>'Units'</span>,<span class=quotes>'Normalized'</span>, ...<br> <span class=quotes>'Callback'</span>,<span class=quotes>'close(gcf)'</span>,...<br> <span class=quotes>'ListboxTop'</span>,0, ...<br> <span class=quotes>'Position'</span>,[left bottom width height], ...<br> <span class=quotes>'String'</span>,<span class=quotes>'Close'</span>);<br><br> <span class=comment>% Info button: call stanard info box</span><br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -