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

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

?? gaussmix.m

?? voicebox matlab最新版
?? M
字號:
function [m,v,w,g,f,pp,gg]=gaussmix(x,c,l,m0,v0,w0)
%GAUSSMIX fits a gaussian mixture pdf to a set of data observations [m,v,w,g,f]=(x,c,l,m0,v0,w0)
%
% Inputs: n data values, k mixtures, p parameters, l loops
%
%     X(n,p)   Input data vectors, one per row.
%     c(1,p)   Minimum variance (can be a scalar if all components are identical or 0 if no minimum).
%              Use [] to take default value of var(x)/n^2
%     L        The integer portion of l gives a maximum loop count. The fractional portion gives
%              an optional stopping threshold. Iteration will cease if the increase in
%              log likelihood density per data point is less than this value. Thus l=10.001 will
%              stop after 10 iterations or when the increase in log likelihood falls below
%              0.001.
%              As a special case, if L=0, then the first three outputs are omitted.
%              Use [] to take default value of 100.0001
%     M0(k,p)  Initial mixture means, one row per mixture.
%     V0(k,p)  Initial mixture variances, one row per mixture.
%     W0(k,1)  Initial mixture weights, one per mixture. The weights should sum to unity.
%
%     Alternatively, if initial values for M0, V0 and W0 are not given explicitly:
%
%     M0       Number of mixtures required
%     V0       Initialization mode:
%                'f'    Initialize with K randomly selected data points [default]
%                'p'    Initialize with centroids and variances of random partitions
%                'k'    k-means algorithm ('kf' and 'kp' determine initialization of kmeans)
%                'h'    k-harmonic means algorithm ('hf' and 'hp' determine initialization of kmeans)
%              Mode 'hf' generally gives the best results but 'f' [the default] is faster
%
% Outputs: (Note that M, V and W are omitted if L==0)
%
%     M(k,p)   Mixture means, one row per mixture. (omitted if L==0)
%     V(k,p)   Mixture variances, one row per mixture. (omitted if L==0)
%     W(k,1)   Mixture weights, one per mixture. The weights will sum to unity. (omitted if L==0)
%     G       Average log probability of the input data points.
%     F        Fisher's Discriminant measures how well the data divides into classes.
%              It is the ratio of the between-mixture variance to the average mixture variance: a
%              high value means the classes (mixtures) are well separated.
%     PP(n,1)  Log probability of each data point
%     GG(l+1,1) Average log probabilities at the beginning of each iteration and at the end

%  Bugs/Suggestions
%     (2) Allow processing in chunks by outputting/reinputting an array of sufficient statistics
%     (3) Implement full covariance matrices
%     (5) Should scale before finding initial centres
%     (6) Other initialization options:
%              's'    scale dimensions to equal variance when initializing
%              'l'    LBG algorithm
%              'm'    Move-means (dog-rabbit) algorithm

%      Copyright (C) Mike Brookes 2000-2006
%      Version: $Id: gaussmix.m,v 1.12 2008/06/02 07:21:34 dmb Exp $
%
%   VOICEBOX is a MATLAB toolbox for speech processing.
%   Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   This program is free software; you can redistribute it and/or modify
%   it under the terms of the GNU General Public License as published by
%   the Free Software Foundation; either version 2 of the License, or
%   (at your option) any later version.
%
%   This program is distributed in the hope that it will be useful,
%   but WITHOUT ANY WARRANTY; without even the implied warranty of
%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%   GNU General Public License for more details.
%
%   You can obtain a copy of the GNU General Public License from
%   http://www.gnu.org/copyleft/gpl.html or by writing to
%   Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

[n,p]=size(x);
x2=x.^2;            % need x^2 for variance calculation
if isempty(c)
    c=var(x,1)/n^2;
end
if isempty(l)
    l=100+1e-4;
end
if nargin<6             % no initial values specified for m0, v0, w0
    k=m0;
    if n<=k             % each data point can have its own mixture
        m=x(mod((1:k)-1,n)+1,:);    % just include all points several times
        v=zeros(k,p);               % will be set to floor later
        w=zeros(k,1);
        w(1:n)=1/n;
        if l>0
            l=0.1;            % no point in iterating
        end
    else
        if nargin<5
            v0='f';         % default initialization mode
        end
        m=zeros(k,p);
        v=ones(k,p);
        w=repmat(1/k,k,1);
        if any(v0=='k')                     % k-means initialization
            if any(v0=='p')
                [m,e,j]=kmeans(x,k,'p');
            else
                [m,e,j]=kmeans(x,k,'f');
            end
            for i=1:k
                v(i,:)=var(x(j==i,:),1);
            end
        elseif any(v0=='h')                     % k-harmonic means initialization
            if any(v0=='p')
                [m,e,j]=kmeanhar(x,k,'p');
            else
                [m,e,j]=kmeanhar(x,k,'f');
            end
            for i=1:k
                v(i,:)=var(x(j==i,:),1);
            end
        elseif any(v0=='p')                  % Initialize using a random partition
            ix=ceil(rand(1,n)*k);       % allocate to random clusters
            ix(rnsubset(k,n))=1:k;      % but force at least one point per cluster
            for i=1:k
                m(i,:)=mean(x(ix==i,:),1);
            end
        else                                % Forgy initialization: choose k random points [default]
            m=x(rnsubset(k,n),:);         % sample k centres without replacement
        end
    end
else
    k=size(m0,1);
    m=m0;
    v=v0;
    w=w0;
end
if length(c)>1          % if c is a row vector, turn it into a full matrix so it works with max()
    c=c(ones(k,1),:);
end
v=max(v,c);         % apply the lower bound



% If data size is large then do calculations in chunks

memsize=voicebox('memsize');
nb=min(n,max(1,floor(memsize/(8*p*k))));    % chunk size for testing data points
nl=ceil(n/nb);                  % number of chunks
jx0=n-(nl-1)*nb;                % size of first chunk

im=repmat(1:k,1,nb); im=im(:);
th=(l-floor(l))*n;
sd=(nargout > 3*(l~=0)); % = 1 if we are outputting log likelihood values
l=floor(l)+sd;   % extra loop needed to calculate final G value

lpx=zeros(1,n);             % log probability of each data point
wk=ones(k,1);
wp=ones(1,p);
wnb=ones(1,nb);
wnj=ones(1,jx0);

% EM loop

g=0;                           % dummy initial value for comparison
gg=zeros(l+1,1);
ss=sd;                       % initialize stopping count (0 or 1)
for j=1:l
    g1=g;                    % save previous log likelihood (2*pi factor omitted)
    m1=m;                       % save previous means, variances and weights
    v1=v;
    w1=w;
    vi=v.^(-1);                 % calculate quantities that depend on the variances
    vm=sqrt(prod(vi,2)).*w;
    vi=-0.5*vi;

    % first do partial chunk

    jx=jx0;
    ii=1:jx;
    kk=repmat(ii,k,1);
    km=repmat(1:k,1,jx);
    py=reshape(sum((x(kk(:),:)-m(km(:),:)).^2.*vi(km(:),:),2),k,jx);
    mx=max(py,[],1);                % find normalizing factor for each data point to prevent underflow when using exp()
    px=exp(py-mx(wk,:)).*vm(:,wnj);  % find normalized probability of each mixture for each datapoint
    ps=sum(px,1);                   % total normalized likelihood of each data point
    px=px./ps(wk,:);                % relative mixture probabilities for each data point (columns sum to 1)
    lpx(ii)=log(ps)+mx;
    pk=sum(px,2);                   % effective number of data points for each mixture (could be zero due to underflow)
    sx=px*x(ii,:);
    sx2=px*x2(ii,:);
    ix=jx+1;

    for il=2:nl
        jx=jx+nb;        % increment upper limit
        ii=ix:jx;
        kk=repmat(ii,k,1);
        py=reshape(sum((x(kk(:),:)-m(im,:)).^2.*vi(im,:),2),k,nb);
        mx=max(py,[],1);                % find normalizing factor for each data point to prevent underflow when using exp()
        px=exp(py-mx(wk,:)).*vm(:,wnb);  % find normalized probability of each mixture for each datapoint
        ps=sum(px,1);                   % total normalized likelihood of each data point
        px=px./ps(wk,:);                % relative mixture probabilities for each data point (columns sum to 1)
        lpx(ii)=log(ps)+mx;
        pk=pk+sum(px,2);                   % effective number of data points for each mixture (could be zero due to underflow)
        sx=sx+px*x(ii,:);
        sx2=sx2+px*x2(ii,:);
        ix=jx+1;
    end
    g=sum(lpx);                    % total log probability summed over all data points
    gg(j)=g;
    w=pk/n;                         % normalize to get the weights
    if pk                       % if all elements of pk are non-zero
        m=sx./pk(:,wp);
        v=sx2./pk(:,wp);
    else
        wm=pk==0;                       % mask indicating mixtures with zero weights
        [vv,mk]=sort(lpx);             % find the lowest probability data points
        m=zeros(k,p);                   % initialize means and variances to zero (variances are floored later)
        v=m;
        m(wm,:)=x(mk(1:sum(wm)),:);                % set zero-weight mixture means to worst-fitted data points
        wm=~wm;                         % mask for non-zero weights
        m(wm,:)=sx(wm,:)./pk(wm,wp);  % recalculate means and variances for mixtures with a non-zero weight
        v(wm,:)=sx2(wm,:)./pk(wm,wp);
    end
    v=max(v-m.^2,c);                % apply floor to variances

    if g-g1<=th && j>1
        if ~ss break; end  %  stop
        ss=ss-1;       % stop next time
    end

