Mercurial > forge
changeset 9415:d44e0401b147 octave-forge
use sparse instead of clumsy loop; fix docu
author | schloegl |
---|---|
date | Thu, 09 Feb 2012 14:14:36 +0000 |
parents | d5dd4cda27e1 |
children | c6356bcda43c |
files | extra/NaN/inst/quantile.m extra/NaN/inst/test_sc.m extra/NaN/inst/train_sc.m extra/NaN/inst/trimean.m |
diffstat | 4 files changed, 9 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/extra/NaN/inst/quantile.m Thu Feb 09 13:56:10 2012 +0000 +++ b/extra/NaN/inst/quantile.m Thu Feb 09 14:14:36 2012 +0000 @@ -146,5 +146,6 @@ end; +%!assert(quantile(1:10,[.2,.5]),[2.5, 5.5])
--- a/extra/NaN/inst/test_sc.m Thu Feb 09 13:56:10 2012 +0000 +++ b/extra/NaN/inst/test_sc.m Thu Feb 09 14:14:36 2012 +0000 @@ -131,18 +131,13 @@ elseif strcmp(CC.datatype,'classifier:svm:lib:1vs1') || strcmp(CC.datatype,'classifier:svm:lib:rbf'); - - cl = svmpredict_mex(ones(size(D,1),1), D, CC.model); %Use the classifier - + nr = size(D,1); + [cl] = svmpredict_mex(ones(nr,1), D, CC.model); %Use the classifier %Create a pseudo tsd matrix for bci4eval - d = zeros(size(D,1), CC.model.nr_class); - for i = 1:size(cl,1) - d(i,cl(i)) = 1; - end + d = full(sparse(1:nr,cl,1,nr,CC.model.nr_class)); elseif isfield(CC,'weights'); %strcmpi(t2,'svm') || (strcmpi(t2,'statistical') & strncmpi(t3,'ld',2)) ; - % linear classifiers like: LDA, SVM, LPM %d = [ones(size(D,1),1), D] * CC.weights; d = repmat(NaN,size(D,1),size(CC.weights,2));
--- a/extra/NaN/inst/train_sc.m Thu Feb 09 13:56:10 2012 +0000 +++ b/extra/NaN/inst/train_sc.m Thu Feb 09 14:14:36 2012 +0000 @@ -94,8 +94,9 @@ % z=2 LibLinear with -- L2-loss support vector machines (primal) % z=3 LibLinear with -- L1-loss support vector machines (dual) % 'SVM:LIN4' LibLinear with -- multi-class support vector machines by Crammer and Singer +% 'DT' decision tree - not implemented yet. % -% {'REG','MDA','MD2','QDA','QDA2','LD2','LD3','LD4','LD5','LD6','NBC','aNBC','WienerHopf','LDA/GSVD','MDA/GSVD', 'LDA/sparse','MDA/sparse', 'PLA', 'LMS','LDA/DELETION','MDA/DELETION','NBC/DELETION','RDA/DELETION','REG/DELETION','RDA','GDBC','SVM','RBF','PSVM','SVM11','SVM:LIN4','SVM:LIN0','SVM:LIN1','SVM:LIN2','SVM:LIN3','WINNOW'}; +% {'REG','MDA','MD2','QDA','QDA2','LD2','LD3','LD4','LD5','LD6','NBC','aNBC','WienerHopf','LDA/GSVD','MDA/GSVD', 'LDA/sparse','MDA/sparse', 'PLA', 'LMS','LDA/DELETION','MDA/DELETION','NBC/DELETION','RDA/DELETION','REG/DELETION','RDA','GDBC','SVM','RBF','PSVM','SVM11','SVM:LIN4','SVM:LIN0','SVM:LIN1','SVM:LIN2','SVM:LIN3','WINNOW', 'DT'}; % % CC contains the model parameters of a classifier. Some time ago, % CC was a statistical classifier containing the mean
--- a/extra/NaN/inst/trimean.m Thu Feb 09 13:56:10 2012 +0000 +++ b/extra/NaN/inst/trimean.m Thu Feb 09 14:14:36 2012 +0000 @@ -1,5 +1,5 @@ function y=trimean(x,DIM) -% TRIMEAN evaluates basic statistics of a data series +% TRIMEAN yields the weighted mean of the median and the quartiles % m = TRIMEAN(y). % % The trimean is m = (Q1+2*MED+Q3)/4 @@ -26,8 +26,8 @@ % $Id$ % Copyright (C) 1996-2003,2009,2010 by Alois Schloegl <alois.schloegl@gmail.com> -% This function is part of the NaN-toolbox -% http://pub.ist.ac.at/~schloegl/matlab/NaN/ +% This function is part of the NaN-toolbox +% http://pub.ist.ac.at/~schloegl/matlab/NaN/ global FLAG_NANS_OCCURED;