Skip to content

Commit

Permalink
fixed basic lambda update value
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegKonings committed Feb 5, 2014
1 parent 3c1c068 commit c796c12
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 70 deletions.
2 changes: 1 addition & 1 deletion GLcuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -464,4 +464,4 @@ __global__ void update_q(const float* __restrict__ Atb, const float* __restrict_
extern "C" void update_vector_q(const float *Atb, const float *z, const float *u, float *q, const float rho,const int length){
update_q<<<(length+THREADS-1)/THREADS,THREADS>>>(Atb,z,u,q,rho,length);

}
}
4 changes: 2 additions & 2 deletions GLmex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, mxArray const *prhs[]){//w
fabs(history_s_norm-last_s_norm)<0.00001f){
lambda_counter++;
if(lambda_counter>10){
_lambda*=0.01f;
_lambda*=0.1f;
lambda_counter=0;
}
}
Expand Down Expand Up @@ -474,4 +474,4 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, mxArray const *prhs[]){//w
//if(err!=cudaSuccess){printf("%s in %s at line %d\n",cudaGetErrorString(err),__FILE__,__LINE__);}

checkError(cublasDestroy(handle), "cublasDestroy() error!\n");
}
}
52 changes: 52 additions & 0 deletions GenerateRandomGroupLassoDataSet.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
function [ A,b,partition,lambda ] = GenerateRandomGroupLassoDataSet( m,K,density )% density default value should be 100

flag=true;
while flag
partition = int32(randi(225, [K 1]));% per Boyd example
n = int32(sum(partition)); % number of features
if (mod(n,16))==0
flag=false;
end
end

p = single(density/single(n)); % sparsity density

% generate block sparse solution vector
x = single(zeros(n,1));
start_ind = int32(1);
cum_part = int32(cumsum(single(partition)));

for i = 1:K,
x(start_ind:cum_part(i)) = 0;
if( rand() < p)
% fill nonzeros
x(start_ind:cum_part(i)) = randn(partition(i),1);
end
start_ind = cum_part(i)+1;
end

% generate random data matrix
A = randn(m,n);

% normalize columns of A
A = (A*spdiags(1./sqrt(sum(A.^2))',0,double(n),double(n)));
A=full(single(A));
% generate measurement b with noise
b = single(A*x + sqrt(0.001)*randn(m,1));

% lambda max
start_ind = 1;
lambdas=single(zeros(1,K+1));
for i = 1:K,
sel = start_ind:cum_part(i);
lambdas(i) = norm(A(:,sel)'*b);
start_ind = cum_part(i) + 1;
end
lambda_max = max(lambdas);

% regularization parameter
lambda = 0.1*lambda_max;


end

Binary file added GroupMextest.exp
Binary file not shown.
Binary file added GroupMextest.lib
Binary file not shown.
Binary file modified GroupMextest.mexw64
Binary file not shown.
67 changes: 0 additions & 67 deletions ReadMe.txt

This file was deleted.

0 comments on commit c796c12

Please sign in to comment.