end
if sd  % we need to calculate the final probabilities
    pp=lpx'-0.5*p*log(2*pi);   % log of total probability of each data point
    gg=gg(1:j)/n-0.5*p*log(2*pi);    % average log prob at each iteration
    g=gg(end);
    %     gg' % *** DEBUG ***
    m=m1;       % back up to previous iteration
    v=v1;
    w=w1;
    mm=sum(m,1)/k;
    f=prod(sum(m.^2,1)/k-mm.^2)/prod(sum(v,1)/k);
end
if l==0         % suppress the first three output arguments if l==0
    m=g;
    v=f;
    w=pp;
end

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久精品一区八戒影视| 亚洲图片欧美综合| 又紧又大又爽精品一区二区| 看片的网站亚洲| 91福利国产成人精品照片| xfplay精品久久| 丝袜美腿高跟呻吟高潮一区| 国产91精品一区二区麻豆亚洲| 在线国产电影不卡| 国产精品情趣视频| 久久99国产精品尤物| 欧美日本一区二区三区四区| 日本一二三不卡| 精品在线观看视频| 欧美日韩在线三级| 最新国产成人在线观看| 久久99精品国产麻豆不卡| 欧美日韩高清影院| 亚洲伊人色欲综合网| 97超碰欧美中文字幕| 国产精品久久久久9999吃药| 国产麻豆午夜三级精品| 精品国产成人系列| 精品亚洲国产成人av制服丝袜| 欧美日韩中文精品| 亚洲中国最大av网站| 91国在线观看| 一区二区高清视频在线观看| 91看片淫黄大片一级| 亚洲精品视频一区| 色妞www精品视频| 亚洲色图视频网| 91丨porny丨户外露出| 亚洲免费av网站| 91在线观看视频| 亚洲精品成人少妇| 欧洲一区二区三区免费视频| 综合电影一区二区三区| 色哟哟国产精品| 夜夜爽夜夜爽精品视频| 欧美日韩激情在线| 蜜臀av一级做a爰片久久| 日韩欧美国产系列| 国产一区二区剧情av在线| 精品盗摄一区二区三区| 国产精一区二区三区| 亚洲国产精品成人综合 | 国模冰冰炮一区二区| 欧美电影免费观看高清完整版在| 麻豆精品一区二区三区| 久久精品欧美日韩精品| 丁香六月综合激情| 一区二区三区在线视频观看| 欧美视频一区二区| 精品一区二区国语对白| 中文字幕亚洲精品在线观看| 欧美亚洲国产bt| 久久精品国产精品青草| 国产精品毛片高清在线完整版 | 欧美三级蜜桃2在线观看| 日本伊人色综合网| 久久久久九九视频| 色婷婷激情综合| 久久国产精品无码网站| 国产精品二区一区二区aⅴ污介绍| 91成人免费网站| 国产真实乱偷精品视频免| 亚洲欧美在线aaa| 日韩一区二区三区高清免费看看 | 免费人成黄页网站在线一区二区| 日韩视频123| 99精品黄色片免费大全| 日本美女一区二区| 亚洲欧美激情小说另类| 精品精品国产高清一毛片一天堂| 成人精品一区二区三区四区| 午夜久久久久久久久| 国产欧美日韩另类一区| 欧美日韩久久久一区| 国产高清不卡二三区| 亚洲免费在线电影| 久久久一区二区三区捆绑**| 在线免费观看成人短视频| 国产一区91精品张津瑜| 亚洲va韩国va欧美va| 国产精品天美传媒| 日韩免费电影一区| 在线观看日韩av先锋影音电影院| 国产原创一区二区| 五月婷婷综合在线| 亚洲欧美在线视频观看| 久久婷婷国产综合国色天香| 欧美日韩中文字幕一区| 99精品视频一区| 成人自拍视频在线| 久久精品国产成人一区二区三区| 亚洲一卡二卡三卡四卡| 亚洲欧美国产77777| 国产丝袜美腿一区二区三区| 欧美一区二区精品| 欧美视频中文字幕| 一本久久精品一区二区| 成人av在线影院| 国产传媒一区在线| 国内精品第一页| 美国欧美日韩国产在线播放| 亚洲v中文字幕| 亚洲国产一区在线观看| 亚洲狼人国产精品| 蜜桃视频第一区免费观看| 一区二区三区四区不卡在线| 国产精品三级久久久久三级| 久久久久久**毛片大全| 欧美xxxxx牲另类人与| 欧美美女bb生活片| 欧美欧美欧美欧美| 欧美日韩另类一区| 欧美日韩成人综合在线一区二区| 在线观看av不卡| 欧洲亚洲国产日韩| 欧美日韩一区高清| 欧美精品99久久久**| 欧美私模裸体表演在线观看| 欧美日韩一区二区在线观看视频| 欧洲另类一二三四区| 欧美日产国产精品| 欧美一级二级三级蜜桃| 精品国产乱码久久久久久久| 久久欧美一区二区| 中文字幕亚洲在| 一区二区三区av电影| 亚洲va欧美va国产va天堂影院| 亚洲成人一区在线| 蜜乳av一区二区| 国内精品伊人久久久久影院对白| 国产电影精品久久禁18| 91麻豆免费观看| 欧美日韩精品一区二区三区四区| 欧美一级在线观看| 国产亚洲精品中文字幕| 中文字幕一区二区5566日韩| 亚洲妇熟xx妇色黄| 裸体在线国模精品偷拍| 成人激情免费电影网址| 色偷偷成人一区二区三区91| 91精品婷婷国产综合久久 | 国产在线播放一区| 91在线观看视频| 欧美一级免费观看| 国产精品久久久久久久午夜片 | 国产精品麻豆欧美日韩ww| 亚洲免费观看在线观看| 毛片一区二区三区| 成人激情动漫在线观看| 欧美日本在线看| 欧美极品另类videosde| 午夜av区久久| 懂色av一区二区夜夜嗨| 欧美无砖砖区免费| 欧美国产日本视频| 日韩精品福利网| 99精品久久只有精品| 91精品国产品国语在线不卡| 国产精品国产三级国产aⅴ原创 | 亚洲欧美在线aaa| 免费人成精品欧美精品| 色偷偷久久人人79超碰人人澡| 日韩亚洲欧美在线观看| 亚洲欧洲综合另类在线| 国产精品99久久久| 9191久久久久久久久久久| 亚洲一区二区三区四区在线免费观看| 日本久久一区二区三区| 丁香亚洲综合激情啪啪综合| 欧美人牲a欧美精品| 国产精品免费视频一区| 麻豆国产精品777777在线| 91麻豆精东视频| 国产欧美日韩激情| 成人sese在线| 久久久久亚洲蜜桃| 视频一区二区三区中文字幕| 日本精品裸体写真集在线观看| 国产偷国产偷亚洲高清人白洁| 免费在线欧美视频| 欧美人xxxx| 亚洲综合色成人| 99精品视频免费在线观看| 国产日韩欧美麻豆| 激情小说欧美图片| 久久综合狠狠综合久久激情 | 7777精品伊人久久久大香线蕉的 | 青青草一区二区三区| 欧美调教femdomvk| 亚洲最新视频在线观看| jlzzjlzz亚洲女人18| 国产精品视频一二三区| 国产v综合v亚洲欧| 久久精品亚洲一区二区三区浴池| 乱中年女人伦av一区二区|