⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 demprgp.m

📁 利用HMM的方法的三种语音识别算法
💻 M
📖 第 1 页 / 共 2 页
字号:
function demprgp(action);
%DEMPRGP Demonstrate sampling from a Gaussian Process prior.
%
%	Description
%	This function plots the functions represented by a Gaussian Process
%	model. The hyperparameter values can be adjusted  on a linear scale
%	using the sliders (though the exponential of the parameters is used
%	in the covariance function), or  by typing values into the text boxes
%	and pressing the return key. Both types of covariance function are
%	supported.  An extra function specific parameter is needed for the
%	rational quadratic function.
%
%	See also
%	GP
%

%	Copyright (c) Ian T Nabney (1996-2001)

if nargin<1,
    action='initialize';
end;

if strcmp(action,'initialize')

  % Bounds on hyperparameter values
  biasminval = -3.0; biasmaxval = 3.0;
  noiseminval = -20; noisemaxval = -2;
  fparminval = 0.0; fparmaxval = 2.0;
  inwminval = 0; inwmaxval = 8;
  % Initial hyperparameter values
  bias = (biasminval+biasmaxval)/2;
  noise = (noiseminval+noisemaxval)/2;
  inweights = (inwminval+inwmaxval)/2;
  fpar = (fparminval+fparmaxval)/2;
  fpar2 = (fparminval+fparmaxval)/2;
  
  gptype = 'sqexp';
  
  % Create FIGURE
  fig=figure( ...
    'Name','Sampling from a Gaussian Process prior', ...
    'Position', [50 50 480 380], ...
    'NumberTitle','off', ...
    'Color', [0.8 0.8 0.8], ...
    'Visible','on');

  % List box for covariance function type
  nettype_box = uicontrol(fig, ...
    'Style', 'listbox', ...
    'Units', 'normalized', ...
    'HorizontalAlignment', 'center', ...
    'Position', [0.52 0.77 0.40 0.12], ...
    'String', 'Squared Exponential|Rational Quadratic', ...
    'Max', 1, 'Min', 0, ... % Only allow one selection
    'Value', 1, ... % Initial value is squared exponential
    'BackgroundColor',[0.60 0.60 0.60],...
    'CallBack', 'demprgp GPtype');

  % Title for list box
  uicontrol(fig, ...
    'Style', 'text', ...
    'Units', 'normalized', ...
    'Position', [0.52 0.89 0.40 0.05], ...
    'String', 'Covariance Function Type', ...
    'BackgroundColor', get(fig, 'Color'), ...
    'HorizontalAlignment', 'center');
  
  % Frames to enclose sliders
  bottom_row = 0.04;
  slider_frame_height = 0.15;
  biasframe = uicontrol(fig, ...
    'Style', 'frame', ...
    'Units', 'normalized', ...
    'BackgroundColor', [0.6 0.6 0.6], ...
    'String', 'bias', ...
    'HorizontalAlignment', 'left', ...
    'Position', [0.05 bottom_row 0.35 slider_frame_height]);
  
  bpos = get(biasframe, 'Position');
  noise_frame_bottom = bpos(2) + bpos(4) + 0.02;
  noiseframe = uicontrol(fig, ...
    'Style', 'frame', ...
    'Units', 'normalized', ...
    'BackgroundColor', [0.6 0.6 0.6], ...
    'Position', [0.05 noise_frame_bottom 0.35 slider_frame_height]);
   
  npos = get(noiseframe, 'Position');
  inw_frame_bottom = npos(2) + npos(4) + 0.02;
  inwframe = uicontrol(fig, ...
    'Style', 'frame', ...
    'Units', 'normalized', ...
    'BackgroundColor', [0.6 0.6 0.6], ...
    'Position', [0.05 inw_frame_bottom 0.35 slider_frame_height]);
   
  inwpos = get(inwframe, 'Position');
  fpar_frame_bottom = inwpos(2) + inwpos(4) + 0.02;
  % This frame sometimes has multiple parameters
  uicontrol(fig, ...
    'Style', 'frame', ...
    'Units', 'normalized', ...
    'BackgroundColor', [0.6 0.6 0.6], ...
    'Position', [0.05 fpar_frame_bottom 0.35 2*slider_frame_height]);
   
  % Frame text
  slider_text_height = 0.05;
  slider_text_voffset = 0.08;
  uicontrol(fig, ...
    'Style', 'text', ...
    'Units', 'normalized', ...
    'HorizontalAlignment', 'left', ...
    'BackgroundColor', [0.6 0.6 0.6], ...
    'Position', [0.07 bottom_row+slider_text_voffset ...
      0.06 slider_text_height], ...
    'String', 'bias');

  % Frame text
  noiseframe = uicontrol(fig, ...
    'Style', 'text', ...
    'Units', 'normalized', ...
    'HorizontalAlignment', 'left', ...
    'BackgroundColor', [0.6 0.6 0.6], ...
    'Position', [0.07 noise_frame_bottom+slider_text_voffset ...
      0.08 slider_text_height], ...
    'String', 'noise');

  % Frame text
  uicontrol(fig, ...
    'Style', 'text', ...
    'Units', 'normalized', ...
    'HorizontalAlignment', 'left', ...
    'BackgroundColor', [0.6 0.6 0.6], ...
    'Position', [0.07 inw_frame_bottom+slider_text_voffset ...
      0.14 slider_text_height], ...
    'String', 'inweights');

  % Frame text
  uicontrol(fig, ...
    'Style', 'text', ...
    'Units', 'normalized', ...
    'HorizontalAlignment', 'left', ...
    'BackgroundColor', [0.6 0.6 0.6], ...
    'Position', [0.07 fpar_frame_bottom+slider_frame_height+ ...
       slider_text_voffset 0.06 slider_text_height], ...
    'String', 'fpar');

 uicontrol(fig, ...
    'Style', 'text', ...
    'Units', 'normalized', ...
    'HorizontalAlignment', 'left', ...
    'BackgroundColor', [0.6 0.6 0.6], ...
    'Position', [0.07 fpar_frame_bottom+slider_text_voffset ...
       0.06 slider_text_height], ...
    'String', 'fpar2', ...
    'Tag', 'fpar2text', ...
    'Enable', 'off');
   
  % Slider
  slider_left = 0.07;
  slider_width = 0.31;
  slider_frame_voffset = 0.02;
  biasslide = uicontrol(fig, ...
    'Style', 'slider', ...
    'Units', 'normalized', ...
    'Value', bias, ...
    'BackgroundColor', [0.8 0.8 0.8], ...
    'Position', [slider_left bottom_row+slider_frame_voffset ...
      slider_width 0.05], ...
    'Min', biasminval, 'Max', biasmaxval, ...
    'Callback', 'demprgp update');
  
  % Slider
  noiseslide = uicontrol(fig, ...
    'Style', 'slider', ...
    'Units', 'normalized', ...
    'Value', noise, ...
    'BackgroundColor', [0.8 0.8 0.8], ...
    'Position', [slider_left noise_frame_bottom+slider_frame_voffset ...
      slider_width 0.05], ...
    'Min', noiseminval, 'Max', noisemaxval, ...
    'Callback', 'demprgp update');
  
  % Slider
  inweightsslide = uicontrol(fig, ...
    'Style', 'slider', ...
    'Units', 'normalized', ...
    'Value', inweights, ...
    'BackgroundColor', [0.8 0.8 0.8], ...
    'Position', [slider_left inw_frame_bottom+slider_frame_voffset ...
      slider_width 0.05], ...
    'Min', inwminval, 'Max', inwmaxval, ...
    'Callback', 'demprgp update');
  
  % Slider
  fparslide = uicontrol(fig, ...
    'Style', 'slider', ...
    'Units', 'normalized', ...
    'Value', fpar, ...
    'BackgroundColor', [0.8 0.8 0.8], ...
    'Position', [slider_left fpar_frame_bottom+slider_frame_height+ ...
       slider_frame_voffset slider_width 0.05], ...
    'Min', fparminval, 'Max', fparmaxval, ...
    'Callback', 'demprgp update');
 
 fpar2slide = uicontrol(fig, ...
    'Style', 'slider', ...
    'Units', 'normalized', ...
    'Value', fpar2, ...
    'BackgroundColor', [0.8 0.8 0.8], ...
    'Position', [slider_left fpar_frame_bottom+slider_frame_voffset ...
       slider_width 0.05], ...
    'Min', fparminval, 'Max', fparmaxval, ...
    'Callback', 'demprgp update', ...
    'Tag', 'fpar2slider', ...
    'Enable', 'off');
  
  % Text display of hyper-parameter values
  
  format = '%8f';

  hp_left = 0.20;
  hp_width = 0.17;
  biasval = uicontrol(fig, ...
    'Style', 'edit', ...
    'Units', 'normalized', ...
    'Position', [hp_left bottom_row+slider_text_voffset ...
      hp_width slider_text_height], ...
    'String', sprintf(format, bias), ...
    'Callback', 'demprgp newval');
  
  noiseval = uicontrol(fig, ...
    'Style', 'edit', ...
    'Units', 'normalized', ...
    'Position', [hp_left noise_frame_bottom+slider_text_voffset ...
      hp_width slider_text_height], ...
    'String', sprintf(format, noise), ...
    'Callback', 'demprgp newval');
  
  inweightsval = uicontrol(fig, ...
    'Style', 'edit', ...
    'Units', 'normalized', ...
    'Position', [hp_left inw_frame_bottom+slider_text_voffset ...
      hp_width slider_text_height], ...
    'String', sprintf(format, inweights), ...
    'Callback', 'demprgp newval');
  
  fparval = uicontrol(fig, ...
    'Style', 'edit', ...
    'Units', 'normalized', ...
    'Position', [hp_left fpar_frame_bottom+slider_frame_height+ ...
       slider_text_voffset hp_width slider_text_height], ...
    'String', sprintf(format, fpar), ...
    'Callback', 'demprgp newval');
 
  fpar2val = uicontrol(fig, ...
    'Style', 'edit', ...
    'Units', 'normalized', ...
    'Position', [hp_left fpar_frame_bottom+slider_text_voffset ...
       hp_width slider_text_height], ...
    'String', sprintf(format, fpar), ...
    'Callback', 'demprgp newval', ...
    'Enable', 'off', ...
    'Tag', 'fpar2val');
   
  
  % The graph box
  haxes = axes('Position', [0.5 0.28 0.45 0.45], ...
    'Units', 'normalized', ...
    'Visible', 'on');

  % The SAMPLE button
  uicontrol(fig, ...
    'Style','push', ...

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -