Changeset 114 for prextra/lassoc.m


Ignore:
Timestamp:
11/16/16 15:10:36 (8 years ago)
Author:
dtax
Message:

STUPID BUG!!!!!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • prextra/lassoc.m

    r108 r114  
    66% parameter.
    77
    8 function w = lassoc(x, lambda)
     8% w = lassoc(x, lambda)
     9function w = lassoc(varargin)
    910
    10 mustScale=0;
     11argin = shiftargin(varargin,'scalar');
     12argin = setdefaults(argin,[],1);
    1113
    12 if (nargin < 2)
    13         %prwarning(3,'Lambda set to one');
    14         lambda = 1;
    15 end
    16 if (nargin < 1) | (isempty(x))
    17         w = prmapping(mfilename,{lambda});
    18         w = setname(w,'LASSO classifier');
    19         return
    20 end
     14if mapping_task(argin,'definition')
    2115
    22 if ~ismapping(lambda)   % train the mapping
     16   w = define_mapping(argin,'untrained','LASSO classifier');
    2317
     18elseif mapping_task(argin,'training')
     19
     20   [x,lambda] = deal(argin{:});
    2421    % Unpack the dataset.
    2522    islabtype(x,'crisp');
     
    2724    [n,k,c] = getsize(x);
    2825
    29     % Is this necessary??
    30     if mustScale
    31         wsc = scalem(x,'variance');
    32         x.data = x.data*wsc;
    33     end
    3426    % make sure a bias is added:
    3527    x = [x ones(n,1)];
     
    5244
    5345    % and store the results:
    54     if mustScale
    55         W.wsc = wsc;
    56     end
    57 
    5846    W.beta = beta; % the ultimate weights
    5947    W.nr = nr;
    60     w = prmapping(mfilename,'trained',W,getlablist(x),size(x,2),c);
     48    w = prmapping(mfilename,'trained',W,getlablist(x),k,c);
    6149    w = setname(w,'LASSO classifier (l=%f)',lambda);
    6250
    6351else
     52    [x,lambda] = deal(argin{1:2});
    6453    % Evaluate the classifier on new data:
    6554    W = getdata(lambda);
    6655    n = size(x,1);
    6756
    68     % scaling and linear classifier:
    69     if mustScale
    70         x = x*W.wsc;
    71     end
    7257    % make sure a bias is added:
    7358    x = [x ones(n,1)];
Note: See TracChangeset for help on using the changeset viewer.