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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? pca_diag.m

?? Matlab package for PCA for datasets with missing values
?? M
字號:
%  PCA_DIAG - PCA with fully factorial Gaussian posterior%%  PCA with fully factorial Gaussian pdf (diagonal covariance matrix)%  for approximating the posterior distributions of A and S in the%  model X(:,j) = Mu + A*S(:,j) + Noise. The noise is isotropic and%  Gaussian with the variance V.%%  [ A, S, Mu, V, CV, HP, LC ] = PCA_DIAG( X, N ) identifies the model%  for the given data matrix X and number of principal components N.%  Matrix X can be either sparse with only observed values included%  (note that observed zeros should be replaced with eps) or a full%  matrix with missing values replaced by NaNs.%%  The function returns the mean values of the model parameters in A,%  S, Mu, and V. The posterior variances are stored in CV such that%  CV.A(i,k) is the posterior variance of A(i,k) and CV.S(k,j) is the%  same for S(k,j). HP contains point estimates of the%  hyperparameters: HP.Va is the prior variance for A(:,k) and HP.Vmu%  is the same for Mu.%  %  LC is a structure with learning curves (rms training and probing%  errors, cost function values, time).%%  PCA_DIAG( X, N, 'algorithm', name ) specifies the algorithm:%   'ppca': Probabilistic PCA (no prior and point estimates for A, Mu)%   'map':  Prior on A(:,k) and Mu, point estimates for A(i,:) and Mu%   'vb':   Variational Bayesian PCA (prior on A and Mu, Gaussian%           posterior approximation for A(i,:) and Mu) {default}%  %  Other optional parameter/value pairs with {default values}:%   init       - Initialization type ({'random'} - random,%                filename: load from file, structure: from given data)%   gradient_type - Type of the gradient procedure used ('standard' for%                gradient descent, {'alpha'} for modified Newton)%   maxiters   - Maximum number of iterations {1000}%   numcpu     - Number of CPUs for parallel computing (only for%                sparse data sets)%   minangle   - Termination by minimum angle between subspaces%                defined by A {1e-8}%   rmsstop    - Termination by rms training error ([] - no rms stop)%                {[ 100 1e-4 1e-3 ]}: 100 iterations, 1e-4 absolute%                tolerance, 1e-3 relative tolerance,%   cfstop     - Termination by cost function value {[]} (similarly to%                rmsstop). The cost function is computed only if this%                option is nonempty%   xprobe     - Validation data set (of the same dimensions as X)%   earlystop  - Whether to use early stopping based on probing error%   verbose    - Progress information display level (0,{1},2)%   display    - Plot progress {0}%   autosave   - Auto-save after each {3600} seconds%   savebest     Whether to save the model with the best probing error%   filename   - Name of the file for auto-save {'pca_d_autosave'}%%  OUT = PCA_DIAG( X, N ) returns all the outputs in a single%  structure variable OUT. Learning can be continued as follows:%    out = pca_diag( X, N );%    [ A, S, Mu, V, CV, HP, LC ] = pca_diag( X, N, 'init', out );%  This software is provided "as is", without warranty of any kind.%  Alexander Ilin, Tapani Raikofunction [ A, S, Mu, V, cv, hp, lc ] = pca_diag( X, ncomp, varargin )% Default parameter valuesdefopts = struct( ...    'gradient_type', 'alpha',...    'init',          'random',...    'minangle',      1e-8,...    'maxiters',      inf,...    'algorithm',     'vb',...    'earlystop',     0,...    'rmsstop',       [],... % [] means no cost stop criteria    'cfstop',        [ 100 1e-4 1e-3 ],... % [] means no cost stop criteria    'verbose',       1,...    'bias',          1,...    'autosave',      3600,...    'savebest',      0,...   % Save A and S with the best prms    'xprobe',        [],...    'filename',      'pca_d_autosave',...    'numcpu',        1,...    'display',       0 );[ opts, errmsg, wrnmsg ] = argschk( defopts, varargin{:} );if ~isempty(errmsg), error( errmsg ), endif ~isempty(wrnmsg), warning( wrnmsg ), endXprobe = opts.xprobe;switch opts.algorithmcase 'ppca'    use_prior = 0;    use_postervar = 1;case 'map'    use_prior = 1;    use_postervar = 0;case 'vb'    use_prior = 1;    use_postervar = 1;end[n1x,n2x] = size(X);[ X, Xprobe, Ir, Ic, opts.init ] = rmempty( X, Xprobe,...                                            opts.init, opts.verbose );[n1,n2] = size(X);if issparse(X)    % X is a sparse matrix with only observed values    M = spones(X);    Mprobe = spones(Xprobe);else    % Missing values are marked as NaNs    M = ~isnan(X);    Mprobe = ~isnan(Xprobe);    X(X==0) = eps;    Xprobe(Xprobe==0) = eps;    X(isnan(X)) = 0;  Xprobe(isnan(Xprobe)) = 0;    endNobs_i = sum(M,2);ndata = sum(Nobs_i);nprobe = nnz(Mprobe);if nprobe == 0    Xprobe = [];    opts.earlystop = 0;    if opts.savebest        fprintf( 'No test data given for saving the best prms solution.\n' );        opts.savebest = 0;    endend[ AA, SS, Mu, V, Av, Sv, Muv ] = InitParms( opts.init, n1, n2, ncomp );if isempty(Mu)    if opts.bias        Mu = sum(X,2) ./ Nobs_i;    else        Mu = zeros(n1,1);    endend[X,Xprobe] = SubtractMu( Mu, X, M, Xprobe, Mprobe, opts.bias );cur = 1; new = 2;lrate = 1; lrateA = 1; lrateS = 1;alpha = 2/3;prms = compute_rms( Xprobe, AA{cur}, SS{cur}, Mprobe, nprobe );if ~use_postervar    % MAP estimation for Mu and A    Muv = [];    Av = [];    sumAv = 0;endsumSv = full( Sv * M' )'/V;% Parameters of the prior for variance parametershpVa = 0.001; hpVb = 0.001; hpV = 0.001;if use_prior    Va = ones(1,ncomp); Vmu = 1;else    Va = repmat(inf,1,ncomp);  Vmu = inf;endtime_start = clock;time_autosave = time_start;sd_iter = 0;best.prms = inf;ticlc.time = 0;for iter = 1:opts.maxiters    % Update Va, Vmu    if use_prior && iter > 10        if ~use_postervar            Va = sum( AA{cur}.^2, 1 );            Vmu = sum( Mu.^2 );        else            Va = sum( AA{cur}.^2 + Av, 1 );            Vmu = sum( Mu.^2 + Muv );        end        Va = (Va + 2*hpVa) / (n1 + 2*hpVb);        Vmu = (Vmu + 2*hpVa) / (n1 + 2*hpVb);    end    if opts.bias && iter > 1        dMu = full( sum(errMx,2) ./ Nobs_i );        if use_postervar            Muv = V ./ ( Nobs_i + V/Vmu );        end        th = 1 ./ ( 1 + V./Nobs_i/Vmu );   %th = Muv .* Nobs_i / V;        Mu_old = Mu;        Mu = th.*( Mu + dMu );        dMu = Mu - Mu_old;        [X,Xprobe] = SubtractMu( dMu, X, M, Xprobe, Mprobe, 1 );    end    if use_postervar || ~strcmpi(opts.gradient_type,'standard')        Av = ( repmat(1./Va,n1,1) + sumSv + ...               full( SS{cur}.^2 * M' )'/V ).^(-1);        sumAv = full( (Av/V)' * M );    end            Sv = ( 1 + sumAv + full( ((AA{cur}.^2)/V)' * M ) ).^(-1);    sumSv = full( Sv * M' )'/V;    if ~use_postervar        [cost_old,errMx,rms] = ...            cf_diag( X, AA{cur}, SS{cur}, Mu, V, [], Sv, [], Va, Vmu, M,...            Nobs_i, ndata, opts.numcpu );            else        [cost_old,errMx,rms] = ...            cf_diag( X, AA{cur}, SS{cur}, Mu, V, Av, Sv, Muv, Va, Vmu, M,...                    Nobs_i, ndata, opts.numcpu );    end        if iter == 1        lc.rms = rms; lc.prms = prms; lc.cost = cost_old;        if opts.verbose            fprintf( 'Step 0: cost=%.6e, rms=%.6f\n', cost_old, rms )        end    end    % Update A, S    switch opts.gradient_type    case 'standard'        AA{new} = AA{cur} + ...                  ( full( SS{cur} * errMx' )'/V - ...                    AA{cur} .* sumSv - ...                    AA{cur}.* repmat(1./Va,n1,1) ) ...                  * lrateA;                SS{new} = SS{cur} + ...                  full( ((lrateS/V) * AA{cur}') * errMx ) -...                  SS{cur} .* sumAv * lrateS - ...                  SS{cur} * lrateS;            case 'alpha'        AA{new} = AA{cur} + Av.^alpha .* ...                  ( full( SS{cur} * errMx' )'/V - ...                    AA{cur} .* sumSv - ...                    AA{cur} .* repmat(1./Va,n1,1) ) ...                  * lrateA;                SS{new} = SS{cur} + Sv.^alpha .* ...                  (full( ((lrateS/V) * AA{cur}') * errMx ) - ...                   SS{cur} .* sumAv * lrateS - ...                   SS{cur} * lrateS);        if ~use_postervar            Av = [];        end    end        [cost,errMx,rms,vN] = cf_diag( ...        X, AA{new}, SS{new}, Mu, V,  Av, Sv, Muv, Va, Vmu, M,...        Nobs_i, ndata, opts.numcpu );        if cost < cost_old        lrate = lrate * 1.1;        lrateA = lrateA * 1.1;        lrateS = lrateS * 1.1;    else        if opts.verbose            fprintf('Slowing down (%e) ', cost_old-cost );        end        sd_iter = 0;        while cost > cost_old && sd_iter < 40            if opts.verbose, fprintf('.'); end            lrate = lrate * 0.5;            lrateA = lrateA * 0.5;            lrateS = lrateS * 0.5;            AA{new} = (AA{new}+AA{cur})/2;            SS{new} = (SS{new}+SS{cur})/2;                        [cost,errMx,rms,vN] = cf_diag( ...                X, AA{new}, SS{new}, Mu, V, Av, Sv, Muv, Va, Vmu, M,...                Nobs_i, ndata, opts.numcpu );            sd_iter = sd_iter + 1;        end        if opts.verbose, fprintf(' ok\n'); end    end        prms = compute_rms( Xprobe, AA{new}, SS{new}, Mprobe, nprobe );    % Update V    %V = vN/ndata;    V = ( vN + 2*hpV ) / (ndata + 2*hpV);        t = toc;    lc.rms = [ lc.rms rms ]; lc.prms = [ lc.prms prms ];    lc.cost = [ lc.cost cost ]; lc.time = [ lc.time t ];    if opts.savebest && lc.prms(end) < best.prms        best.A = AA{new}; best.S = SS{new}; best.Mu = Mu;        best.V = V; best.rms = rms; best.prms = prms;    end        %DisplayProgress( dsph, lc )    angleA = subspace(AA{new},AA{cur});    PrintStep( opts.verbose, lc, angleA )    convmsg = converg_check( opts, lc, angleA, sd_iter );    if ~isempty(convmsg)        if opts.verbose, fprintf( '%s', convmsg ), end        break    end    time = clock;    if etime(time,time_autosave) > opts.autosave        if opts.verbose==2, fprintf( 'Saving ... ' ), end        time_autosave = time;        A = AA{new}; S = SS{new};        save( opts.filename,...              'A', 'S', 'Mu', 'Av', 'Muv', 'V', 'Va', 'Vmu', 'Sv',...              'lc', 'Ir', 'Ic', 'n1x', 'n2x', 'n1', 'n2' )        clear A S        if opts.savebest            save( opts.filename, 'best', '-append' )        end        if opts.verbose==2, fprintf( 'done\n' ), end    end    if cur == 1,  cur = 2; new = 1;    else          cur = 1; new = 2;    endendA = AA{cur};S = SS{cur};if n1 < n1x    [ A, Av ] = addmrows( A, Av, Ir, n1x, Va );    [ Mu, Muv ] = addmrows( Mu, Muv, Ir, n1x, Vmu );endif n2 < n2x    [ S, Sv ] = addmcols( S, Sv, Ic, n2x );endif nargout == 1    A = struct( 'A', A );    A.S = S;    A.Mu = Mu;    A.V = V;    A.Va = Va;    A.Vmu = Vmu;    A.Av = Av;    A.Sv = Sv;    A.Muv = Muv;    A.lc = lc;else    cv.A = Av;    cv.S = Sv;    cv.Mu = Muv;    hp.Va = Va;    hp.Vmu = Vmu;end%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%function [X,Xprobe] = SubtractMu( Mu, X, M, Xprobe, Mprobe, update_bias )n2 = size(X,2);if ~update_bias    returnend   if issparse(X)    X = subtract_mu( X, Mu );    if ~isempty(Xprobe)        Xprobe = subtract_mu( Xprobe, Mu );    endelse    X = X - repmat(Mu,1,n2).*M;    if ~isempty(Xprobe)        Xprobe = Xprobe - repmat( Mu, 1, n2 ).*Mprobe;    endend%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%function [ AA, SS, Mu, V, Av, Sv, Muv ] = InitParms( init, n1, n2, ncomp )AA = cell(2,1);SS = cell(2,1);cur = 1; new = 2;if ischar(init) && strcmpi( init, 'random' )    init = struct([]);endif isstruct(init)    if isfield( init, 'A' )        AA{cur} = init.A;    else        AA{cur} = orth(randn(n1,ncomp));    end    if isfield( init, 'Av' )        Av = init.Av;    else        Av = ones(n1,ncomp);    end    if isfield( init, 'Mu' )        Mu = init.Mu;    else        Mu = [];    end    if isfield( init, 'Muv' )        Muv = init.Muv;    else        Muv = ones(n1,1);    end    if isfield( init, 'V' )        V = init.V;    else        V = 1;    end        if isfield( init, 'S' )        SS{cur} = init.S;    else        SS{cur} = randn(ncomp,n2);    end    % TODO: if init.Isv exists    if isfield( init, 'Sv' )        if iscell(init.Sv)            Sv = zeros(ncomp,n2);            for j = 1:n2                Sv(:,j) = diag(init.Sv{j});            end        else            Sv = init.Sv;        end    else        Sv = ones(ncomp,n2);    endend%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%function PrintStep( verbose, lc, Aangle )if ~verbose    returnenditer = length(lc.rms)-1;steptime = lc.time(end)-lc.time(end-1);if ~isnan(lc.prms(end))    fprintf( ...        'Step %i: cost=%.6e, rms=%.6f (%.6f), angle=%.2e (%d sec)\n', ...        iter, lc.cost(end), lc.rms(end), lc.prms(end),...        Aangle, round(steptime) )else        fprintf( ...        'Step %i: cost=%.6e, rms=%.6f, angle=%.2e (%d sec)\n', ...             iter, lc.cost(end), lc.rms(end), Aangle, round(steptime) )end

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人日日夜夜| 国产精品一区免费视频| 成人国产视频在线观看| 3751色影院一区二区三区| 亚洲欧洲日韩综合一区二区| 精品无人码麻豆乱码1区2区 | 国产成人日日夜夜| 国产精品国产三级国产a| 国产一区二区三区四| 奇米888四色在线精品| 日本久久一区二区| 一区二区中文字幕在线| 欧美在线观看一区| 亚洲欧洲综合另类| 不卡的av电影在线观看| 亚洲综合清纯丝袜自拍| 色哟哟在线观看一区二区三区| 中文字幕免费不卡| 国产精品性做久久久久久| 1024精品合集| 欧美日韩成人一区| 亚洲大尺度视频在线观看| 色先锋aa成人| 免费黄网站欧美| 欧美国产精品一区| 欧美性高清videossexo| 亚洲五码中文字幕| 欧美日韩情趣电影| 亚洲国产精品久久不卡毛片| 日韩欧美二区三区| 日韩欧美一区中文| 蜜臀av在线播放一区二区三区| 欧美一级片在线| 九九国产精品视频| 亚洲女爱视频在线| 欧美xfplay| 国产精品一卡二| 亚洲国产综合人成综合网站| 欧美精品一区二区三区蜜桃视频| 激情欧美一区二区三区在线观看| 久久婷婷色综合| 成人免费不卡视频| 亚洲精品乱码久久久久久久久 | 国产福利精品一区二区| 亚洲综合一区二区三区| 精品国产乱码久久久久久久| 91久久精品网| 国产精品一区二区x88av| 亚洲国产欧美在线人成| 国内外精品视频| 亚洲一区二区三区精品在线| 久久久www成人免费无遮挡大片| 九九精品视频在线看| 亚洲蜜臀av乱码久久精品| 精品国产一区二区国模嫣然| 91搞黄在线观看| 国产成人免费网站| 日韩av电影一区| 久久精品亚洲国产奇米99| 成人激情免费电影网址| 日本欧美一区二区| 一区二区不卡在线播放| 日韩一区二区三区视频| 在线观看亚洲精品| 成人午夜视频福利| 日本伊人午夜精品| 一区二区三区国产精华| 国产精品毛片久久久久久| 色婷婷av久久久久久久| 国产成人精品综合在线观看 | 韩国成人在线视频| 日韩一区精品视频| 久久精品无码一区二区三区| 欧美一卡二卡在线| 欧美调教femdomvk| 91亚洲精品久久久蜜桃| 免费观看在线综合色| 一区二区国产盗摄色噜噜| 国产精品国产馆在线真实露脸 | 日韩一区二区免费电影| 在线影视一区二区三区| 国产精品综合在线视频| 日韩av在线播放中文字幕| 亚洲国产日日夜夜| 亚洲激情第一区| 亚洲三级在线播放| 日韩一区二区三区在线视频| 欧美日韩亚州综合| 在线观看国产精品网站| 91蜜桃传媒精品久久久一区二区| 丁香六月久久综合狠狠色| 久久电影网站中文字幕| 91精品福利视频| 成人av在线观| 东方aⅴ免费观看久久av| 香港成人在线视频| 一区二区三区高清| 亚洲免费av高清| 亚洲欧美日韩在线不卡| 亚洲色图丝袜美腿| 亚洲色图19p| 亚洲精品日日夜夜| 亚洲精品高清在线| 一区二区免费看| 一区二区三区在线观看欧美| 亚洲精品乱码久久久久久久久 | 国产一区二区免费在线| 国产资源在线一区| 国产精品自拍三区| 国产一区二区三区| 国产成人免费高清| thepron国产精品| 激情综合网激情| 国产永久精品大片wwwapp| 国产精品一区二区视频| 国产盗摄女厕一区二区三区| 中文字幕免费观看一区| 国产精品久久久久一区| 亚洲三级免费观看| 夜夜嗨av一区二区三区四季av| 亚洲码国产岛国毛片在线| 一区二区三区精品久久久| 亚洲韩国一区二区三区| 男男gaygay亚洲| 精品亚洲aⅴ乱码一区二区三区| 国内精品国产成人国产三级粉色| 国产福利一区在线| 91丨porny丨最新| 欧美性高清videossexo| 7777精品伊人久久久大香线蕉经典版下载| 777欧美精品| 精品国产一区二区三区忘忧草| 欧美精彩视频一区二区三区| 精品成人在线观看| 中文字幕乱码久久午夜不卡| 亚洲色图19p| 日韩精品电影在线观看| 精品一区二区三区香蕉蜜桃| 国产成人在线观看| 在线免费视频一区二区| 正在播放一区二区| 久久久久国产精品免费免费搜索| 国产精品区一区二区三| 一区二区三区在线视频观看| 日本亚洲电影天堂| 国产精品77777| 在线免费观看日本一区| 日韩欧美色电影| 国产精品免费av| 欧美精品99久久久**| 欧美群妇大交群的观看方式| 精品国产1区二区| 亚洲欧美在线另类| 日韩精品视频网| 成人一二三区视频| 欧美日韩在线免费视频| 久久免费美女视频| 一区二区三区不卡在线观看 | 蜜臀av性久久久久av蜜臀妖精| 国产成人自拍网| 欧美视频一二三区| 久久久噜噜噜久久中文字幕色伊伊| 中文字幕亚洲综合久久菠萝蜜| 日韩在线观看一区二区| 成人做爰69片免费看网站| 欧美日韩精品专区| 国产香蕉久久精品综合网| 亚洲综合视频网| 国产精品69毛片高清亚洲| 欧美日韩三级一区二区| 国产亚洲污的网站| 天天综合网 天天综合色| 日本va欧美va精品发布| 99久久国产综合精品麻豆| 色天天综合色天天久久| 26uuu久久天堂性欧美| 一区二区三区在线高清| 国产精品综合一区二区| 五月天网站亚洲| 波多野结衣中文字幕一区| 91精品麻豆日日躁夜夜躁| 中文字幕亚洲不卡| 国内偷窥港台综合视频在线播放| 日本电影亚洲天堂一区| 国产亚洲美州欧州综合国| 日韩在线a电影| 一本大道久久a久久综合| 国产亚洲一区字幕| 青青草视频一区| 色婷婷久久99综合精品jk白丝| 久久综合狠狠综合久久激情| 五月天一区二区| 91久久国产综合久久| 中国色在线观看另类| 麻豆91免费观看| 欧美精品免费视频| 亚洲猫色日本管| 成人免费不卡视频| 亚洲精品一区二区三区蜜桃下载| 亚洲超丰满肉感bbw|