2013-03-16 179 views

回答

1

爲TreeBagger的構造:

% In addition to the optional arguments above, this method accepts all 
% optional CLASSREGTREE arguments with the exception of 'minparent'. 
% Refer to the documentation for CLASSREGTREE for more detail. 

「貓」是不是TreeBagger有效輸入對之一,所以它必須是CLASSREGTREE的輸入。看着爲classregtree輸入對,唯一的輸入對接近「貓」是「絕對」,這說:

%  'categorical' Vector of indices of the columns of X that are to be 
%     treated as unordered categorical variables 

如果你看一下statgetargs.m,特別是這一行:

i = strmatch(lower(pname),pnames); 

只要第一部分拼寫正確,它將允許任何參數。 pnames將包含一個有效字符串的單元數組(其中一個將是'categorical'),而pname將包含一個字符串來比較pnames(最終,這將包含'cat')。如果只輸入輸入字符串的第一部分,它將仍然有效。即對於我這種工作原理:

EDU>> a = TreeBagger(nTrees,X,Y,'oobpr','on','cat',6,'minle',leaf(ii)); 
EDU>> b = TreeBagger(nTrees,X,Y,'oobpred','on','cat',6,'minleaf',leaf(ii)); 
EDU>> isequal(a,b) 

ans = 

    1 

因爲它存儲「貓」明確,因爲它的下TreeArgs拼寫它並不如「貓」改變工作。無論如何,'貓'被視爲classregtree的'絕對'。

0

cat被視爲的classregtreecategorical的輸入參數的縮寫,並指定了在X第六變量應作爲分類處理。

相關問題