time | Calls | line |
---|
| | 36 | function param = parameter(Z, options)
|
| | 37 |
|
< 0.001 | 1 | 38 | param = struct;
|
| | 39 |
|
< 0.001 | 1 | 40 | param.solver = 1;
|
< 0.001 | 1 | 41 | param.C = 0.01;
|
< 0.001 | 1 | 42 | param.bsize = [];
|
| | 43 |
|
| | 44 | % parameters for Newton methods
|
| | 45 |
|
| | 46 | % The subsampled size for calculating the Gauss-Newton matrix
|
< 0.001 | 1 | 47 | param.GNsize = ceil(0.05*size(Z,1));
|
| | 48 | % The maximum number of Newton iterations
|
< 0.001 | 1 | 49 | param.iter_max = 100;
|
| | 50 | % CG
|
< 0.001 | 1 | 51 | param.xi = 0.1;
|
< 0.001 | 1 | 52 | param.CGmax = 250;
|
| | 53 | % Levenberg-Marquardt method
|
< 0.001 | 1 | 54 | param.lambda = 1;
|
< 0.001 | 1 | 55 | param.drop = 2/3;
|
< 0.001 | 1 | 56 | param.boost = 3/2;
|
| | 57 | % line search
|
< 0.001 | 1 | 58 | param.eta = 1e-4;
|
| | 59 |
|
| | 60 | % Check GPU device
|
< 0.001 | 1 | 61 | global gpu_use;
|
< 0.001 | 1 | 62 | if exist('OCTAVE_VERSION', 'builtin')
|
| | 63 | gpu_use = false;
|
< 0.001 | 1 | 64 | else
|
0.015 | 1 | 65 | gpu_use = (gpuDeviceCount > 0);
|
< 0.001 | 1 | 66 | end
|
| | 67 |
|
| | 68 | % floating-point type and the flag of storing Jacobian
|
< 0.001 | 1 | 69 | global float_type;
|
< 0.001 | 1 | 70 | float_type = [];
|
< 0.001 | 1 | 71 | param.Jacobian = [];
|
| | 72 |
|
| | 73 | % parameters for stochastic gradient
|
| | 74 |
|
< 0.001 | 1 | 75 | param.epoch_max = 500;
|
< 0.001 | 1 | 76 | param.lr = 0.01;
|
< 0.001 | 1 | 77 | if param.solver == 3
|
| | 78 | param.lr = 0.001;
|
< 0.001 | 1 | 79 | end
|
< 0.001 | 1 | 80 | param.decay = 0;
|
< 0.001 | 1 | 81 | param.momentum = 0;
|
| | 82 |
|
| | 83 | % Read options given by users
|
< 0.001 | 1 | 84 | if ~isempty(options)
|
0.024 | 1 | 85 | param = parse_options(param, options);
|
< 0.001 | 1 | 86 | end
|
| | 87 |
|
< 0.001 | 1 | 88 | if isempty(float_type)
|
| | 89 | if gpu_use
|
| | 90 | float_type = 'single';
|
| | 91 | else
|
| | 92 | float_type = 'double';
|
| | 93 | end
|
< 0.001 | 1 | 94 | end
|
| | 95 |
|
< 0.001 | 1 | 96 | if isempty(param.Jacobian)
|
| | 97 | param.Jacobian = ~gpu_use;
|
< 0.001 | 1 | 98 | end
|
| | 99 |
|
< 0.001 | 1 | 100 | if isempty(param.bsize)
|
< 0.001 | 1 | 101 | param.bsize = 128;
|
< 0.001 | 1 | 102 | if ~gpu_use && (param.solver == 1)
|
< 0.001 | 1 | 103 | param.bsize = 1024;
|
< 0.001 | 1 | 104 | end
|
< 0.001 | 1 | 105 | end
|
| | 106 |
|
< 0.001 | 1 | 107 | param.C = param.C*size(Z,1);
|
Other subfunctions in this file are not included in this listing.