Skip to content

Commit 7fed59b

Browse files
authored
GLL_package_v2.0 committed
This version of the GLL package includes examples from the following papers (see README.txt): [1] H. E. Egilmez, E. Pavez, and A. Ortega, "Graph learning from data under Laplacian and structural constraints," IEEE Journal of Selected Topics in Signal Processing, 2017. [2] H. E. Egilmez, E. Pavez, and A. Ortega, "Graph Learning from Filtered Signals: Graph System and Diffusion Kernel Identification," IEEE Transactions on Signal and Information Processing over Networks, 2018.
1 parent f2cf53f commit 7fed59b

File tree

11 files changed

+767
-1
lines changed

11 files changed

+767
-1
lines changed

demo_us_temperature.m

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
clear all
2+
close all
3+
4+
% load us temperature data
5+
load('us_temp_data.mat');
6+
7+
% sample covariance
8+
S = cov(data_2d_state,1);
9+
10+
% initializaions
11+
filter_type = 'exp';
12+
beta = 0.5; % filter parameter
13+
graph_filter_ideal = @(x)(graph_filter_fwd(x,beta,filter_type) );
14+
[U,sigma_sq_C] = createBasis(S,'descend');
15+
max_sigma=(max(sigma_sq_C));
16+
sigma_orig = sigma_sq_C/max_sigma;
17+
18+
% step I: prefilter
19+
sigma_sq_C = sigma_sq_C/max_sigma; sigma_sq_C(sigma_sq_C <= 10^-10) = 0;
20+
lambdas_current = graph_filter_inv(sigma_sq_C,beta,filter_type);
21+
orig_sigmas = 1./lambdas_current; orig_sigmas(orig_sigmas==Inf)=0;
22+
S_prefiltered = U * diag(orig_sigmas) * U';
23+
24+
% step II: graph learning
25+
Laplacian = estimate_cgl(S_prefiltered,ones(size(S_prefiltered)),0.000,10^-5,10^-7,40);
26+
27+
% step III: filter parameter estimation (for a desired filter type a filter parameter selection step)
28+
% Note: for exponential filter filter parameter selection step can be skipped,
29+
% becayse the output graphs are scaled versions of eachother for different beta parameter
30+
% please refer to the paper for further details
31+
32+
% show resulting graph on the US map
33+
draw_us_temp_graph(Laplacian, center_vector);

functions/generateFilteredModel.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function [h_L,h_L_SquareRootMtx] = generateFilteredModel(L,graph_filter)
2+
3+
[U,lambdas_L] = createBasis(L,'ascend'); lambdas_L(lambdas_L<= 10^-10)=0;
4+
sigmas_C = graph_filter(lambdas_L); sigmas_C(sigmas_C <= 10^-10) = 0;
5+
6+
h_L = U * diag(sigmas_C) * U'; h_L = 0.5*(h_L + h_L');
7+
h_L_SquareRootMtx = U * diag(sigmas_C.^(0.5));
8+
end

functions/graph_filter_fwd.m

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
function sigma_sq = graph_filter_fwd(lambdas,beta,filter_type)
2+
3+
if sum([lambdas(:);beta]<0)>0 % if there are negative values
4+
error('Error: graph_filter_fwd negative frequency of beta value!');
5+
end
6+
7+
if isequal(filter_type,'exp')
8+
9+
sigma_sq = exp(-beta*lambdas);
10+
11+
elseif isequal(filter_type,'fscale')
12+
13+
sigma_sq = 1./(beta*lambdas);
14+
15+
elseif isequal(filter_type,'fshift')
16+
17+
sigma_sq = 1./(beta + lambdas);
18+
19+
elseif isequal(filter_type,'vshift')
20+
21+
sigma_sq = (1./(lambdas)) + beta;
22+
sigma_sq(sigma_sq == Inf) = beta;
23+
24+
elseif isequal(filter_type,'hop')
25+
26+
sigma_sq = 1./(lambdas.^beta);
27+
28+
else
29+
error('Error: graph_filter_fwd wrong filter_type');
30+
31+
end
32+
33+
sigma_sq(sigma_sq <= 10^-10) = 0;
34+
sigma_sq(sigma_sq == Inf) = 0;
35+
36+
37+
end

functions/graph_filter_inv.m

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
function lambdas = graph_filter_inv(sigma_sq,beta,filter_type)
2+
3+
if sum([sigma_sq(:);beta]<0)>0 % if there are negative values
4+
error('Error: graph_filter_inv negative variance or beta value!');
5+
end
6+
7+
if isequal(filter_type,'exp')
8+
9+
lambdas = -log(sigma_sq)/beta;
10+
11+
elseif isequal(filter_type,'fscale')
12+
13+
lambdas = 1./(beta*sigma_sq);
14+
lambdas(sigma_sq <= 10^-10) = 0;
15+
16+
elseif isequal(filter_type,'fshift')
17+
18+
lambdas = 1./(sigma_sq - beta);
19+
lambdas(sigma_sq <= 10^-10) = 0;
20+
21+
elseif isequal(filter_type,'vshift')
22+
23+
lambdas = 1./(sigma_sq - beta);
24+
25+
elseif isequal(filter_type,'hop')
26+
27+
lambdas = 1./(sigma_sq.^(1/beta));
28+
lambdas(sigma_sq <= 10^-10) = 0;
29+
30+
else
31+
error('Error: graph_filter_inv wrong filter_type');
32+
33+
end
34+
lambdas(lambdas <= 10^-10) = 0;
35+
end

misc/borderdata.mat

5.93 MB
Binary file not shown.

0 commit comments

Comments
 (0)