-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathglmnetCoef.m
48 lines (44 loc) · 1.47 KB
/
glmnetCoef.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
function result = glmnetCoef( object, s )
%--------------------------------------------------------------------------
% glmnetCoef.m: print coefficients from a "glmnet" object
%--------------------------------------------------------------------------
%
% USAGE:
% glmnetCoef(fit);
% glmnetCoef(fit, s);
%
% DETAILS:
% glmnetCoef(fit, s) is equivalent to glmnetPredict(fit, "coefficients", [], s)
% See glmnetPredict for more details.
%
% LICENSE: GPL-2
%
% DATE: 14 Jul 2009
%
% AUTHORS:
% Algorithm was designed by Jerome Friedman, Trevor Hastie and Rob Tibshirani
% Fortran code was written by Jerome Friedman
% R wrapper (from which the MATLAB wrapper was adapted) was written by Trevor Hasite
% MATLAB wrapper was written and maintained by Hui Jiang, [email protected]
% Department of Statistics, Stanford University, Stanford, California, USA.
%
% REFERENCES:
% Friedman, J., Hastie, T. and Tibshirani, R. (2009)
% Regularization Paths for Generalized Linear Models via Coordinate Descent.
% Journal of Statistical Software, 33(1), 2010
%
% SEE ALSO:
% glmnet, glmnetSet, glmnetPrint, glmnetPredict and glmnetPlot methods.
%
% EXAMPLES:
% x=randn(100,20);
% y=randn(100,1);
% fit1=glmnet(x,y);
% glmnetCoef(fit1,0.01) % extract coefficients at a single value of lambda
%
% DEVELOPMENT: 14 Jul 2009: Original version of glmnet.m written.
%
if nargin < 2
s = object.lambda;
end
result = glmnetPredict(object, 'coefficients', [], s);