lijia-xing / pmtk3

Automatically exported from code.google.com/p/pmtk3
MIT License
0 stars 0 forks source link

options.weights not working with cvglmnetMulticlass() #37

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Set a weight vector in glmnetSet() produced options struct
2. Run cvglmnetMulticlass() with above options

What is the expected output? What do you see instead?
Should train a glmnet model. Instead, error occurs in cvglmnetMulticlass() line 
60 because the weight vector inside the CV loop has a different size w.r.t 
target vector y.

What version / revision of the product are you using? On what operating
system?
pmtk3-3jan11/pmtk3-2april2011, Win7 64bit

Please provide any additional information below.
Proposed MATLAB code to replace lines 57-62 in cvglmnetMulticlass.m:

weights = options.weights;
for i=1:nfolds
    which=foldid==i;
    if verbose, disp(['Fitting fold # ' num2str(i) ' of ' num2str(nfolds)]);end
    options.weights = weights(~which);
    cvfit = glmnet(x(~which,:), y(~which),family, options);
    predmat(which,:) = glmnetPredict(cvfit, type,x(which,:),options.lambda);
end
options.weights = weights;

Original issue reported on code.google.com by Tapio3...@gmail.com on 30 Jan 2012 at 2:43

GoogleCodeExporter commented 8 years ago
Moved to GitHub: https://github.com/probml/pmtk3/issues/37

Original comment by irosen on 4 Jan 2014 at 2:36