Skip to content

Commit 56d7ca9

Browse files
committed
Reduced the large memory requirements of ml_trainproximal.
1 parent 6457537 commit 56d7ca9

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

code/machine_learning/ml_trainproximal.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -806,10 +806,9 @@
806806

807807
function M = operator_to_matrix_cached(op,n)
808808
vec = @(x)x(:);
809-
M = [];
809+
M = sparse([]);
810810
w = zeros(n,1);
811-
for c=n:-1:1
811+
for c=[n 1:n-1]
812812
v = w; v(c) = 1;
813813
M(:,c) = vec(op(v));
814814
end
815-
M = sparse(M);

dependencies/rica/rica.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@
115115
Mu = median(X,2);
116116
Sigma = hlp_diskcache('filterdesign',@cov_blockgeom,X',params.cov_blocksize);
117117
%% Optionally reject bad samples
118-
if params.cov_rejection
118+
if params.cov_rejection && exist('reject_samples_robcov','file')
119119
X = reject_samples_robcov(X,params.cov_rejection,Mu,Sigma); end
120120
%% Whiten the data
121-
X = bsxfun(@minus,X,mu);
121+
X = bsxfun(@minus,X,Mu);
122122
mix = sqrtm(Sigma);
123123
sphere = inv(mix);
124124
X = sphere*X; %#ok<*MINV>
@@ -131,7 +131,7 @@
131131

132132
params.sphere = sphere;
133133
params.mix = mix;
134-
params.rcov = rcov;
134+
params.rcov = Sigma;
135135

136136
%% Select cost function
137137
if strcmp(params.dict_criterion,'reconstruction')

userscripts/tutorial_erp1.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
'Prediction',{'MachineLearning',{'Learner',{'dal',2.^(10:-0.125:1),'scaling','std','regularizer','glc','shape',[64 NaN]}}}};
141141
% again wavelets, using group-sparse logistic regression and an elastic-net like extra penalty (using the proximal classifier)
142142
% cross-validdation takes ca. 8hrs; demo only for syntax
143-
approaches.waveletsprox = {'DataflowSimplified' 'SignalProcessing',{'Resampling',100,'EpochExtraction',[0 0.8],'WaveletTransform','on'}, ...
143+
approaches.waveletsprox = {'DataflowSimplified' 'SignalProcessing',{'Resampling',128,'EpochExtraction',[0 0.8],'WaveletTransform','on'}, ...
144144
'Prediction',{'FeatureExtraction',{'GroupInto','matrix'}, ...
145145
'MachineLearning',{'Learner',{'proximal' 'Regularizers',{'Term1','l1/l2','Term2','l2'}}}}};
146146

0 commit comments

Comments
 (0)