亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? hmc.m

?? this is also good for learning SVM algorithm
?? M
字號(hào):
function [samples, energies, diagn] = hmc(f, x, options, gradf, varargin)%HMC	Hybrid Monte Carlo sampling.%%	Description%	SAMPLES = HMC(F, X, OPTIONS, GRADF) uses a  hybrid Monte Carlo%	algorithm to sample from the distribution P ~ EXP(-F), where F is the%	first argument to HMC. The Markov chain starts at the point X, and%	the function GRADF is the gradient of the `energy' function F.%%	HMC(F, X, OPTIONS, GRADF, P1, P2, ...) allows additional arguments to%	be passed to F() and GRADF().%%	[SAMPLES, ENERGIES, DIAGN] = HMC(F, X, OPTIONS, GRADF) also returns a%	log of the energy values (i.e. negative log probabilities) for the%	samples in ENERGIES and DIAGN, a structure containing diagnostic%	information (position, momentum and acceptance threshold) for each%	step of the chain in DIAGN.POS, DIAGN.MOM and DIAGN.ACC respectively.%	All candidate states (including rejected ones) are stored in%	DIAGN.POS.%%	[SAMPLES, ENERGIES, DIAGN] = HMC(F, X, OPTIONS, GRADF) also returns%	the ENERGIES (i.e. negative log probabilities) corresponding to the%	samples.  The DIAGN structure contains three fields:%%	POS the position vectors of the dynamic process.%%	MOM the momentum vectors of the dynamic process.%%	ACC the acceptance thresholds.%%	S = HMC('STATE') returns a state structure that contains the state of%	the two random number generators RAND and RANDN and the momentum of%	the dynamic process.  These are contained in fields  randstate,%	randnstate and mom respectively.  The momentum state is only used for%	a persistent momentum update.%%	HMC('STATE', S) resets the state to S.  If S is an integer, then it%	is passed to RAND and RANDN and the momentum variable is randomised.%	If S is a structure returned by HMC('STATE') then it resets the%	generator to exactly the same state.%%	The optional parameters in the OPTIONS vector have the following%	interpretations.%%	OPTIONS(1) is set to 1 to display the energy values and rejection%	threshold at each step of the Markov chain. If the value is 2, then%	the position vectors at each step are also displayed.%%	OPTIONS(5) is set to 1 if momentum persistence is used; default 0,%	for complete replacement of momentum variables.%%	OPTIONS(7) defines the trajectory length (i.e. the number of leap-%	frog steps at each iteration).  Minimum value 1.%%	OPTIONS(9) is set to 1 to check the user defined gradient function.%%	OPTIONS(14) is the number of samples retained from the Markov chain;%	default 100.%%	OPTIONS(15) is the number of samples omitted from the start of the%	chain; default 0.%%	OPTIONS(17) defines the momentum used when a persistent update of%	(leap-frog) momentum is used.  This is bounded to the interval [0,%	1).%%	OPTIONS(18) is the step size used in leap-frogs; default 1/trajectory%	length.%%	See also%	METROP%%	Copyright (c) Ian T Nabney (1996-2001)% Global variable to store state of momentum variables: set by set_state% Used to initialise variable if setglobal HMC_MOMif nargin <= 2  if ~strcmp(f, 'state')    error('Unknown argument to hmc');  end  switch nargin    case 1      samples = get_state(f);      return;    case 2      set_state(f, x);      return;  endenddisplay = options(1);if (round(options(5) == 1))  persistence = 1;  % Set alpha to lie in [0, 1)  alpha = max(0, options(17));  alpha = min(1, alpha);  salpha = sqrt(1-alpha*alpha);else  persistence = 0;endL = max(1, options(7)); % At least one step in leap-froggingif options(14) > 0  nsamples = options(14);else  nsamples = 100;	% Defaultendif options(15) >= 0  nomit = options(15);else  nomit = 0;endif options(18) > 0  step_size = options(18);	% Step size.else  step_size = 1/L;		% Default  endx = x(:)';		% Force x to be a row vectornparams = length(x);% Set up strings for evaluating potential function and its gradient.f = fcnchk(f, length(varargin));gradf = fcnchk(gradf, length(varargin));% Check the gradient evaluation.if (options(9))  % Check gradients  feval('gradchek', x, f, gradf, varargin{:});endsamples = zeros(nsamples, nparams);	% Matrix of returned samples.if nargout >= 2  en_save = 1;  energies = zeros(nsamples, 1);else  en_save = 0;endif nargout >= 3  diagnostics = 1;  diagn_pos = zeros(nsamples, nparams);  diagn_mom = zeros(nsamples, nparams);  diagn_acc = zeros(nsamples, 1);else  diagnostics = 0;endn = - nomit + 1;Eold = feval(f, x, varargin{:});	% Evaluate starting energy.nreject = 0;if (~persistence | isempty(HMC_MOM))  p = randn(1, nparams);		% Initialise momenta at randomelse  p = HMC_MOM;				% Initialise momenta from stored stateendlambda = 1;% Main loop.while n <= nsamples  xold = x;		    % Store starting position.  pold = p;		    % Store starting momenta  Hold = Eold + 0.5*(p*p'); % Recalculate Hamiltonian as momenta have changed  if ~persistence    % Choose a direction at random    if (rand < 0.5)      lambda = -1;    else      lambda = 1;    end  end  % Perturb step length.  epsilon = lambda*step_size*(1.0 + 0.1*randn(1));  % First half-step of leapfrog.  p = p - 0.5*epsilon*feval(gradf, x, varargin{:});  x = x + epsilon*p;    % Full leapfrog steps.  for m = 1 : L - 1    p = p - epsilon*feval(gradf, x, varargin{:});    x = x + epsilon*p;  end  % Final half-step of leapfrog.  p = p - 0.5*epsilon*feval(gradf, x, varargin{:});  % Now apply Metropolis algorithm.  Enew = feval(f, x, varargin{:});	% Evaluate new energy.  p = -p;				% Negate momentum  Hnew = Enew + 0.5*p*p';		% Evaluate new Hamiltonian.  a = exp(Hold - Hnew);			% Acceptance threshold.  if (diagnostics & n > 0)    diagn_pos(n,:) = x;    diagn_mom(n,:) = p;    diagn_acc(n,:) = a;  end  if (display > 1)    fprintf(1, 'New position is\n');    disp(x);  end  if a > rand(1)			% Accept the new state.    Eold = Enew;			% Update energy    if (display > 0)      fprintf(1, 'Finished step %4d  Threshold: %g\n', n, a);    end  else					% Reject the new state.    if n > 0       nreject = nreject + 1;    end    x = xold;				% Reset position     p = pold;   			% Reset momenta    if (display > 0)      fprintf(1, '  Sample rejected %4d.  Threshold: %g\n', n, a);    end  end  if n > 0    samples(n,:) = x;			% Store sample.    if en_save       energies(n) = Eold;		% Store energy.    end  end  % Set momenta for next iteration  if persistence    p = -p;    % Adjust momenta by a small random amount.    p = alpha.*p + salpha.*randn(1, nparams);  else    p = randn(1, nparams);	% Replace all momenta.  end  n = n + 1;endif (display > 0)  fprintf(1, '\nFraction of samples rejected:  %g\n', ...    nreject/(nsamples));endif diagnostics  diagn.pos = diagn_pos;  diagn.mom = diagn_mom;  diagn.acc = diagn_acc;end% Store final momentum value in global so that it can be retrieved laterHMC_MOM = p;return% Return complete state of sampler (including momentum)function state = get_state(f)global HMC_MOMstate.randstate = rand('state');state.randnstate = randn('state');state.mom = HMC_MOM;return% Set complete state of sampler (including momentum) or just set randn% and rand with integer argument.function set_state(f, x)global HMC_MOMif isnumeric(x)  rand('state', x);  randn('state', x);  HMC_MOM = [];else  if ~isstruct(x)    error('Second argument to hmc must be number or state structure');  end  if (~isfield(x, 'randstate') | ~isfield(x, 'randnstate') ...      | ~isfield(x, 'mom'))    error('Second argument to hmc must contain correct fields')  end  rand('state', x.randstate);  randn('state', x.randnstate);  HMC_MOM = x.mom;endreturn

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
免费精品99久久国产综合精品| 国产在线不卡一卡二卡三卡四卡| 欧美videos大乳护士334| 97久久精品人人澡人人爽| 青青草国产精品97视觉盛宴| 中文字幕一区二| 日韩美女视频一区二区在线观看| 色婷婷av一区二区三区gif| 国内久久精品视频| 福利电影一区二区三区| 亚洲高清三级视频| 国产精品国产自产拍高清av王其 | 欧美久久一区二区| 粉嫩一区二区三区在线看| 欧美aaaaaa午夜精品| 一区二区成人在线观看| 欧美极品少妇xxxxⅹ高跟鞋| 日韩一级大片在线| 精品视频在线免费看| 色又黄又爽网站www久久| 国产激情一区二区三区桃花岛亚洲| 视频在线观看一区| 亚洲一区欧美一区| 亚洲免费av观看| 18欧美乱大交hd1984| 久久精品一区二区三区不卡| 日韩午夜在线观看视频| 91精品国产综合久久久久久久久久| 91免费国产视频网站| 粉嫩嫩av羞羞动漫久久久| 国产在线观看一区二区| 精品亚洲porn| 91精品国产综合久久福利软件| 一本一道综合狠狠老| 91在线丨porny丨国产| 国产不卡视频在线播放| 国产一区二区在线视频| 国内精品视频666| 久久成人综合网| 国产自产视频一区二区三区| 精品一区二区三区视频在线观看 | 色综合天天综合在线视频| 处破女av一区二区| 成人免费电影视频| 成人永久aaa| 91在线视频官网| 色av综合在线| 精品1区2区3区| 91精品国产黑色紧身裤美女| 日韩欧美三级在线| 精品国产一区久久| 国产日韩精品一区二区浪潮av| 国产日韩欧美综合一区| 国产精品福利一区二区| 亚洲六月丁香色婷婷综合久久| 一区二区在线观看免费| 亚洲午夜精品一区二区三区他趣| 亚洲第一电影网| 美国十次综合导航| 国产凹凸在线观看一区二区| 成人黄页毛片网站| 日本韩国欧美在线| 欧美一级一级性生活免费录像| 日韩欧美激情四射| 国产日韩欧美综合一区| 亚洲免费在线视频| 免费在线观看视频一区| 国产一二精品视频| 91小视频免费观看| 日韩一区国产二区欧美三区| 久久久久国产成人精品亚洲午夜| 国产精品久久久久aaaa| 一区二区三区四区激情| 日本视频一区二区| 成人午夜在线播放| 欧美视频在线观看一区二区| 欧美xxxxxxxx| 亚洲欧美日韩在线播放| 久久精品国产亚洲5555| 不卡视频免费播放| 欧美一级理论性理论a| 欧美韩国日本综合| 亚洲电影第三页| 国产精品伊人色| 色综合 综合色| 精品美女一区二区| 亚洲码国产岛国毛片在线| 奇米在线7777在线精品| 成人app下载| 日韩欧美一区二区三区在线| 亚洲天堂成人在线观看| 国内精品国产成人国产三级粉色 | 久久久久久久久久久久电影| 夜夜爽夜夜爽精品视频| 国产成人在线视频网站| 在线电影一区二区三区| 国产精品国模大尺度视频| 美女视频免费一区| 91国在线观看| 中文字幕va一区二区三区| 日本三级韩国三级欧美三级| 一本一道久久a久久精品| 久久色在线视频| 丝袜诱惑亚洲看片| 色欧美日韩亚洲| 国产欧美日韩另类视频免费观看| 日本v片在线高清不卡在线观看| 91视频国产观看| 中文无字幕一区二区三区| 免费欧美在线视频| 欧美日韩卡一卡二| 亚洲日本中文字幕区| 粉嫩av一区二区三区| 精品国产91乱码一区二区三区| 亚洲高清在线视频| 色综合久久久网| 国产精品色婷婷| 国产一区二区精品久久91| 日韩欧美中文字幕精品| 亚洲成人综合在线| 色婷婷综合五月| 亚洲免费观看高清完整版在线| 成人黄色在线看| 国产精品女同互慰在线看| 国产成人在线影院| 久久亚洲影视婷婷| 国产在线播放一区三区四| 欧美一级黄色大片| 日本aⅴ免费视频一区二区三区 | 精品久久久久一区二区国产| 天堂影院一区二区| 欧美高清视频一二三区| 亚洲国产一区二区三区青草影视| 色狠狠综合天天综合综合| 亚洲乱码国产乱码精品精98午夜 | 欧美精品一区二区不卡| 麻豆国产精品官网| 欧美成人高清电影在线| 毛片av一区二区| 久久理论电影网| 成人综合婷婷国产精品久久蜜臀| 欧美国产日韩a欧美在线观看| 福利一区二区在线| 亚洲天堂福利av| 日本高清免费不卡视频| 一级特黄大欧美久久久| 欧美日韩三级视频| 丝袜诱惑制服诱惑色一区在线观看| 欧美日韩高清一区二区三区| 婷婷一区二区三区| 精品国内片67194| 国产成人在线观看免费网站| 国产精品国产a| 在线观看日韩av先锋影音电影院| 亚洲综合丁香婷婷六月香| 欧美日韩精品是欧美日韩精品| 日本成人在线一区| 久久久久久久久97黄色工厂| 成人av在线一区二区三区| 亚洲免费成人av| 日韩一区二区三区观看| 国产精品一品二品| 亚洲激情成人在线| 欧美一卡二卡三卡四卡| 国产成人午夜99999| 亚洲激情在线播放| 91精品国产综合久久福利软件| 国产一区二区在线观看免费| 亚洲欧洲在线观看av| 欧美久久久影院| 国产精品小仙女| 亚洲美女一区二区三区| 日韩精品一区二区三区视频 | 91理论电影在线观看| 日韩精品色哟哟| 国产精品视频一二| 欧美日韩国产精品成人| 国产精品一区二区91| 亚洲国产欧美在线| 2024国产精品| 在线免费亚洲电影| 激情文学综合丁香| 一级特黄大欧美久久久| 久久免费看少妇高潮| 在线视频观看一区| 国产精品综合在线视频| 一个色妞综合视频在线观看| 久久久久国产精品人| 欧美二区乱c少妇| 成人毛片视频在线观看| 日韩1区2区3区| 一区二区三区在线免费| 国产欧美一二三区| 日韩一区二区三| 在线欧美一区二区| 99久久精品国产观看| 国产美女精品在线| 日韩电影免费在线| 亚洲精品乱码久久久久久日本蜜臀| 精品久久99ma|