svm_histogram.m

来自「gps“可用性”matlab代码 Matlab Algorithm Avail」· M 代码 · 共 70 行

M
70
字号
function h=svm_histogram(x,n,xi,ni,xsplit,xratio,xticks,xticklabels)%*************************************************************************%*     Copyright c 2007 The board of trustees of the Leland Stanford     *%*                      Junior University. All rights reserved.          *%*     This script file may be distributed and used freely, provided     *%*     this copyright notice is always kept with it.                     *%*                                                                       *%*     Questions and comments should be directed to Todd Walter at:      *%*     twalter@stanford.edu                                              *%*************************************************************************%clfi=find(x>xsplit);x(i)=xsplit + (x(i)-xsplit)/xratio;i=find(xi>xsplit);xi(i)=xsplit + (xi(i)-xsplit)/xratio;i=find(xticks>xsplit);xticks(i)=xsplit + (xticks(i)-xsplit)/xratio;n_pts=sum(n);n_idx=sum(ni) ;%determine the lower bound for a semilog plotlo_bnd = 10.^(-(ceil(log10(max([n_pts n_idx])))));%get the x and y coordinates for the index histogram bars[msg,xout,yout,XX,YY] = makebars(xi,ni/n_idx);%reset the zeros to the lowerbound for the semilog plotjdx=find(YY==0);if(~isempty(jdx))  YY(jdx) = lo_bnd;end%plot the bar data for the indiciesgrid onhold onh1=patch(XX, YY,'r','EdgeColor', 'none');set(gca, 'YScale', 'log');%get the x and y coordinates for the user histogram bars[msg,xout,yout,XX,YY] = makebars(x,n/n_pts,1);%reset the zeros to the lowerbound for the semilog plotjdx=find(YY==0);if(~isempty(jdx))  YY(jdx) = lo_bnd;endnx = length(x);nXX = length(XX);kdx = [ 1 2 reshape([(3:5:nXX-3)' (4:5:nXX-2)']',2*nx,1)' nXX-1 nXX];%plot the user bar data and set the axesh2=semilogy(XX(kdx),YY(kdx),'b');axis([min(xticks) max(xticks) lo_bnd 1]);set(gca,'XTick',xticks);set(gca,'XTickLabel',xticklabels);plot([xsplit xsplit], [lo_bnd 1], 'k');ylabel('Probability')h=[h1 h2];

⌨️ 快捷键说明

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