matlab_classify()函数

classify函数进行线性判别分析(默认)。它的格式为:
                
[class,err]=classify(sample,training,group)
    其中,sample(待测样本)与training(训练样本)必须具有相同的列数,group(已知的训练样本的分类)与training必须具有相同的行数,group是一个整数向量。Matlab内部函数classify的功能是将sample的每一行进行判别,分到training指定的类中。

进一步,较复杂的格式为:
             [class,err]=classify(sample,training,group,type)
    其中,class返回分类表,err返回误差比例信息,sample是样本数据矩阵,training是已有的分类数据矩阵,group是分类列向量,type有3种选择:type=linear(默认),type=quadratic(二次),type=mahalanobis(马氏距离)。

CLASS = classify(SAMPLE,TRAINING,GROUP,TYPE) allows you to specify the type of discriminant function, one of 'linear', 'quadratic',  'diagLinear', 'diagQuadratic', or 'mahalanobis'(马氏距离) .  Linear discrimination fits a multivariate normal density to each group, with a pooled estimate of covariance.  Quadratic discrimination fits MVN densities with covariance estimates stratified by group.  Both methods use likelihood ratios to assign observations to groups.  'diagLinear' and 'diagQuadratic' are similar to 'linear' and 'quadratic', but with diagonal covariance matrix estimates.   These diagonal choices are examples of naive Bayes classifiers.  Mahalanobis discrimination uses  Mahalanobis distances with stratified covariance estimates .  TYPE  defaults to 'linear'.

你可能感兴趣的:(机器学习,算法,matlab)