diff --git a/README.md b/README.md index e04a741..eed06e1 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ to be added to the Matlab path, using the command `addpath` (see the test file). ### Demos and reproducible results of the article [Todeschini, Miscouridou and Caron (2017)](https://arxiv.org/abs/1602.02114) -- `demo_sparsity.m`: shows empirically the sparsity properties of a range of graph models. [[html version](https://misxenia.github.io/SNetOC/demo_sparsity.html)] +- `demo_sparsity.m`: shows empirically the sparsity properties of a range of graph models. [[html version](https://OxCSML-BayesNP.github.io/SNetOC/demo_sparsity.html)] You can run multiple MCMC chains in parallel by calling the `parpool` command before running the following scripts. This requires the Parallel Computing Toolbox. @@ -63,7 +63,7 @@ before running the following scripts. This requires the Parallel Computing Toolb # Changes -### [v1.1](https://github.com/OxCSML-BayesNP/SNetOC/releases/tag/v1.0) (2020-01-24) +### [v1.1](https://github.com/OxCSML-BayesNP/SNetOC/releases/tag/v1.1) (2020-01-24) - Some fixes - Updated demo scripts diff --git a/data/.DS_Store b/data/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/data/.DS_Store and /dev/null differ diff --git a/demo_overlappingcommunity.m b/demo_overlappingcommunity.m index b9c4347..fe52b21 100644 --- a/demo_overlappingcommunity.m +++ b/demo_overlappingcommunity.m @@ -1,4 +1,4 @@ -%% Sparse Networks with Overlapping Communities (SNOC) package: demo_overlappingcommunity +%% Sparse Networks with Overlapping Communities (SNetOC) package: demo_overlappingcommunity % % This Matlab script finds overlapping communities in a network of % political blogs, using the wrapper function @@ -6,7 +6,7 @@ % see the Matlab demo demo_polblogs.m. % % For downloading the package and information on installation, visit the -% . +% . % % Reference: % @@ -18,7 +18,7 @@ % * , University of Oxford % * , University of Oxford % -% Tested on Matlab R2017a. Requires the statistics toolbox. +% Tested on Matlab R2017a. Requires the Statistics toolbox. % % Last Modified: 01/2020 %% @@ -45,6 +45,7 @@ G = logical(G-diag(diag(G))); % remove self edges (#3) % Collect metadata +meta = struct; meta.name = cellstr(Problem.aux.nodename); meta.source = cellstr(Problem.aux.nodesource); meta.isright = logical(Problem.aux.nodevalue); diff --git a/demo_sparsity.m b/demo_sparsity.m index a6d9caa..61d273a 100644 --- a/demo_sparsity.m +++ b/demo_sparsity.m @@ -3,7 +3,7 @@ % This Matlab script shows empirically the sparsity properties of a range of graph models. % % For downloading the package and information on installation, visit the -% . +% . % % Reference: % @@ -190,7 +190,7 @@ axis tight xlim([10, 2000]) xlabel('Number of nodes', 'fontsize', fontsize) -ylabel('Nb of edges / (Nb of nodes)^2', 'fontsize', fontsize) +ylabel('$Nb of edges / (Nb of nodes)^2$', 'fontsize', fontsize) legend(leg,'fontsize', fontsize, 'location', 'southwest', 'interpreter', 'latex') legend boxoff box off @@ -226,3 +226,7 @@ if saveworkspace save(fullfile(outpath, 'workspace')); end + +% reset default properties +set(0,'defaultLineLineWidth', 0.5) +set(0,'defaultLineMarkerSize', 6) diff --git a/docs/demo_overlappingcommunity.html b/docs/demo_overlappingcommunity.html index cad60d8..4f09527 100644 --- a/docs/demo_overlappingcommunity.html +++ b/docs/demo_overlappingcommunity.html @@ -6,7 +6,7 @@ Sparse Networks with Overlapping Communities (SNOC) package: demo_overlappingcommunity

Sparse Networks with Overlapping Communities (SNOC) package: demo_overlappingcommunity

This Matlab script finds overlapping communities in a network of political blogs, using the wrapper function overlapping_community_detection.m. For a full analysis of this dataset, see the Matlab demo demo_polblogs.m.

For downloading the package and information on installation, visit the SNOC webpage.

Reference:

Authors:

Tested on Matlab R2016a. Requires the statistics toolbox.

Last Modified: 07/11/2017

Contents

close all
+  

Sparse Networks with Overlapping Communities (SNetOC) package: demo_overlappingcommunity

This Matlab script finds overlapping communities in a network of political blogs, using the wrapper function overlapping_community_detection.m. For a full analysis of this dataset, see the Matlab demo demo_polblogs.m.

For downloading the package and information on installation, visit the SNetOC webpage.

Reference:

Authors:

Tested on Matlab R2017a. Requires the Statistics toolbox.

Last Modified: 01/2020

Contents

close all
 clear all
 
 % Add path
 addpath ./GGP/ ./CGGP/ ./utils/
-

Load network of political blogs

Data can be downloaded from here.

load ./data/polblogs/polblogs.mat
+

Load network of political blogs

Data can be downloaded from here.

load ./data/polblogs/polblogs.mat
 
 titlenetwork = 'Political blogosphere Feb. 2005';
 name = 'polblogs';
@@ -83,6 +83,7 @@
 G = logical(G-diag(diag(G))); % remove self edges (#3)
 
 % Collect metadata
+meta = struct;
 meta.name = cellstr(Problem.aux.nodename);
 meta.source = cellstr(Problem.aux.nodesource);
 meta.isright = logical(Problem.aux.nodevalue);
@@ -118,7 +119,7 @@
 spy(G);
 xlabel(labels{2})
 ylabel(labels{1})
-

Find overlapping communities

p = 2; % Number of communities
+

Find overlapping communities

p = 2; % Number of communities
 niter = 20000; % Number of iterations
 [degree_correction, community_affiliation, community_detection] = overlapping_community_detection(G, p, niter);
 
-----------------------------------
@@ -127,38 +128,37 @@
 End initialisation
 -----------------------------------
 -----------------------------------
-Start MCMC for CGGP graphs
-Nb of nodes: 1224 - Nb of edges: 16715 (0 missing)
+Start MCMC for undirected CGGP graphs
+Nb of nodes: 1224x1224 - Nb of edges: 16715 (0 missing)
 Nb of chains: 1 - Nb of iterations: 20000
-Nb of parallel workers: 1
-Estimated computation time: 0 hour(s) 2 minute(s)
-Estimated end of computation: 08-Nov-2017 18:01:19 
+Estimated computation time: 0 hour(s) 3 minute(s)
+Estimated end of computation: 01-Feb-2020 17:39:25 
 -----------------------------------
  Markov chain 1/1 
 -----------------------------------
-i=2000 alp=669.22 sig=-0.255 tau=1.98 a=0.23 0.18 b=0.46 0.39 w*=0.56 0.36 b2=0.90 0.78 alp2=562.24 rhmc=0.63 rhyp=0.30 eps=0.025 rwsd=0.049
-i=4000 alp=1604.00 sig=-0.450 tau=3.68 a=0.20 0.15 b=0.39 0.27 w*=0.50 0.41 b2=1.42 1.01 alp2=892.66 rhmc=0.70 rhyp=0.25 eps=0.04 rwsd=0.058
-i=6000 alp=1718.53 sig=-0.453 tau=3.48 a=0.18 0.14 b=0.36 0.31 w*=0.47 0.39 b2=1.24 1.06 alp2=977.03 rhmc=0.56 rhyp=0.22 eps=0.025 rwsd=0.056
-i=8000 alp=1687.01 sig=-0.450 tau=3.93 a=0.18 0.15 b=0.32 0.29 w*=0.47 0.39 b2=1.24 1.12 alp2=911.42 rhmc=0.78 rhyp=0.23 eps=0.025 rwsd=0.056
-i=10000 alp=1799.57 sig=-0.468 tau=3.91 a=0.16 0.13 b=0.29 0.24 w*=0.46 0.41 b2=1.13 0.92 alp2=950.12 rhmc=0.79 rhyp=0.23 eps=0.025 rwsd=0.056
-i=12000 alp=2018.04 sig=-0.458 tau=4.47 a=0.16 0.13 b=0.28 0.20 w*=0.50 0.49 b2=1.24 0.89 alp2=1016.53 rhmc=0.78 rhyp=0.23 eps=0.025 rwsd=0.056
-i=14000 alp=1999.09 sig=-0.459 tau=4.66 a=0.15 0.12 b=0.18 0.19 w*=0.46 0.42 b2=0.84 0.88 alp2=985.82 rhmc=0.78 rhyp=0.23 eps=0.025 rwsd=0.056
-i=16000 alp=2012.28 sig=-0.491 tau=3.99 a=0.14 0.12 b=0.23 0.22 w*=0.55 0.37 b2=0.92 0.88 alp2=1019.78 rhmc=0.78 rhyp=0.23 eps=0.025 rwsd=0.056
-i=18000 alp=1805.01 sig=-0.456 tau=3.90 a=0.14 0.12 b=0.28 0.24 w*=0.50 0.41 b2=1.11 0.95 alp2=970.22 rhmc=0.78 rhyp=0.23 eps=0.025 rwsd=0.056
-i=20000 alp=1790.90 sig=-0.486 tau=3.11 a=0.13 0.12 b=0.27 0.33 w*=0.56 0.42 b2=0.84 1.03 alp2=1032.27 rhmc=0.77 rhyp=0.24 eps=0.025 rwsd=0.056
+i=2000 alp=4886.52 sig=-1.095 tau=3.37 a=0.25 0.22 b=0.71 0.82 w*=0.24 0.18 b2=2.38 2.76 alp2=1289.99 rhmc=0.70 rhyp=0.31 eps=0.026 rwsd=0.053
+i=4000 alp=5582.58 sig=-1.206 tau=2.89 a=0.22 0.19 b=0.97 0.83 w*=0.25 0.16 b2=2.81 2.40 alp2=1553.58 rhmc=0.50 rhyp=0.23 eps=0.029 rwsd=0.055
+i=6000 alp=5337.33 sig=-1.266 tau=2.48 a=0.20 0.18 b=0.97 1.08 w*=0.32 0.26 b2=2.41 2.67 alp2=1687.70 rhmc=0.90 rhyp=0.22 eps=0.013 rwsd=0.057
+i=8000 alp=4691.75 sig=-1.229 tau=2.39 a=0.22 0.18 b=1.13 0.95 w*=0.48 0.25 b2=2.70 2.27 alp2=1603.53 rhmc=0.94 rhyp=0.23 eps=0.013 rwsd=0.057
+i=10000 alp=5270.29 sig=-1.298 tau=2.43 a=0.20 0.17 b=1.10 0.92 w*=0.21 0.16 b2=2.67 2.22 alp2=1664.29 rhmc=0.94 rhyp=0.22 eps=0.013 rwsd=0.057
+i=12000 alp=4878.96 sig=-1.349 tau=2.09 a=0.20 0.18 b=1.35 1.25 w*=0.23 0.25 b2=2.82 2.62 alp2=1804.06 rhmc=0.94 rhyp=0.21 eps=0.013 rwsd=0.057
+i=14000 alp=4490.11 sig=-1.390 tau=1.97 a=0.21 0.18 b=1.50 1.33 w*=0.26 0.24 b2=2.95 2.61 alp2=1754.57 rhmc=0.94 rhyp=0.23 eps=0.013 rwsd=0.057
+i=16000 alp=5801.94 sig=-1.476 tau=2.04 a=0.19 0.16 b=1.86 1.43 w*=0.29 0.24 b2=3.79 2.91 alp2=2032.93 rhmc=0.94 rhyp=0.21 eps=0.013 rwsd=0.057
+i=18000 alp=5696.85 sig=-1.627 tau=1.82 a=0.20 0.15 b=2.03 1.56 w*=0.26 0.30 b2=3.69 2.83 alp2=2149.65 rhmc=0.94 rhyp=0.22 eps=0.013 rwsd=0.057
+i=20000 alp=3738.35 sig=-1.515 tau=1.52 a=0.20 0.17 b=2.30 1.77 w*=0.27 0.19 b2=3.50 2.70 alp2=1976.00 rhmc=0.94 rhyp=0.22 eps=0.013 rwsd=0.057
 -----------------------------------
 End MCMC
-Computation time: 0 hour(s) 1 minute(s)
+Computation time: 0 hour(s) 2 minute(s)
 -----------------------------------
 -----------------------------------
 Start parameters estimation for CGGP graphs: 500 samples
-Estimated end of computation: 08-Nov-2017 18:01:33 (0.0 hours)
+Estimated end of computation: 01-Feb-2020 17:40:17 (0.0 hours)
 |---------------------------------|
 |*********************************|
 End parameters estimation for CGGP graphs
 Computation time: 0.0 hours
 -----------------------------------
-

Some plots

% Identify each feature as liberal or conservative using ground truth
+

Some plots

% Identify each feature as liberal or conservative using ground truth
 % (This step would normally require a human interpretation of the features)
 [~, ind_features] = sort(median(community_affiliation(meta.isright,:), 1)./median(community_affiliation, 1));
 featnames = {'Liberal', 'Conservative'}; % Name of the interpreted features
@@ -171,24 +171,24 @@
 Confusion matrix (counts)
 -------------------------
 Group        : Feat 1 Feat 2 | Total
-Left         :    543     45 |   588
-Right        :     23    613 |   636
-Total        :    566    658 |  1224
+Left         :    532     56 |   588
+Right        :     27    609 |   636
+Total        :    559    665 |  1224
 -------------------------
 Confusion matrix (%)
 -------------------------
 Group        : Feat 1 Feat 2 | Total
-Left         :  44.36   3.68 | 48.04
-Right        :   1.88  50.08 | 51.96
-Total        :  46.24  53.76 |100.00
+Left         :  43.46   4.58 | 48.04
+Right        :   2.21  49.75 | 51.96
+Total        :  45.67  54.33 |100.00
 -------------------------
 Group assignments of features
 -------------------------
 Feat 1: Left
 Feat 2: Right
 -------------------------
-Accuracy = 94.44
-Error = 5.56
+Accuracy = 93.22
+Error = 6.78
 ==========================
 
% Plot levels of affiliation to each community for a subset of blogs
 color = [0 0 .8; .8 0 0];
@@ -213,9 +213,9 @@
 plot_nodesfeatures(community_affiliation, ind, ind_features, lab, featnames, color);
 
% Plot the graph by clustering the nodes by community with maximum level of affiliation to see block structure
 plot_sortedgraph(G, community_detection, community_detection, ind_features, labels);
-
\ No newline at end of file diff --git a/docs/demo_overlappingcommunity.png b/docs/demo_overlappingcommunity.png index e370266..15848b4 100644 Binary files a/docs/demo_overlappingcommunity.png and b/docs/demo_overlappingcommunity.png differ diff --git a/docs/demo_overlappingcommunity_01.png b/docs/demo_overlappingcommunity_01.png index 9013ed9..d584cae 100644 Binary files a/docs/demo_overlappingcommunity_01.png and b/docs/demo_overlappingcommunity_01.png differ diff --git a/docs/demo_overlappingcommunity_02.png b/docs/demo_overlappingcommunity_02.png index 5b7e788..e590ace 100644 Binary files a/docs/demo_overlappingcommunity_02.png and b/docs/demo_overlappingcommunity_02.png differ diff --git a/docs/demo_overlappingcommunity_03.png b/docs/demo_overlappingcommunity_03.png index 76f7507..a00f179 100644 Binary files a/docs/demo_overlappingcommunity_03.png and b/docs/demo_overlappingcommunity_03.png differ diff --git a/docs/demo_overlappingcommunity_04.png b/docs/demo_overlappingcommunity_04.png index c931f71..39e39cb 100644 Binary files a/docs/demo_overlappingcommunity_04.png and b/docs/demo_overlappingcommunity_04.png differ diff --git a/docs/demo_overlappingcommunity_05.png b/docs/demo_overlappingcommunity_05.png index e97850e..0e98ca8 100644 Binary files a/docs/demo_overlappingcommunity_05.png and b/docs/demo_overlappingcommunity_05.png differ diff --git a/docs/demo_polblogs.html b/docs/demo_polblogs.html index d04e7f7..d5d662c 100644 --- a/docs/demo_polblogs.html +++ b/docs/demo_polblogs.html @@ -6,7 +6,7 @@ Sparse Networks with Overlapping Communities (SNetOC) package: demo_polblogs

Sparse Networks with Overlapping Communities (SNetOC) package: demo_polblogs

This Matlab script performs posterior inference on a network of political blogs to find latent overlapping communities, using a Bayesian nonparametric approach.

For downloading the package and information on installation, visit the SNetOC webpage.

Reference:

Authors:

Tested on Matlab R2016a. Requires the Statistics toolbox.

Last Modified: 10/2017

Contents

General settings

clear
+  

Sparse Networks with Overlapping Communities (SNetOC) package: demo_polblogs

This Matlab script performs posterior inference on a network of political blogs to find latent overlapping communities, using a Bayesian nonparametric approach.

For downloading the package and information on installation, visit the SNetOC webpage.

Reference:

Authors:

Tested on Matlab R2017a. Requires the Statistics toolbox.

Last Modified: 01/2020

Contents

General settings

clear
 close all
 tstart = clock; % Starting time
 
@@ -89,7 +89,7 @@
 
 % Set the seed
 rng default
-

Load network of political blogs

Data can be downloaded from here.

load ./data/polblogs/polblogs.mat
+

Load network of political blogs

Data can be downloaded from here.

load ./data/polblogs/polblogs.mat
 
 titlenetwork = 'Political blogosphere Feb. 2005';
 name = 'polblogs';
@@ -101,6 +101,7 @@
 G = logical(G-diag(diag(G))); % remove self edges (#3)
 
 % Collect metadata
+clear meta
 meta.name = cellstr(Problem.aux.nodename);
 meta.source = cellstr(Problem.aux.nodesource);
 meta.isright = logical(Problem.aux.nodevalue);
@@ -120,7 +121,7 @@
 end
 
 % Plot adjacency matrix (sorted)
-figure('name', 'Adjacency matrix (sorted by ground truth political leaning)')
+figure('name', 'Adjacency matrix (sorted by ground truth political leaning)');
 spy(G);
 xlabel(labels{2})
 ylabel(labels{1})
@@ -132,15 +133,15 @@
 end
 
 % Plot adjacency matrix (unsorted)
-figure('name', 'Adjacency matrix (unsorted)')
+figure('name', 'Adjacency matrix (unsorted)');
 spy(G);
 xlabel(labels{2})
 ylabel(labels{1})
 
% Plot degree distribution
-figure('name', 'Empirical degree distribution')
+figure('name', 'Empirical degree distribution');
 hdeg = plot_degree(G);
 set(hdeg, 'markersize', 10, 'marker', 'o','markeredgecolor', 'none', 'markerfacecolor', [1, .75, .75]);
-

Posterior Inference using Markov chain Monte Carlo and point estimation

Users needs to start the parallel pool by using the command parpool to run multiple chains in parallel.

% Define the parameters of the prior
+

Posterior Inference using Markov chain Monte Carlo and point estimation

Users needs to start the parallel pool by using the command parpool to run multiple chains in parallel.

% Define the parameters of the prior
 p = 2; % Number of commmunities
 objprior =  graphmodel('CGGP', p); % CGGP graph model with p communities
 
@@ -150,18 +151,19 @@
     niterinit = 1000;
     niter = 10000;
     nsamples = 100;
+    ndraws = 100;
 else
     niterinit = 10000;
-    niter = 200000;
-    nsamples = 500;
+    niter = 2e6;
+    nsamples = 1000;
+    ndraws = 500;
 end
 nburn = floor(niter/2);
-
 thin = ceil((niter-nburn)/nsamples);
 verbose = true;
 
 % Create the graphMCMC object
-objmcmc = graphmcmc(objprior, niter, nburn, thin, nchains);
+objmcmc = graphmcmc(objprior, niter, 0, thin, nchains);
 
 % Run initialisation
 init = graphinit(objmcmc, G, niterinit);
@@ -173,58 +175,84 @@
 
% Run MCMC sampler
 objmcmc = graphmcmcsamples(objmcmc, G, verbose, init);
 
-----------------------------------
-Start MCMC for CGGP graphs
-Nb of nodes: 1224 - Nb of edges: 16715 (0 missing)
+Start MCMC for undirected CGGP graphs
+Nb of nodes: 1224x1224 - Nb of edges: 16715 (0 missing)
 Nb of chains: 3 - Nb of iterations: 10000
-Nb of parallel workers: 1
-Estimated computation time: 0 hour(s) 2 minute(s)
-Estimated end of computation: 08-Nov-2017 18:03:33 
+Estimated computation time: 0 hour(s) 3 minute(s)
+Estimated end of computation: 01-Feb-2020 17:43:48 
 -----------------------------------
  Markov chain 1/3 
 -----------------------------------
-i=2000 alp=853.49 sig=-0.318 tau=2.23 a=0.22 0.20 b=0.41 0.51 w*=0.52 0.40 b2=0.91 1.13 alp2=661.59 rhmc=0.68 rhyp=0.32 eps=0.028 rwsd=0.054
-i=4000 alp=1625.62 sig=-0.482 tau=3.37 a=0.20 0.16 b=0.40 0.31 w*=0.46 0.50 b2=1.35 1.04 alp2=905.44 rhmc=0.72 rhyp=0.23 eps=0.022 rwsd=0.054
-i=6000 alp=1787.89 sig=-0.462 tau=4.23 a=0.17 0.14 b=0.27 0.23 w*=0.51 0.52 b2=1.14 0.99 alp2=917.85 rhmc=0.83 rhyp=0.24 eps=0.022 rwsd=0.054
-i=8000 alp=1899.11 sig=-0.474 tau=4.23 a=0.16 0.14 b=0.27 0.26 w*=0.56 0.43 b2=1.14 1.11 alp2=958.50 rhmc=0.83 rhyp=0.26 eps=0.022 rwsd=0.054
-i=10000 alp=1988.12 sig=-0.496 tau=3.79 a=0.15 0.13 b=0.30 0.32 w*=0.47 0.36 b2=1.13 1.22 alp2=1026.23 rhmc=0.82 rhyp=0.23 eps=0.022 rwsd=0.054
+i=2000 alp=3249.79 sig=-1.140 tau=2.07 a=0.26 0.21 b=1.43 1.03 w*=0.19 0.19 b2=2.96 2.13 alp2=1419.80 rhmc=0.78 rhyp=0.58 eps=0.026 rwsd=0.02
+i=4000 alp=4982.05 sig=-1.448 tau=1.99 a=0.22 0.20 b=1.81 1.55 w*=0.28 0.26 b2=3.62 3.09 alp2=1834.40 rhmc=0.76 rhyp=0.61 eps=0.026 rwsd=0.02
+i=6000 alp=4427.75 sig=-1.551 tau=1.62 a=0.20 0.17 b=1.99 1.92 w*=0.25 0.21 b2=3.21 3.10 alp2=2098.72 rhmc=0.77 rhyp=0.62 eps=0.026 rwsd=0.02
+i=8000 alp=4211.75 sig=-1.656 tau=1.43 a=0.18 0.16 b=2.46 2.20 w*=0.29 0.19 b2=3.51 3.14 alp2=2336.68 rhmc=0.77 rhyp=0.62 eps=0.026 rwsd=0.02
+i=10000 alp=3414.97 sig=-2.324 tau=1.02 a=0.19 0.15 b=5.43 5.08 w*=0.29 0.28 b2=5.52 5.16 alp2=3288.22 rhmc=0.77 rhyp=0.64 eps=0.026 rwsd=0.02
 -----------------------------------
  Markov chain 2/3 
 -----------------------------------
-i=2000 alp=704.00 sig=-0.235 tau=2.52 a=0.21 0.21 b=0.44 0.32 w*=0.50 0.55 b2=1.11 0.80 alp2=566.75 rhmc=0.67 rhyp=0.32 eps=0.024 rwsd=0.054
-i=4000 alp=1259.23 sig=-0.379 tau=3.55 a=0.16 0.17 b=0.28 0.25 w*=0.41 0.56 b2=1.00 0.87 alp2=779.78 rhmc=0.77 rhyp=0.23 eps=0.022 rwsd=0.052
-i=6000 alp=1958.77 sig=-0.467 tau=4.44 a=0.14 0.18 b=0.21 0.28 w*=0.43 0.47 b2=0.92 1.23 alp2=976.18 rhmc=0.82 rhyp=0.25 eps=0.022 rwsd=0.052
-i=8000 alp=2059.08 sig=-0.505 tau=4.33 a=0.15 0.17 b=0.27 0.31 w*=0.46 0.42 b2=1.16 1.32 alp2=983.15 rhmc=0.82 rhyp=0.25 eps=0.022 rwsd=0.052
-i=10000 alp=1942.87 sig=-0.493 tau=3.97 a=0.15 0.17 b=0.31 0.23 w*=0.34 0.54 b2=1.21 0.90 alp2=984.37 rhmc=0.81 rhyp=0.26 eps=0.022 rwsd=0.052
+i=2000 alp=3246.03 sig=-1.072 tau=2.31 a=0.24 0.26 b=1.12 1.10 w*=0.18 0.25 b2=2.60 2.55 alp2=1323.28 rhmc=0.77 rhyp=0.56 eps=0.026 rwsd=0.02
+i=4000 alp=4493.17 sig=-1.340 tau=2.00 a=0.19 0.23 b=1.19 1.61 w*=0.19 0.24 b2=2.38 3.23 alp2=1768.96 rhmc=0.76 rhyp=0.62 eps=0.026 rwsd=0.02
+i=6000 alp=4308.25 sig=-1.421 tau=1.85 a=0.18 0.21 b=1.72 1.67 w*=0.22 0.32 b2=3.18 3.10 alp2=1796.74 rhmc=0.77 rhyp=0.62 eps=0.026 rwsd=0.02
+i=8000 alp=4349.56 sig=-1.617 tau=1.48 a=0.16 0.21 b=2.55 2.63 w*=0.24 0.33 b2=3.78 3.89 alp2=2301.32 rhmc=0.76 rhyp=0.62 eps=0.026 rwsd=0.02
+i=10000 alp=3910.44 sig=-2.229 tau=1.09 a=0.16 0.18 b=4.76 4.35 w*=0.35 0.32 b2=5.19 4.74 alp2=3225.01 rhmc=0.77 rhyp=0.63 eps=0.026 rwsd=0.02
 -----------------------------------
  Markov chain 3/3 
 -----------------------------------
-i=2000 alp=444.90 sig=-0.129 tau=1.93 a=0.22 0.23 b=0.19 0.32 w*=0.49 0.45 b2=0.37 0.61 alp2=408.74 rhmc=0.68 rhyp=0.32 eps=0.038 rwsd=0.052
-i=4000 alp=1226.02 sig=-0.358 tau=4.20 a=0.19 0.17 b=0.20 0.21 w*=0.46 0.40 b2=0.86 0.89 alp2=733.18 rhmc=0.70 rhyp=0.24 eps=0.021 rwsd=0.053
-i=6000 alp=1367.94 sig=-0.376 tau=4.33 a=0.17 0.15 b=0.20 0.22 w*=0.52 0.39 b2=0.88 0.94 alp2=788.40 rhmc=0.84 rhyp=0.24 eps=0.021 rwsd=0.053
-i=8000 alp=2250.42 sig=-0.499 tau=5.26 a=0.18 0.14 b=0.24 0.20 w*=0.48 0.38 b2=1.26 1.07 alp2=981.84 rhmc=0.84 rhyp=0.25 eps=0.021 rwsd=0.053
-i=10000 alp=2427.51 sig=-0.534 tau=5.11 a=0.16 0.15 b=0.20 0.25 w*=0.47 0.45 b2=1.04 1.26 alp2=1015.77 rhmc=0.84 rhyp=0.23 eps=0.021 rwsd=0.053
+i=2000 alp=3738.08 sig=-1.111 tau=2.46 a=0.26 0.22 b=1.29 1.06 w*=0.19 0.19 b2=3.17 2.61 alp2=1372.81 rhmc=0.78 rhyp=0.57 eps=0.026 rwsd=0.02
+i=4000 alp=5398.35 sig=-1.522 tau=1.97 a=0.22 0.19 b=1.88 2.02 w*=0.34 0.23 b2=3.70 3.98 alp2=1929.61 rhmc=0.76 rhyp=0.59 eps=0.026 rwsd=0.02
+i=6000 alp=4418.70 sig=-1.813 tau=1.39 a=0.20 0.17 b=3.14 2.35 w*=0.23 0.20 b2=4.36 3.26 alp2=2434.37 rhmc=0.77 rhyp=0.61 eps=0.026 rwsd=0.02
+i=8000 alp=3651.00 sig=-2.261 tau=1.07 a=0.18 0.16 b=5.63 4.46 w*=0.20 0.26 b2=6.01 4.76 alp2=3152.50 rhmc=0.78 rhyp=0.63 eps=0.026 rwsd=0.02
+i=10000 alp=2840.48 sig=-2.933 tau=0.87 a=0.16 0.15 b=7.24 8.36 w*=0.34 0.25 b2=6.31 7.29 alp2=4245.54 rhmc=0.76 rhyp=0.63 eps=0.026 rwsd=0.02
 -----------------------------------
 End MCMC
-Computation time: 0 hour(s) 2 minute(s)
+Computation time: 0 hour(s) 3 minute(s)
 -----------------------------------
 
% Print summary in text file
 print_summary(['summary_' num2str(p) 'f.txt'], titlenetwork, G, niter, nburn, nchains, thin, p, outpath, tstart)
-
% Point estimation of the model parameters
-[estimates, C_st] = graphest(objmcmc);
 
 % Save workspace
-save(fullfile(outpath, ['workspace_' num2str(p) 'f.mat']))
+save(fullfile(outpath, ['workspace_' num2str(p) 'f.mat']), '-v7.3')
+
% Log posterior approximation
+[lp_nonlat, lp_lat, ll_nonlat, ll_lat] = logpost_approx(objmcmc, G);
+
% Compute identifiable parameters
+for ch = 1:size(objmcmc.samples, 2)
+    S = objmcmc.samples(1,ch);
+    objmcmc.samples(1,ch).varsigma1 = -S.alpha .* S.tau.^S.sigma ./ S.sigma;
+    a_sigma = S.Fparam.a.*S.sigma;
+    objmcmc.samples(1,ch).varsigma2 = -a_sigma./S.Fparam.b2;
+    objmcmc.samples(1,ch).varsigma3 = a_sigma.*(S.sigma-S.Fparam.a-1)./(S.Fparam.b2.^2);
+end
+

discard burnin

objmcmc_noburn = objmcmc;
+objmcmc_noburn.samples = discard(objmcmc.samples, floor(nburn/objmcmc.settings.thin));
+objmcmc_noburn.settings.nburn = nburn;
+

Point estimation of the model parameters

[estimates, C_st] = graphest(objmcmc_noburn);
 
-----------------------------------
 Start parameters estimation for CGGP graphs: 300 samples
-Estimated end of computation: 08-Nov-2017 18:03:38 (0.0 hours)
+Estimated end of computation: 01-Feb-2020 17:44:39 (0.0 hours)
 |---------------------------------|
 |*********************************|
 End parameters estimation for CGGP graphs
 Computation time: 0.0 hours
 -----------------------------------
-

Plots

prefix = sprintf('%s_%df_', name, p);
+

Plots

prefix = sprintf('%s_%df_', name, p);
 suffix = '';
-
% Identify each feature to left/right wing using ground truth
+
% Plot Log posterior approximation
+iter = (1:size(lp_nonlat,1))*thin;
+plot_logpost(lp_nonlat, iter, [], 'Log-posterior', outpath, prefix, '_nonlat');
+plot_logpost(lp_lat, iter, [], 'Log-posterior', outpath, prefix, '_lat');
+
+% Plot log-posterior autocorr
+lp_nonlat_noburn = lp_nonlat(floor(nburn/niter*size(lp_nonlat, 1)):end, :);
+lp_lat_noburn = lp_lat(floor(nburn/niter*size(lp_lat, 1)):end, :);
+plot_autocorr_logpost(lp_nonlat_noburn, thin, 'Log-posterior', outpath, prefix, '_nonlat');
+plot_autocorr_logpost(lp_lat_noburn, thin, 'Log-posterior', outpath, prefix, '_lat');
+
+% Plot cost
+if ~isempty(C_st)
+    plot_cost(C_st, outpath, prefix, suffix);
+end
+
% Identify each feature to left/right wing using ground truth
 % (This step would normally require a human interpretation of the features)
 [~, ind_features] = sort(median(estimates.w(meta.isright,:), 1)./median(estimates.w, 1));
 featnames = {'Liberal', 'Conservative'};
@@ -238,35 +266,31 @@
 Confusion matrix (counts)
 -------------------------
 Group        : Feat 1 Feat 2 | Total
-Left         :    530     58 |   588
+Left         :    533     55 |   588
 Right        :     22    614 |   636
-Total        :    552    672 |  1224
+Total        :    555    669 |  1224
 -------------------------
 Confusion matrix (%)
 -------------------------
 Group        : Feat 1 Feat 2 | Total
-Left         :  43.30   4.74 | 48.04
+Left         :  43.55   4.49 | 48.04
 Right        :   1.80  50.16 | 51.96
-Total        :  45.10  54.90 |100.00
+Total        :  45.34  54.66 |100.00
 -------------------------
 Group assignments of features
 -------------------------
 Feat 1: Left
 Feat 2: Right
 -------------------------
-Accuracy = 93.46
-Error = 6.54
+Accuracy = 93.71
+Error = 6.29
 ==========================
 
% Plot traces and histograms
-variables = {'logalpha', 'sigma', 'tau', 'Fparam.a', 'Fparam.b', 'mean_w_rem'};
-namesvar = {'$\log \alpha$', '$\sigma$', '$\tau$', '$a$', '$b$', '$\overline{w}_{\ast}$'};
+variables = {'varsigma1', 'varsigma2', 'varsigma3', 'mean_w_rem'};
+namesvar = {'$\varsigma_1$', '$\varsigma_2$', '$\varsigma_3$', '$\overline{w}_{\ast}$'};
 plot_trace(objmcmc.samples, objmcmc.settings, variables, namesvar, [], outpath, prefix, suffix);
-plot_hist(objmcmc.samples, variables, namesvar, [], ind_features, [], outpath, prefix, suffix);
-
% Plot cost
-if ~isempty(C_st)
-    plot_cost(C_st, outpath, prefix, suffix);
-end
-
% Plot the graph by sorting the nodes by max feature to see block structure
+plot_hist(objmcmc_noburn.samples, variables, namesvar, [], ind_features, [], outpath, prefix, suffix);
+
% Plot the graph by sorting the nodes by max feature to see block structure
 plot_sortedgraph(G, nodefeat, nodefeat, ind_features, labels, outpath, prefix, suffix, {'png'});
 
% Show the proportion in each features for a few nodes
 if p==2
@@ -342,22 +366,22 @@
 #274, talkingpointsmemo.com (L). 
 #218, washingtonmonthly.com (L). 
 #171, liberaloasis.com (L). 
-#147, digbysblog.blogspot.com (L). 
-#170, juancole.com (L). 
-#149, newleftblogs.blogspot.com (L). 
 #137, politicalstrategy.org (L). 
+#170, juancole.com (L). 
 #144, pandagon.net (L). 
+#149, newleftblogs.blogspot.com (L). 
+#147, digbysblog.blogspot.com (L). 
 & %--- FEATURE 2 ---
 #306, instapundit.com (R). 
 #301, blogsforbush.com (R). 
-#211, michellemalkin.com (R). 
-#223, powerlineblog.com (R). 
+#243, drudgereport.com (R). 
 #182, hughhewitt.com (R). 
 #196, littlegreenfootballs.com/weblog (R). 
-#243, drudgereport.com (R). 
-#179, wizbangblog.com (R). 
-#170, lashawnbarber.com (R). 
+#223, powerlineblog.com (R). 
+#211, michellemalkin.com (R). 
 #199, truthlaidbear.com (R). 
+#170, lashawnbarber.com (R). 
+#179, wizbangblog.com (R). 
 -----------------------------------
 
% Correlation between the features
 figure('name', 'Correlation between features');
@@ -369,15 +393,15 @@
 ylabel('Feature')
 title('Correlation between features')
 
% Plot posterior predictive of degree distribution
-plot_degreepostpred(G, objmcmc, nsamples, 1e-6, outpath, prefix, suffix);
+plot_degreepostpred(G, objmcmc_noburn, ndraws, 1e-6, outpath, prefix, suffix);
 
-----------------------------------
 Start degree posterior predictive estimation: 100 draws
-Estimated end of computation: 08-Nov-2017 18:04:16 (0.0 hours)
+Estimated end of computation: 01-Feb-2020 17:46:06 (0.0 hours)
 |---------------------------------|
 |*********************************|
 End degree posterior predictive (0.0 hours)
 -----------------------------------
-
\ No newline at end of file diff --git a/docs/demo_polblogs.png b/docs/demo_polblogs.png index f33463d..664f29a 100644 Binary files a/docs/demo_polblogs.png and b/docs/demo_polblogs.png differ diff --git a/docs/demo_polblogs_01.png b/docs/demo_polblogs_01.png index 6f00073..9f86276 100644 Binary files a/docs/demo_polblogs_01.png and b/docs/demo_polblogs_01.png differ diff --git a/docs/demo_polblogs_02.png b/docs/demo_polblogs_02.png index 2f46402..3e80153 100644 Binary files a/docs/demo_polblogs_02.png and b/docs/demo_polblogs_02.png differ diff --git a/docs/demo_polblogs_03.png b/docs/demo_polblogs_03.png index 56a8c41..f585186 100644 Binary files a/docs/demo_polblogs_03.png and b/docs/demo_polblogs_03.png differ diff --git a/docs/demo_polblogs_04.png b/docs/demo_polblogs_04.png index 4957718..075d9e4 100644 Binary files a/docs/demo_polblogs_04.png and b/docs/demo_polblogs_04.png differ diff --git a/docs/demo_polblogs_05.png b/docs/demo_polblogs_05.png index 19f0696..45a6be7 100644 Binary files a/docs/demo_polblogs_05.png and b/docs/demo_polblogs_05.png differ diff --git a/docs/demo_polblogs_06.png b/docs/demo_polblogs_06.png index 6729547..b375067 100644 Binary files a/docs/demo_polblogs_06.png and b/docs/demo_polblogs_06.png differ diff --git a/docs/demo_polblogs_07.png b/docs/demo_polblogs_07.png index fff6bc5..f80703f 100644 Binary files a/docs/demo_polblogs_07.png and b/docs/demo_polblogs_07.png differ diff --git a/docs/demo_polblogs_08.png b/docs/demo_polblogs_08.png index f8feb2f..86f8fed 100644 Binary files a/docs/demo_polblogs_08.png and b/docs/demo_polblogs_08.png differ diff --git a/docs/demo_polblogs_09.png b/docs/demo_polblogs_09.png index ba74b44..c8d0749 100644 Binary files a/docs/demo_polblogs_09.png and b/docs/demo_polblogs_09.png differ diff --git a/docs/demo_polblogs_10.png b/docs/demo_polblogs_10.png index 26a1294..ce044b5 100644 Binary files a/docs/demo_polblogs_10.png and b/docs/demo_polblogs_10.png differ diff --git a/docs/demo_polblogs_11.png b/docs/demo_polblogs_11.png index 1d0be94..adf9f3f 100644 Binary files a/docs/demo_polblogs_11.png and b/docs/demo_polblogs_11.png differ diff --git a/docs/demo_polblogs_12.png b/docs/demo_polblogs_12.png index 96884c2..f27ac6b 100644 Binary files a/docs/demo_polblogs_12.png and b/docs/demo_polblogs_12.png differ diff --git a/docs/demo_polblogs_13.png b/docs/demo_polblogs_13.png index feb7522..b127f95 100644 Binary files a/docs/demo_polblogs_13.png and b/docs/demo_polblogs_13.png differ diff --git a/docs/demo_polblogs_14.png b/docs/demo_polblogs_14.png index f0a224c..d89639f 100644 Binary files a/docs/demo_polblogs_14.png and b/docs/demo_polblogs_14.png differ diff --git a/docs/demo_polblogs_15.png b/docs/demo_polblogs_15.png index 795ba94..d4ee913 100644 Binary files a/docs/demo_polblogs_15.png and b/docs/demo_polblogs_15.png differ diff --git a/docs/demo_polblogs_16.png b/docs/demo_polblogs_16.png index 5a4a6aa..b0e24c6 100644 Binary files a/docs/demo_polblogs_16.png and b/docs/demo_polblogs_16.png differ diff --git a/docs/demo_polblogs_17.png b/docs/demo_polblogs_17.png index 05a6495..f671419 100644 Binary files a/docs/demo_polblogs_17.png and b/docs/demo_polblogs_17.png differ diff --git a/docs/demo_polblogs_18.png b/docs/demo_polblogs_18.png index 5047b29..69b8175 100644 Binary files a/docs/demo_polblogs_18.png and b/docs/demo_polblogs_18.png differ diff --git a/docs/demo_polblogs_19.png b/docs/demo_polblogs_19.png index 154692b..b723f41 100644 Binary files a/docs/demo_polblogs_19.png and b/docs/demo_polblogs_19.png differ diff --git a/docs/demo_polblogs_20.png b/docs/demo_polblogs_20.png index 323162b..8f25d49 100644 Binary files a/docs/demo_polblogs_20.png and b/docs/demo_polblogs_20.png differ diff --git a/docs/demo_polblogs_21.png b/docs/demo_polblogs_21.png index 2f529e0..ddd3c89 100644 Binary files a/docs/demo_polblogs_21.png and b/docs/demo_polblogs_21.png differ diff --git a/docs/demo_polblogs_22.png b/docs/demo_polblogs_22.png index 1e61404..3907460 100644 Binary files a/docs/demo_polblogs_22.png and b/docs/demo_polblogs_22.png differ diff --git a/docs/demo_polblogs_23.png b/docs/demo_polblogs_23.png index 93f35ef..ebb0c36 100644 Binary files a/docs/demo_polblogs_23.png and b/docs/demo_polblogs_23.png differ diff --git a/docs/demo_polblogs_24.png b/docs/demo_polblogs_24.png index ef9f76c..1201c26 100644 Binary files a/docs/demo_polblogs_24.png and b/docs/demo_polblogs_24.png differ diff --git a/docs/demo_simulations.html b/docs/demo_simulations.html index ff792c1..871ffb3 100644 --- a/docs/demo_simulations.html +++ b/docs/demo_simulations.html @@ -6,7 +6,7 @@ Sparse Networks with Overlapping Communities (SNetOC) package: demo_simulations

Sparse Networks with Overlapping Communities (SNetOC) package: demo_simulations

This Matlab script performs posterior inference on a (sparse) simulated graph with overlapping communities.

For downloading the package and information on installation, visit the SNetOC webpage.

Reference:

Authors:

Tested on Matlab R2016a. Requires the Statistics toolbox.

Last Modified: 10/10/2017

Contents

General settings

close all
+  

Sparse Networks with Overlapping Communities (SNetOC) package: demo_simulations

This Matlab script performs posterior inference on a (sparse) simulated graph with overlapping communities.

For downloading the package and information on installation, visit the SNetOC webpage.

Reference:

Authors:

Tested on Matlab R2017a. Requires the Statistics toolbox.

Last Modified: 01/2020

Contents

General settings

close all
 clearvars
 
 tstart = clock; % Starting time
@@ -87,11 +87,13 @@
 % Add path
 addpath ./GGP/ ./CGGP/ ./utils/
 
-set(0, 'DefaultAxesFontSize', 14)
+set(0, 'defaultAxesFontSize', 16)
+set(0, 'defaultTextInterpreter', 'latex');
+set(0, 'defaultAxesTickLabelInterpreter', 'latex');
 
 % Set the seed
-rng default
-

Sample a CGGP graph

titlenetwork = 'Simulated simple graph';
+rng(22)
+

Sample a CGGP graph

titlenetwork = 'Simulated simple graph';
 name = 'simugraph';
 labels = {'Nodes', 'Nodes'};
 
@@ -99,9 +101,10 @@
 p = 2;
 alpha_true = 200; sigma_true = 0.2; tau_true = 1; observe_all_true = false;
 Fdist_true.name = 'gamma'; Fdist_true.param.b = 1/p; Fdist_true.param.a = 0.2;
-obj = graphmodel('CGGP', p, alpha_true, sigma_true, tau_true, Fdist_true);
+gamma_true = zeros(p,1);
+obj = graphmodel('CGGP', p, alpha_true, sigma_true, tau_true, Fdist_true, gamma_true, 'undirected', observe_all_true);
 % Sample a CGGP graph
-[G, w_true, w_rem_true] = graphrnd(obj, 1e-6);
+[G, w_true, w_rem_true] = graphrnd(obj, 1e-9);
 
 nnodes = size(G, 1);
 nedges = nnz(G);
@@ -118,22 +121,31 @@
 xlabel('Nodes')
 ylabel('Nodes')
 title('Adjacency Matrix')
-
+
CGGP graph with 1268 nodes and 7930 edges sampled
+
% Plot the graph by sorting the nodes by max feature
+[~,indk] = max(w_true,[],2);
+[~,ind] = sort(indk, 'descend');
+figure
+spy(G(ind, ind))
+xlabel('Nodes')
+ylabel('Nodes')
+title('Sorted Adjacency Matrix')
+
% Plot degree distribution
 figure('name', 'Empirical degree distribution')
 hdeg = plot_degree(G);
 set(hdeg, 'markersize', 10, 'marker', 'o','markeredgecolor', 'none', 'markerfacecolor', [1, .75, .75]);
-
CGGP graph with 1079 nodes and 5679 edges sampled
-

Prior distribution

p = 2;
-objprior =  graphmodel('CGGP', p);
-

Posterior inference

% Parameters of the MCMC algorithm
+

Prior distribution

objprior =  graphmodel('CGGP', p);
+

Posterior inference

% Parameters of the MCMC algorithm
 if istest
     niterinit = 100;
     niter = 20000;
     nsamples = 100; % Nb of Monte Carlo samples to return
+    ndraws = 100;
 else
     niterinit = 10000;
     niter = 200000;
     nsamples = 500;
+    ndraws = 500;
 end
 nburn = floor(3*niter/4); nchains = 3;
 thin = ceil((niter-nburn)/nsamples);
@@ -150,161 +162,149 @@
 -----------------------------------
 End initialisation
 -----------------------------------
-
% Run MCMC sampler
-objmcmc = graphmcmcsamples(objmcmc, G, verbose, init);
+
T = 1e-3;
+
+% Run MCMC sampler
+objmcmc = graphmcmcsamples(objmcmc, G, verbose, init, 'T', T);
 
-----------------------------------
-Start MCMC for CGGP graphs
-Nb of nodes: 1079 - Nb of edges: 5679 (0 missing)
+Start MCMC for undirected CGGP graphs
+Nb of nodes: 1268x1268 - Nb of edges: 7930 (0 missing)
 Nb of chains: 3 - Nb of iterations: 20000
-Nb of parallel workers: 1
-Estimated computation time: 0 hour(s) 4 minute(s)
-Estimated end of computation: 08-Nov-2017 18:10:00 
+Estimated computation time: 0 hour(s) 7 minute(s)
+Estimated end of computation: 01-Feb-2020 17:57:09 
 -----------------------------------
  Markov chain 1/3 
 -----------------------------------
-i=2000 alp=136.49 sig=0.239 tau=1.10 a=0.37 0.42 b=0.76 0.93 w*=1.25 1.49 b2=0.83 1.02 alp2=139.77 rhmc=0.83 rhyp=0.56 eps=0.027 rwsd=0.02
-i=4000 alp=134.96 sig=0.263 tau=1.05 a=0.25 0.37 b=0.40 0.67 w*=1.54 1.62 b2=0.42 0.70 alp2=136.81 rhmc=0.78 rhyp=0.59 eps=0.027 rwsd=0.02
-i=6000 alp=145.91 sig=0.222 tau=1.24 a=0.22 0.27 b=0.34 0.43 w*=1.16 1.40 b2=0.42 0.54 alp2=153.11 rhmc=0.78 rhyp=0.60 eps=0.027 rwsd=0.02
-i=8000 alp=150.12 sig=0.243 tau=1.09 a=0.24 0.27 b=0.36 0.58 w*=1.40 1.41 b2=0.39 0.63 alp2=153.14 rhmc=0.76 rhyp=0.61 eps=0.027 rwsd=0.02
-i=10000 alp=200.69 sig=0.181 tau=1.92 a=0.24 0.28 b=0.44 0.51 w*=1.48 1.45 b2=0.84 0.99 alp2=225.94 rhmc=0.77 rhyp=0.59 eps=0.027 rwsd=0.02
-i=12000 alp=211.24 sig=0.152 tau=2.21 a=0.22 0.26 b=0.31 0.41 w*=1.48 1.51 b2=0.69 0.91 alp2=238.27 rhmc=0.76 rhyp=0.60 eps=0.027 rwsd=0.02
-i=14000 alp=208.43 sig=0.166 tau=2.16 a=0.25 0.25 b=0.44 0.45 w*=1.42 1.50 b2=0.96 0.96 alp2=236.93 rhmc=0.76 rhyp=0.61 eps=0.027 rwsd=0.02
-i=16000 alp=225.19 sig=0.141 tau=2.19 a=0.23 0.23 b=0.48 0.49 w*=1.14 1.37 b2=1.06 1.07 alp2=251.49 rhmc=0.78 rhyp=0.61 eps=0.027 rwsd=0.02
-i=18000 alp=224.65 sig=0.148 tau=2.02 a=0.21 0.22 b=0.47 0.53 w*=1.40 1.32 b2=0.95 1.07 alp2=249.24 rhmc=0.78 rhyp=0.62 eps=0.027 rwsd=0.02
-i=20000 alp=214.54 sig=0.179 tau=1.67 a=0.24 0.23 b=0.51 0.52 w*=1.55 1.50 b2=0.86 0.87 alp2=235.14 rhmc=0.79 rhyp=0.62 eps=0.027 rwsd=0.02
+i=2000 alp=143.51 sig=0.247 tau=0.98 a=0.41 0.35 b=0.94 0.67 w*=1.47 1.19 b2=0.92 0.66 alp2=142.97 rhmc=0.66 rhyp=0.51 eps=0.025 rwsd=0.02
+i=4000 alp=135.02 sig=0.263 tau=0.97 a=0.33 0.31 b=0.63 0.54 w*=1.34 1.18 b2=0.61 0.52 alp2=133.82 rhmc=0.51 rhyp=0.55 eps=0.025 rwsd=0.02
+i=6000 alp=160.56 sig=0.211 tau=1.26 a=0.30 0.28 b=0.64 0.52 w*=1.29 1.06 b2=0.81 0.66 alp2=168.69 rhmc=0.45 rhyp=0.57 eps=0.025 rwsd=0.02
+i=8000 alp=164.70 sig=0.226 tau=1.35 a=0.26 0.26 b=0.45 0.42 w*=1.36 1.11 b2=0.61 0.57 alp2=176.22 rhmc=0.45 rhyp=0.55 eps=0.025 rwsd=0.02
+i=10000 alp=123.12 sig=0.282 tau=1.37 a=0.26 0.30 b=0.37 0.49 w*=1.30 1.08 b2=0.50 0.66 alp2=134.47 rhmc=0.50 rhyp=0.57 eps=0.025 rwsd=0.02
+i=12000 alp=152.43 sig=0.237 tau=1.30 a=0.25 0.25 b=0.34 0.37 w*=1.36 1.11 b2=0.45 0.49 alp2=162.25 rhmc=0.47 rhyp=0.57 eps=0.025 rwsd=0.02
+i=14000 alp=145.59 sig=0.244 tau=1.06 a=0.26 0.22 b=0.41 0.33 w*=1.23 1.15 b2=0.44 0.35 alp2=147.75 rhmc=0.44 rhyp=0.57 eps=0.025 rwsd=0.02
+i=16000 alp=163.92 sig=0.243 tau=1.17 a=0.22 0.22 b=0.38 0.37 w*=1.27 1.16 b2=0.45 0.43 alp2=170.38 rhmc=0.42 rhyp=0.57 eps=0.025 rwsd=0.02
+i=18000 alp=140.85 sig=0.259 tau=0.96 a=0.24 0.22 b=0.44 0.32 w*=1.38 1.20 b2=0.43 0.31 alp2=139.48 rhmc=0.46 rhyp=0.57 eps=0.025 rwsd=0.02
+i=20000 alp=157.80 sig=0.249 tau=0.81 a=0.23 0.23 b=0.46 0.37 w*=1.25 1.28 b2=0.37 0.30 alp2=149.82 rhmc=0.43 rhyp=0.56 eps=0.025 rwsd=0.02
 -----------------------------------
  Markov chain 2/3 
 -----------------------------------
-i=2000 alp=62.14 sig=0.335 tau=1.34 a=0.44 0.33 b=0.31 0.16 w*=1.51 1.81 b2=0.41 0.22 alp2=68.62 rhmc=0.83 rhyp=0.53 eps=0.027 rwsd=0.02
-i=4000 alp=81.95 sig=0.286 tau=1.29 a=0.36 0.29 b=0.25 0.17 w*=1.41 1.46 b2=0.32 0.22 alp2=88.11 rhmc=0.78 rhyp=0.58 eps=0.027 rwsd=0.02
-i=6000 alp=74.46 sig=0.298 tau=1.45 a=0.31 0.34 b=0.20 0.20 w*=1.44 1.42 b2=0.29 0.30 alp2=83.15 rhmc=0.77 rhyp=0.58 eps=0.027 rwsd=0.02
-i=8000 alp=85.08 sig=0.295 tau=1.18 a=0.24 0.31 b=0.14 0.23 w*=1.47 1.54 b2=0.17 0.28 alp2=89.38 rhmc=0.79 rhyp=0.59 eps=0.027 rwsd=0.02
-i=10000 alp=104.65 sig=0.257 tau=1.60 a=0.26 0.26 b=0.18 0.20 w*=1.52 1.29 b2=0.30 0.32 alp2=118.14 rhmc=0.78 rhyp=0.60 eps=0.027 rwsd=0.02
-i=12000 alp=141.80 sig=0.224 tau=1.65 a=0.28 0.29 b=0.42 0.37 w*=1.49 1.52 b2=0.70 0.61 alp2=158.72 rhmc=0.78 rhyp=0.59 eps=0.027 rwsd=0.02
-i=14000 alp=171.99 sig=0.203 tau=2.45 a=0.25 0.24 b=0.33 0.32 w*=1.67 1.41 b2=0.81 0.79 alp2=206.30 rhmc=0.78 rhyp=0.60 eps=0.027 rwsd=0.02
-i=16000 alp=170.11 sig=0.186 tau=2.23 a=0.29 0.21 b=0.37 0.26 w*=1.51 1.27 b2=0.83 0.57 alp2=197.57 rhmc=0.77 rhyp=0.60 eps=0.027 rwsd=0.02
-i=18000 alp=169.84 sig=0.179 tau=2.65 a=0.25 0.23 b=0.30 0.26 w*=1.59 1.27 b2=0.80 0.68 alp2=202.25 rhmc=0.77 rhyp=0.61 eps=0.027 rwsd=0.02
-i=20000 alp=224.32 sig=0.114 tau=3.00 a=0.24 0.26 b=0.30 0.31 w*=1.24 1.20 b2=0.89 0.93 alp2=254.32 rhmc=0.77 rhyp=0.62 eps=0.027 rwsd=0.02
+i=2000 alp=137.35 sig=0.258 tau=0.93 a=0.35 0.31 b=0.68 0.50 w*=1.26 1.25 b2=0.64 0.47 alp2=134.82 rhmc=0.60 rhyp=0.54 eps=0.025 rwsd=0.02
+i=4000 alp=131.79 sig=0.267 tau=1.05 a=0.30 0.27 b=0.48 0.38 w*=1.35 1.23 b2=0.50 0.40 alp2=133.47 rhmc=0.47 rhyp=0.57 eps=0.025 rwsd=0.02
+i=6000 alp=130.18 sig=0.245 tau=0.99 a=0.29 0.27 b=0.45 0.35 w*=1.21 1.01 b2=0.45 0.35 alp2=129.84 rhmc=0.45 rhyp=0.57 eps=0.025 rwsd=0.02
+i=8000 alp=128.30 sig=0.266 tau=0.93 a=0.28 0.23 b=0.45 0.33 w*=1.41 1.10 b2=0.42 0.31 alp2=125.90 rhmc=0.46 rhyp=0.56 eps=0.025 rwsd=0.02
+i=10000 alp=125.54 sig=0.275 tau=1.08 a=0.27 0.22 b=0.39 0.29 w*=1.28 1.16 b2=0.42 0.31 alp2=128.30 rhmc=0.46 rhyp=0.58 eps=0.025 rwsd=0.02
+i=12000 alp=122.92 sig=0.284 tau=1.15 a=0.28 0.22 b=0.53 0.24 w*=1.31 1.17 b2=0.61 0.27 alp2=128.03 rhmc=0.49 rhyp=0.57 eps=0.025 rwsd=0.02
+i=14000 alp=117.72 sig=0.267 tau=1.30 a=0.27 0.20 b=0.34 0.19 w*=1.17 1.23 b2=0.44 0.25 alp2=126.13 rhmc=0.49 rhyp=0.57 eps=0.025 rwsd=0.02
+i=16000 alp=123.82 sig=0.265 tau=1.41 a=0.27 0.23 b=0.28 0.24 w*=1.47 1.10 b2=0.40 0.33 alp2=135.68 rhmc=0.46 rhyp=0.57 eps=0.025 rwsd=0.02
+i=18000 alp=117.33 sig=0.264 tau=1.77 a=0.23 0.20 b=0.20 0.15 w*=1.41 0.97 b2=0.36 0.27 alp2=136.47 rhmc=0.50 rhyp=0.57 eps=0.025 rwsd=0.02
+i=20000 alp=116.99 sig=0.261 tau=1.94 a=0.23 0.18 b=0.22 0.15 w*=1.28 1.12 b2=0.43 0.30 alp2=139.09 rhmc=0.40 rhyp=0.59 eps=0.025 rwsd=0.02
 -----------------------------------
  Markov chain 3/3 
 -----------------------------------
-i=2000 alp=167.41 sig=0.215 tau=1.06 a=0.34 0.32 b=0.77 0.73 w*=1.57 1.62 b2=0.82 0.77 alp2=169.65 rhmc=0.80 rhyp=0.55 eps=0.027 rwsd=0.02
-i=4000 alp=185.02 sig=0.166 tau=0.99 a=0.30 0.27 b=0.70 0.70 w*=1.15 1.38 b2=0.69 0.69 alp2=184.65 rhmc=0.79 rhyp=0.61 eps=0.027 rwsd=0.02
-i=6000 alp=146.99 sig=0.242 tau=0.83 a=0.33 0.26 b=0.74 0.51 w*=1.37 1.32 b2=0.61 0.42 alp2=140.45 rhmc=0.81 rhyp=0.59 eps=0.027 rwsd=0.02
-i=8000 alp=122.27 sig=0.284 tau=0.73 a=0.28 0.24 b=0.56 0.49 w*=1.41 1.39 b2=0.41 0.36 alp2=111.94 rhmc=0.79 rhyp=0.59 eps=0.027 rwsd=0.02
-i=10000 alp=152.58 sig=0.250 tau=0.75 a=0.24 0.24 b=0.59 0.65 w*=1.51 1.58 b2=0.44 0.49 alp2=141.79 rhmc=0.78 rhyp=0.60 eps=0.027 rwsd=0.02
-i=12000 alp=192.84 sig=0.190 tau=0.81 a=0.24 0.26 b=0.74 0.94 w*=1.55 1.35 b2=0.60 0.76 alp2=185.31 rhmc=0.76 rhyp=0.61 eps=0.027 rwsd=0.02
-i=14000 alp=170.14 sig=0.208 tau=0.77 a=0.24 0.24 b=0.55 0.57 w*=1.35 1.41 b2=0.42 0.44 alp2=161.07 rhmc=0.78 rhyp=0.60 eps=0.027 rwsd=0.02
-i=16000 alp=231.46 sig=0.158 tau=0.86 a=0.22 0.23 b=0.68 0.71 w*=1.39 1.64 b2=0.58 0.61 alp2=226.16 rhmc=0.78 rhyp=0.61 eps=0.027 rwsd=0.02
-i=18000 alp=188.75 sig=0.203 tau=0.73 a=0.25 0.26 b=0.79 0.85 w*=1.47 1.35 b2=0.58 0.62 alp2=177.04 rhmc=0.78 rhyp=0.60 eps=0.027 rwsd=0.02
-i=20000 alp=193.44 sig=0.183 tau=0.68 a=0.25 0.26 b=0.81 0.93 w*=1.22 1.39 b2=0.56 0.64 alp2=180.46 rhmc=0.81 rhyp=0.61 eps=0.027 rwsd=0.02
+i=2000 alp=121.03 sig=0.267 tau=0.77 a=0.36 0.34 b=0.57 0.55 w*=1.11 1.21 b2=0.44 0.42 alp2=112.86 rhmc=0.65 rhyp=0.52 eps=0.025 rwsd=0.02
+i=4000 alp=109.81 sig=0.279 tau=0.83 a=0.31 0.33 b=0.41 0.42 w*=1.08 1.38 b2=0.34 0.35 alp2=104.25 rhmc=0.43 rhyp=0.54 eps=0.025 rwsd=0.02
+i=6000 alp=99.18 sig=0.301 tau=0.84 a=0.28 0.31 b=0.33 0.38 w*=1.13 1.30 b2=0.28 0.32 alp2=94.19 rhmc=0.47 rhyp=0.58 eps=0.025 rwsd=0.02
+i=8000 alp=103.69 sig=0.294 tau=0.89 a=0.28 0.28 b=0.31 0.38 w*=1.16 1.19 b2=0.28 0.34 alp2=100.27 rhmc=0.48 rhyp=0.56 eps=0.025 rwsd=0.02
+i=10000 alp=102.40 sig=0.292 tau=1.01 a=0.25 0.26 b=0.26 0.32 w*=1.14 1.27 b2=0.26 0.32 alp2=102.76 rhmc=0.43 rhyp=0.58 eps=0.025 rwsd=0.02
+i=12000 alp=109.63 sig=0.285 tau=1.20 a=0.25 0.23 b=0.24 0.26 w*=1.27 1.31 b2=0.29 0.31 alp2=115.45 rhmc=0.45 rhyp=0.57 eps=0.025 rwsd=0.02
+i=14000 alp=122.40 sig=0.268 tau=1.31 a=0.26 0.20 b=0.29 0.21 w*=1.19 1.27 b2=0.38 0.28 alp2=131.57 rhmc=0.48 rhyp=0.58 eps=0.025 rwsd=0.02
+i=16000 alp=113.57 sig=0.277 tau=1.45 a=0.25 0.20 b=0.24 0.21 w*=1.14 1.16 b2=0.35 0.30 alp2=125.91 rhmc=0.51 rhyp=0.57 eps=0.025 rwsd=0.02
+i=18000 alp=115.09 sig=0.282 tau=1.48 a=0.26 0.19 b=0.24 0.18 w*=1.19 1.36 b2=0.35 0.26 alp2=128.48 rhmc=0.45 rhyp=0.58 eps=0.025 rwsd=0.02
+i=20000 alp=114.65 sig=0.265 tau=1.59 a=0.23 0.17 b=0.18 0.12 w*=1.14 1.30 b2=0.28 0.19 alp2=129.56 rhmc=0.44 rhyp=0.58 eps=0.025 rwsd=0.02
 -----------------------------------
 End MCMC
-Computation time: 0 hour(s) 4 minute(s)
+Computation time: 0 hour(s) 10 minute(s)
 -----------------------------------
-
% Print summary in text file
-print_summary(['summary_' num2str(p) 'f.txt'], titlenetwork, G, niter, nburn, nchains, thin, p, outpath, tstart)
+
% True log-posterior
+if sigma_true>0
+    objprior.param.observe_all = false;
+end
+[lp_nonlat_true, ll_nonlat_true] = logpostcggp_approx_true(G, objprior, ...
+    w_true, alpha_true, sigma_true, tau_true, Fdist_true, gamma_true);
 
-% discard burnin to compute estimates
-objmcmc_all = objmcmc;
-objmcmc.samples = discard(objmcmc_all.samples, floor(nburn/objmcmc_all.settings.thin));
-objmcmc.settings.nburn = nburn;
+% compute log-posterior
+[lp_nonlat, lp_lat, ll_nonlat, ll_lat] = logpost_approx(objmcmc, G);
+
% discard burnin to compute estimates
+objmcmc_noburn = objmcmc;
+objmcmc_noburn.samples = discard(objmcmc.samples, floor(nburn/objmcmc.settings.thin));
+objmcmc_noburn.settings.nburn = nburn;
 
 % Get estimates and cost
-[estimates, C_st] = graphest(objmcmc);
-
-% Save workspace
-save(fullfile(outpath, ['workspace_' num2str(p) 'f.mat']))
+[estimates, C_st] = graphest(objmcmc_noburn);
 
-----------------------------------
 Start parameters estimation for CGGP graphs: 300 samples
-Estimated end of computation: 08-Nov-2017 18:10:37 (0.0 hours)
+Estimated end of computation: 01-Feb-2020 18:01:26 (0.0 hours)
 |---------------------------------|
 |*********************************|
 End parameters estimation for CGGP graphs
 Computation time: 0.0 hours
 -----------------------------------
-

Plots

prefix = sprintf('%s_%df_', name, p);
+
% Print summary in text file
+print_summary(['summary_' num2str(p) 'f.txt'], titlenetwork, G, niter, nburn, nchains, thin, p, outpath, tstart)
+
+% Save workspace
+objmcmc.stats = [];
+save(fullfile(outpath, ['workspace_' num2str(p) 'f.mat']), '-v7.3')
+

Plots

prefix = sprintf('%s_%df_', name, p);
 suffix = '';
 
 % Plot cost
 plot_cost(C_st, outpath, prefix, suffix);
-
-% Assign max feature
-[~, nodefeat] = max(estimates.w, [],2);
+
% Plot log-posterior
+iter = (1:size(lp_nonlat,1))*thin;
+plot_logpost(lp_nonlat, iter, lp_nonlat_true, 'Log-posterior', outpath, prefix, '_nonlat');
+plot_logpost(lp_lat, iter, [], 'Log-posterior', outpath, prefix, '_lat');
+
+% Plot log-posterior autocorr
+lp_nonlat_noburn = lp_nonlat(floor(nburn/niter*size(lp_nonlat, 1)):end, :);
+lp_lat_noburn = lp_lat(floor(nburn/niter*size(lp_lat, 1)):end, :);
+plot_autocorr_logpost(lp_nonlat_noburn, thin, 'Log-posterior', outpath, prefix, '_nonlat');
+plot_autocorr_logpost(lp_lat_noburn, thin, 'Log-posterior', outpath, prefix, '_lat');
+
% Plot traces and histograms
 
 % order features
 ind_features = 1:p;
-
% Plot traces and histograms
-variables = {'logalpha2', 'sigma', 'Fparam.a', 'Fparam.b2', 'mean_w_rem'};
-namesvar = {'$\log \tilde\alpha$', '$\sigma$', '$a$', '$\tilde b$', '$\overline{w}_{\ast}$'};
-trueval = {log(alpha_true)+sigma_true*log(tau_true), sigma_true,Fdist_true.param.a, tau_true*Fdist_true.param.b, mean(w_rem_true)};
-plot_trace(objmcmc_all.samples, objmcmc_all.settings, variables, namesvar, trueval, outpath, prefix, suffix);
-plot_hist(objmcmc.samples, variables, namesvar, trueval, ind_features, [], outpath, prefix, suffix);
-
% Plot the graph by sorting the nodes by max feature
-[~,indk] = max(w_true,[],2);
-[~,ind] = sort(indk, 'descend');
-figure
-spy(G(ind, ind))
-xlabel('Nodes')
-ylabel('Nodes')
-title('Sorted Adjacency Matrix')
-
% Plot posterior predictive of degrees
-if istest
-    ndraws = 100;
+
+if sigma_true<0
+    varsigma1_true = -alpha_true.*tau_true.^sigma_true./sigma_true;
+    varsigma2_true = -sigma_true.*Fdist_true.param.a./(tau_true.*Fdist_true.param.b);
+    varsigma3_true = sigma_true.*Fdist_true.param.a.*(sigma_true-Fdist_true.param.a-1)/(tau_true.*Fdist_true.param.b).^2;
+    mean_w_rem_true = mean(w_rem_true);
+
+    variables = {'varsigma1', 'varsigma2', 'varsigma3', 'mean_w_rem'};
+    namesvar = {'$\varsigma_1$', '$\varsigma_2$', '$\varsigma_3$', '$\overline{w}_{\ast}$'};
+    trueval = {varsigma1_true, varsigma2_true, varsigma3_true, mean_w_rem_true};
+    plot_trace(objmcmc.samples, objmcmc.settings, variables, namesvar, trueval, outpath, prefix, suffix);
+    plot_hist(objmcmc_noburn.samples, variables, namesvar, trueval, ind_features, [], outpath, prefix, suffix);
 else
-    ndraws = 5000;
+    logalpha2_true = log(alpha_true)+sigma_true*log(tau_true);
+    b2_true = tau_true*Fdist_true.param.b;
+    mean_w_rem_true = mean(w_rem_true);
+
+    variables = {'logalpha2', 'sigma', 'Fparam.a', 'Fparam.b2', 'mean_w_rem'};
+    namesvar = {'$\log \tilde\alpha$', '$\sigma$', '$a$', '$\tilde b$', '$\overline{w}_{\ast}$'};
+    trueval = {logalpha2_true, sigma_true, Fdist_true.param.a, b2_true, mean_w_rem_true};
+    plot_trace(objmcmc.samples, objmcmc.settings, variables, namesvar, trueval, outpath, prefix, suffix);
+    plot_hist(objmcmc_noburn.samples, variables, namesvar, trueval, ind_features, [], outpath, prefix, suffix);
 end
-plot_degreepostpred(G, objmcmc, ndraws, 1e-6, outpath, prefix, suffix);
+

Plot credible intervals for the weights

plot_mean_w_ci(G, objmcmc.samples(1).mean_w, w_true, outpath, prefix, suffix)
+
% Plot posterior predictive of degrees
+plot_degreepostpred(G, objmcmc_noburn, ndraws, 1e-6, outpath, prefix, suffix);
 
-----------------------------------
 Start degree posterior predictive estimation: 100 draws
-Estimated end of computation: 08-Nov-2017 18:10:48 (0.0 hours)
+Estimated end of computation: 01-Feb-2020 18:02:07 (0.0 hours)
 |---------------------------------|
 |*********************************|
 End degree posterior predictive (0.0 hours)
 -----------------------------------
-
% Plot credible intervals for the weights
-[~, ind] = sort(sum(G, 2)+sum(G, 1)', 'descend');
-mean_w_true = mean(w_true,2);
-
-% High degree nodes
-figure('name','Credible intervals - high degree nodes'); hold on
-for i=1:min(nnodes(1), 50)
-    plot([i, i],quantile(objmcmc.samples(1).mean_w(ind(i), :, :),[.025,.975]), 'r','linewidth', 3);
-    hold on
-    plot(i, mean_w_true(ind(i)), 'xg', 'linewidth', 2)
-end
-xlim([0.1, min(nnodes(1), 50)+.5])
-box off
-ylabel('Mean sociability parameters', 'fontsize', 16)
-xlabel('Index of node (sorted by dec. degree)', 'fontsize', 16)
-legend('95% credible intervals', 'True value', 'location', 'northeast')
-legend boxoff
-[~, ind] = sort(sum(G, 2)+sum(G, 1)', 'descend');
-
-% Low degree nodes
-figure('name','Credible intervals - low degree nodes'); hold on
-for i=max(1,nnodes(1)-50+1):nnodes(1)
-    plot([i, i],...
-        quantile(log(objmcmc.samples(1).mean_w(ind(i), :, :)),[.025,.975]), 'r', ...
-        'linewidth', 3);
-    hold on
-    plot(i, log(mean_w_true(ind(i))), 'xg', 'linewidth', 2)
-end
-xlim([max(1,nnodes(1)-50+1)-.5, nnodes(1)+.5])
-ylim([-12, -4])
-box off
-ylabel('Log mean sociability parameters', 'fontsize', 16)
-xlabel('Index of node (sorted by dec. degree)', 'fontsize', 16)
-legend('95% credible intervals', 'True value', 'location', 'southeast')
-legend boxoff
-
\ No newline at end of file diff --git a/docs/demo_simulations.png b/docs/demo_simulations.png index 093a3b1..f1268e3 100644 Binary files a/docs/demo_simulations.png and b/docs/demo_simulations.png differ diff --git a/docs/demo_simulations_01.png b/docs/demo_simulations_01.png index 234ac91..e9fb3f6 100644 Binary files a/docs/demo_simulations_01.png and b/docs/demo_simulations_01.png differ diff --git a/docs/demo_simulations_02.png b/docs/demo_simulations_02.png index c4f0d86..d3c0d28 100644 Binary files a/docs/demo_simulations_02.png and b/docs/demo_simulations_02.png differ diff --git a/docs/demo_simulations_03.png b/docs/demo_simulations_03.png index f13d401..67c6b84 100644 Binary files a/docs/demo_simulations_03.png and b/docs/demo_simulations_03.png differ diff --git a/docs/demo_simulations_04.png b/docs/demo_simulations_04.png index 792ac20..433b4a2 100644 Binary files a/docs/demo_simulations_04.png and b/docs/demo_simulations_04.png differ diff --git a/docs/demo_simulations_05.png b/docs/demo_simulations_05.png index 9156a2f..5987561 100644 Binary files a/docs/demo_simulations_05.png and b/docs/demo_simulations_05.png differ diff --git a/docs/demo_simulations_06.png b/docs/demo_simulations_06.png index e438ff6..b24a439 100644 Binary files a/docs/demo_simulations_06.png and b/docs/demo_simulations_06.png differ diff --git a/docs/demo_simulations_07.png b/docs/demo_simulations_07.png index 0d48a14..5ebd8d0 100644 Binary files a/docs/demo_simulations_07.png and b/docs/demo_simulations_07.png differ diff --git a/docs/demo_simulations_08.png b/docs/demo_simulations_08.png index e23ca9f..1195b91 100644 Binary files a/docs/demo_simulations_08.png and b/docs/demo_simulations_08.png differ diff --git a/docs/demo_simulations_09.png b/docs/demo_simulations_09.png index 6e2c52e..7c27e86 100644 Binary files a/docs/demo_simulations_09.png and b/docs/demo_simulations_09.png differ diff --git a/docs/demo_simulations_10.png b/docs/demo_simulations_10.png index 5a4364a..1a1043e 100644 Binary files a/docs/demo_simulations_10.png and b/docs/demo_simulations_10.png differ diff --git a/docs/demo_simulations_11.png b/docs/demo_simulations_11.png index 825cd65..8762452 100644 Binary files a/docs/demo_simulations_11.png and b/docs/demo_simulations_11.png differ diff --git a/docs/demo_simulations_12.png b/docs/demo_simulations_12.png index 34d4f37..734b1b3 100644 Binary files a/docs/demo_simulations_12.png and b/docs/demo_simulations_12.png differ diff --git a/docs/demo_simulations_13.png b/docs/demo_simulations_13.png index 578460c..ab09d99 100644 Binary files a/docs/demo_simulations_13.png and b/docs/demo_simulations_13.png differ diff --git a/docs/demo_simulations_14.png b/docs/demo_simulations_14.png index 98c34c5..7ec2a42 100644 Binary files a/docs/demo_simulations_14.png and b/docs/demo_simulations_14.png differ diff --git a/docs/demo_simulations_15.png b/docs/demo_simulations_15.png index 3ca56e4..d7d05b5 100644 Binary files a/docs/demo_simulations_15.png and b/docs/demo_simulations_15.png differ diff --git a/docs/demo_simulations_16.png b/docs/demo_simulations_16.png index 7c047f3..b689653 100644 Binary files a/docs/demo_simulations_16.png and b/docs/demo_simulations_16.png differ diff --git a/docs/demo_simulations_17.png b/docs/demo_simulations_17.png index 12bbbf4..af86484 100644 Binary files a/docs/demo_simulations_17.png and b/docs/demo_simulations_17.png differ diff --git a/docs/demo_sparsity.html b/docs/demo_sparsity.html index b88f08e..09ada88 100644 --- a/docs/demo_sparsity.html +++ b/docs/demo_sparsity.html @@ -6,7 +6,7 @@ Sparse Networks with Overlapping Communities (SNetOC) package: demo_sparsity

Sparse Networks with Overlapping Communities (SNetOC) package: demo_sparsity

This Matlab script shows empirically the sparsity properties of a range of graph models.

For downloading the package and information on installation, visit the SNetOCC webpage.

Reference:

Authors:

Tested on Matlab R2016a. Requires the Statistics toolbox.

Last Modified: 10/10/2017

Contents

General settings

clear
+  

Sparse Networks with Overlapping Communities (SNetOC) package: demo_sparsity

This Matlab script shows empirically the sparsity properties of a range of graph models.

For downloading the package and information on installation, visit the SNetOC webpage.

Reference:

Authors:

Tested on Matlab R2017a. Requires the Statistics toolbox.

Last Modified: 01/2020

Contents

General settings

clear
 close all
 
 % Add paths
@@ -85,7 +85,7 @@
 
 % Set the seed
 rng default
-

Definition of the graph models

p = 2; alpha = 100; tau = 1;
+

Definition of the graph models

p = 2; alpha = 100; tau = 1;
 gamma = zeros(p,1);
 a = .2;
 b = 1/p;
@@ -130,7 +130,7 @@
 edgebins = 2.^(0:1:12);
 sizebins = edgebins(2:end) - edgebins(1:end-1);
 sizebins(end+1) = 1;
-

Sample graphs of various sizes

for k=1:numel(obj) % For different models
+

Sample graphs of various sizes

for k=1:numel(obj) % For different models
     fprintf('--- Model %d/%d: %s ---\n', k, numel(obj), obj{k}.name)
     for i=1:numel(trial{k}) % Varying number of nodes
         if rem(i, 10)==0
@@ -354,17 +354,19 @@
 Trial 480/500 
 Trial 490/500 
 Trial 500/500 
-

Some plots

% Properties of the plots
+

Some plots

% Properties of the plots
 fontsize = 22;
 plotstyles = {'--+',':s',':d',':o'};
 colors = lines;
 for k=1:numel(obj)
-    leg{k} = sprintf('\\sigma = %g', obj{k}.param.sigma);
+    leg{k} = sprintf('$\\sigma = %g$', obj{k}.param.sigma);
 end
 set(0,'DefaultAxesFontSize', 16)
 set(0,'DefaultTextFontSize', fontsize)
 set(0,'DefaultLineLineWidth', 2)
 set(0,'DefaultLineMarkerSize', 8)
+set(0, 'defaultTextInterpreter', 'latex');
+set(0, 'defaultAxesTickLabelInterpreter', 'latex');
 close
 
 % Degree distribution loglog plot
@@ -379,7 +381,7 @@
 % ylim([10, 20000])
 xlabel('Degree', 'fontsize', fontsize)
 ylabel('Distribution', 'fontsize', fontsize)
-legend(leg, 'fontsize', fontsize, 'location', 'southwest')
+legend(leg, 'fontsize', fontsize, 'location', 'southwest', 'interpreter', 'latex')
 legend boxoff
 box off
 if saveplots
@@ -401,7 +403,7 @@
 % ylim([10, 20000])
 xlabel('Number of nodes', 'fontsize', fontsize)
 ylabel('Number of edges', 'fontsize', fontsize)
-legend(leg, 'fontsize', fontsize, 'location', 'northwest')
+legend(leg, 'fontsize', fontsize, 'location', 'northwest', 'interpreter', 'latex')
 legend boxoff
 box off
 if saveplots
@@ -419,8 +421,8 @@
 axis tight
 xlim([10, 2000])
 xlabel('Number of nodes', 'fontsize', fontsize)
-ylabel('Nb of edges / (Nb of nodes)^2', 'fontsize', fontsize)
-legend(leg,'fontsize', fontsize, 'location', 'southwest')
+ylabel('$Nb of edges / (Nb of nodes)^2$', 'fontsize', fontsize)
+legend(leg,'fontsize', fontsize, 'location', 'southwest', 'interpreter', 'latex')
 legend boxoff
 box off
 if saveplots
@@ -438,24 +440,28 @@
 % ylim([1, 2000])
 xlabel('Number of nodes', 'fontsize', fontsize);
 ylabel('Number of nodes of degree one', 'fontsize', fontsize);
-legend(leg,'fontsize', fontsize, 'location', 'northwest');
+legend(leg,'fontsize', fontsize, 'location', 'northwest', 'interpreter', 'latex');
 legend('boxoff');
 legend boxoff
 box off
 if saveplots
     savefigs(gcf, 'degreeonevsnodes', outpath);
 end
-

Save workspace

if saveworkspace
+

Save workspace

if saveworkspace
     save(fullfile(outpath, 'workspace'));
 end
-
\ No newline at end of file diff --git a/docs/demo_sparsity.png b/docs/demo_sparsity.png index f70aee7..8b9ec29 100644 Binary files a/docs/demo_sparsity.png and b/docs/demo_sparsity.png differ diff --git a/docs/demo_sparsity_01.png b/docs/demo_sparsity_01.png index 196286d..c632a67 100644 Binary files a/docs/demo_sparsity_01.png and b/docs/demo_sparsity_01.png differ diff --git a/docs/demo_sparsity_02.png b/docs/demo_sparsity_02.png index 9711a01..cb318af 100644 Binary files a/docs/demo_sparsity_02.png and b/docs/demo_sparsity_02.png differ diff --git a/docs/demo_sparsity_03.png b/docs/demo_sparsity_03.png index 9ed05c1..51d9f37 100644 Binary files a/docs/demo_sparsity_03.png and b/docs/demo_sparsity_03.png differ diff --git a/docs/demo_sparsity_04.png b/docs/demo_sparsity_04.png index 555a00c..b3c0af4 100644 Binary files a/docs/demo_sparsity_04.png and b/docs/demo_sparsity_04.png differ diff --git a/docs/demo_usairport.html b/docs/demo_usairport.html index da9de28..e6eda1d 100644 --- a/docs/demo_usairport.html +++ b/docs/demo_usairport.html @@ -6,7 +6,7 @@ Sparse Networks with Overlapping Communities (SNetOC) package: demo_usairport

Sparse Networks with Overlapping Communities (SNetOC) package: demo_usairport

This Matlab script performs posterior inference on a network of airports to find latent overlapping communities, using a Bayesian nonparametric approach.

For downloading the package and information on installation, visit the SNetOC webpage.

Reference:

Authors:

Tested on Matlab R2016a. Requires the Statistics toolbox.

Last Modified: 10/10/2017

Contents

General settings

clear
+  

Sparse Networks with Overlapping Communities (SNetOC) package: demo_usairport

This Matlab script performs posterior inference on a network of airports to find latent overlapping communities, using a Bayesian nonparametric approach.

For downloading the package and information on installation, visit the SNetOC webpage.

Reference:

Authors:

Tested on Matlab R2017a. Requires the Statistics toolbox.

Last Modified: 01/2020

Contents

General settings

clear
 close all
 tstart = clock; % Starting time
 
@@ -91,7 +91,7 @@
 
 % Set the seed
 rng default
-

Load Network of airports with a connection to a US airport

load ./data/usairport/usairport
+

Load Network of airports with a connection to a US airport

load ./data/usairport/usairport
 
 titlenetwork = 'US airport network in 2010';
 name = 'usairport';
@@ -104,11 +104,11 @@
 fn = fieldnames(meta);
 
 % Plot adjacency matrix
-figure
+figure;
 spy(G);
 xlabel(labels{2})
 ylabel(labels{1})
-

Posterior Inference using Markov chain Monte Carlo and point estimation

Users needs to start the parallel pool by using the command parpool to run multiple chains in parallel.

% Define the parameters of the prior
+

Posterior Inference using Markov chain Monte Carlo and point estimation

Users needs to start the parallel pool by using the command parpool to run multiple chains in parallel.

% Define the parameters of the prior
 p = 4; % Number of commmunities
 objprior =  graphmodel('CGGP', p); % CGGP graph model with p communities
 
@@ -118,17 +118,19 @@
     niterinit = 1000;
     niter = 20000;
     nsamples = 100;
+    ndraws = 100;
 else
     niterinit = 10000;
-    niter = 200000;
-    nsamples = 500;
+    niter = 1e7;
+    nsamples = 1000;
+    ndraws = 500;
 end
 nburn = floor(niter/2);
 thin = ceil((niter-nburn)/nsamples);
 verbose = true;
 
 % Create the graphMCMC object
-objmcmc = graphmcmc(objprior, niter, nburn, thin, nchains);
+objmcmc = graphmcmc(objprior, niter, 0, thin, nchains);
 
 % Run initialisation
 init = graphinit(objmcmc, G, niterinit);
@@ -140,77 +142,92 @@
 
% Run MCMC sampler
 objmcmc = graphmcmcsamples(objmcmc, G, verbose, init);
 
-----------------------------------
-Start MCMC for CGGP graphs
-Nb of nodes: 1574 - Nb of edges: 17215 (0 missing)
+Start MCMC for undirected CGGP graphs
+Nb of nodes: 1574x1574 - Nb of edges: 17215 (0 missing)
 Nb of chains: 3 - Nb of iterations: 20000
-Nb of parallel workers: 1
-Estimated computation time: 0 hour(s) 6 minute(s)
-Estimated end of computation: 08-Nov-2017 18:16:42 
+Estimated computation time: 0 hour(s) 11 minute(s)
+Estimated end of computation: 01-Feb-2020 18:13:45 
 -----------------------------------
  Markov chain 1/3 
 -----------------------------------
-i=2000 alp=110.74 sig=0.214 tau=0.99 a=0.31 0.36 0.17 0.32 b=0.47 0.30 0.03 0.42 w*=0.41 0.66 1.36 0.39 b2=0.47 0.29 0.03 0.41 alp2=110.38 rhmc=0.65 rhyp=0.24 eps=0.015 rwsd=0.027
-i=4000 alp=112.25 sig=0.191 tau=1.28 a=0.26 0.29 0.14 0.28 b=0.24 0.16 0.01 0.25 w*=0.39 0.64 1.49 0.43 b2=0.31 0.20 0.02 0.32 alp2=117.72 rhmc=0.56 rhyp=0.23 eps=0.044 rwsd=0.027
-i=6000 alp=109.62 sig=0.196 tau=1.44 a=0.26 0.28 0.12 0.25 b=0.22 0.15 0.01 0.22 w*=0.44 0.63 1.27 0.41 b2=0.32 0.21 0.01 0.32 alp2=117.69 rhmc=0.71 rhyp=0.25 eps=0.011 rwsd=0.027
-i=8000 alp=111.37 sig=0.184 tau=1.70 a=0.24 0.28 0.11 0.27 b=0.18 0.11 0.01 0.18 w*=0.35 0.62 1.34 0.37 b2=0.31 0.19 0.01 0.30 alp2=122.79 rhmc=0.92 rhyp=0.25 eps=0.011 rwsd=0.027
-i=10000 alp=88.97 sig=0.218 tau=1.95 a=0.24 0.25 0.11 0.24 b=0.16 0.10 0.01 0.15 w*=0.39 0.72 1.46 0.47 b2=0.31 0.19 0.01 0.29 alp2=102.86 rhmc=0.92 rhyp=0.25 eps=0.011 rwsd=0.027
-i=12000 alp=94.45 sig=0.208 tau=1.99 a=0.24 0.24 0.10 0.23 b=0.16 0.08 0.01 0.14 w*=0.38 0.72 1.39 0.40 b2=0.32 0.15 0.01 0.28 alp2=108.99 rhmc=0.92 rhyp=0.27 eps=0.011 rwsd=0.027
-i=14000 alp=93.23 sig=0.212 tau=1.94 a=0.23 0.22 0.10 0.23 b=0.15 0.07 0.01 0.12 w*=0.39 0.70 1.45 0.41 b2=0.29 0.13 0.01 0.23 alp2=107.33 rhmc=0.92 rhyp=0.26 eps=0.011 rwsd=0.027
-i=16000 alp=77.03 sig=0.235 tau=1.65 a=0.22 0.24 0.10 0.22 b=0.13 0.07 0.00 0.11 w*=0.39 0.71 1.52 0.40 b2=0.22 0.11 0.01 0.18 alp2=86.67 rhmc=0.92 rhyp=0.26 eps=0.011 rwsd=0.027
-i=18000 alp=86.39 sig=0.218 tau=2.16 a=0.22 0.23 0.10 0.22 b=0.11 0.06 0.00 0.10 w*=0.40 0.66 1.52 0.42 b2=0.23 0.14 0.01 0.22 alp2=102.16 rhmc=0.92 rhyp=0.26 eps=0.011 rwsd=0.027
-i=20000 alp=91.88 sig=0.216 tau=2.72 a=0.20 0.21 0.10 0.21 b=0.08 0.05 0.00 0.10 w*=0.48 0.66 1.33 0.37 b2=0.21 0.13 0.01 0.26 alp2=113.97 rhmc=0.92 rhyp=0.28 eps=0.011 rwsd=0.027
+i=2000 alp=122.34 sig=0.191 tau=0.91 a=0.36 0.33 0.17 0.37 b=0.58 0.26 0.03 0.56 w*=0.39 0.62 1.33 0.40 b2=0.52 0.24 0.03 0.51 alp2=120.16 rhmc=0.76 rhyp=0.36 eps=0.021 rwsd=0.02
+i=4000 alp=106.97 sig=0.213 tau=0.90 a=0.31 0.29 0.12 0.29 b=0.43 0.19 0.01 0.36 w*=0.42 0.75 1.51 0.46 b2=0.39 0.17 0.01 0.33 alp2=104.62 rhmc=0.71 rhyp=0.36 eps=0.021 rwsd=0.02
+i=6000 alp=93.87 sig=0.222 tau=0.83 a=0.25 0.24 0.11 0.26 b=0.27 0.10 0.01 0.20 w*=0.39 0.68 1.58 0.44 b2=0.22 0.09 0.01 0.16 alp2=90.18 rhmc=0.71 rhyp=0.38 eps=0.021 rwsd=0.02
+i=8000 alp=75.46 sig=0.265 tau=1.08 a=0.25 0.22 0.10 0.22 b=0.22 0.06 0.01 0.16 w*=0.42 0.78 1.67 0.46 b2=0.24 0.07 0.01 0.17 alp2=76.92 rhmc=0.72 rhyp=0.37 eps=0.021 rwsd=0.02
+i=10000 alp=69.63 sig=0.267 tau=0.98 a=0.22 0.20 0.09 0.22 b=0.12 0.05 0.00 0.11 w*=0.47 0.86 1.55 0.44 b2=0.12 0.05 0.00 0.11 alp2=69.27 rhmc=0.72 rhyp=0.39 eps=0.021 rwsd=0.02
+i=12000 alp=68.16 sig=0.261 tau=1.14 a=0.19 0.20 0.09 0.22 b=0.09 0.04 0.00 0.11 w*=0.40 0.80 1.50 0.47 b2=0.10 0.05 0.00 0.12 alp2=70.45 rhmc=0.71 rhyp=0.40 eps=0.021 rwsd=0.02
+i=14000 alp=69.02 sig=0.252 tau=1.23 a=0.20 0.17 0.09 0.21 b=0.08 0.03 0.00 0.10 w*=0.41 0.89 1.51 0.46 b2=0.10 0.03 0.00 0.12 alp2=72.75 rhmc=0.72 rhyp=0.39 eps=0.021 rwsd=0.02
+i=16000 alp=70.27 sig=0.246 tau=1.57 a=0.18 0.18 0.08 0.18 b=0.08 0.03 0.00 0.08 w*=0.42 0.75 1.50 0.43 b2=0.12 0.05 0.00 0.12 alp2=78.47 rhmc=0.71 rhyp=0.38 eps=0.021 rwsd=0.02
+i=18000 alp=76.26 sig=0.239 tau=1.59 a=0.19 0.18 0.08 0.19 b=0.08 0.03 0.00 0.09 w*=0.41 0.82 1.55 0.49 b2=0.12 0.05 0.00 0.14 alp2=85.28 rhmc=0.71 rhyp=0.40 eps=0.021 rwsd=0.02
+i=20000 alp=76.14 sig=0.242 tau=1.99 a=0.18 0.16 0.08 0.19 b=0.07 0.03 0.00 0.08 w*=0.49 0.81 1.64 0.48 b2=0.15 0.06 0.00 0.17 alp2=89.93 rhmc=0.71 rhyp=0.40 eps=0.021 rwsd=0.02
 -----------------------------------
  Markov chain 2/3 
 -----------------------------------
-i=2000 alp=106.28 sig=0.220 tau=0.89 a=0.46 0.45 0.18 0.32 b=0.49 0.78 0.03 0.40 w*=0.66 0.40 1.65 0.44 b2=0.43 0.69 0.02 0.35 alp2=103.52 rhmc=0.67 rhyp=0.25 eps=0.016 rwsd=0.027
-i=4000 alp=99.13 sig=0.217 tau=1.12 a=0.35 0.34 0.13 0.27 b=0.24 0.38 0.01 0.26 w*=0.64 0.35 1.77 0.36 b2=0.26 0.43 0.01 0.29 alp2=101.60 rhmc=0.52 rhyp=0.23 eps=0.035 rwsd=0.028
-i=6000 alp=97.90 sig=0.219 tau=1.49 a=0.30 0.29 0.12 0.24 b=0.14 0.24 0.01 0.22 w*=0.64 0.45 1.60 0.40 b2=0.21 0.36 0.01 0.33 alp2=106.92 rhmc=0.81 rhyp=0.24 eps=0.011 rwsd=0.027
-i=8000 alp=99.78 sig=0.214 tau=1.36 a=0.30 0.26 0.12 0.23 b=0.13 0.19 0.01 0.17 w*=0.71 0.39 1.46 0.40 b2=0.17 0.26 0.01 0.24 alp2=106.52 rhmc=0.93 rhyp=0.23 eps=0.011 rwsd=0.027
-i=10000 alp=88.70 sig=0.218 tau=1.44 a=0.26 0.26 0.11 0.23 b=0.08 0.16 0.00 0.17 w*=0.65 0.41 1.81 0.37 b2=0.12 0.23 0.01 0.24 alp2=95.99 rhmc=0.93 rhyp=0.25 eps=0.011 rwsd=0.027
-i=12000 alp=87.79 sig=0.223 tau=1.83 a=0.28 0.26 0.10 0.23 b=0.10 0.16 0.00 0.14 w*=0.62 0.45 1.69 0.40 b2=0.19 0.28 0.01 0.25 alp2=100.45 rhmc=0.93 rhyp=0.26 eps=0.011 rwsd=0.027
-i=14000 alp=92.23 sig=0.206 tau=1.87 a=0.27 0.26 0.10 0.22 b=0.09 0.15 0.00 0.12 w*=0.60 0.41 1.53 0.39 b2=0.17 0.28 0.01 0.23 alp2=104.97 rhmc=0.93 rhyp=0.24 eps=0.011 rwsd=0.027
-i=16000 alp=92.20 sig=0.217 tau=2.13 a=0.24 0.26 0.10 0.21 b=0.06 0.15 0.00 0.09 w*=0.78 0.43 1.45 0.46 b2=0.12 0.32 0.01 0.20 alp2=108.64 rhmc=0.93 rhyp=0.25 eps=0.011 rwsd=0.027
-i=18000 alp=83.51 sig=0.226 tau=1.84 a=0.25 0.24 0.10 0.21 b=0.07 0.11 0.00 0.11 w*=0.74 0.45 1.64 0.44 b2=0.13 0.21 0.01 0.21 alp2=95.91 rhmc=0.93 rhyp=0.24 eps=0.011 rwsd=0.027
-i=20000 alp=78.20 sig=0.226 tau=1.77 a=0.22 0.24 0.10 0.19 b=0.04 0.11 0.00 0.07 w*=0.72 0.41 1.30 0.40 b2=0.08 0.20 0.01 0.13 alp2=88.92 rhmc=0.93 rhyp=0.24 eps=0.011 rwsd=0.027
+i=2000 alp=106.37 sig=0.210 tau=1.14 a=0.39 0.34 0.16 0.35 b=0.49 0.20 0.02 0.41 w*=0.46 0.62 1.63 0.39 b2=0.56 0.23 0.02 0.47 alp2=109.37 rhmc=0.75 rhyp=0.37 eps=0.021 rwsd=0.02
+i=4000 alp=103.71 sig=0.204 tau=1.43 a=0.30 0.27 0.13 0.29 b=0.22 0.11 0.01 0.27 w*=0.47 0.68 1.35 0.40 b2=0.32 0.16 0.01 0.38 alp2=111.55 rhmc=0.72 rhyp=0.36 eps=0.021 rwsd=0.02
+i=6000 alp=84.04 sig=0.228 tau=1.46 a=0.29 0.23 0.11 0.26 b=0.23 0.08 0.01 0.19 w*=0.41 0.79 1.60 0.44 b2=0.33 0.12 0.01 0.28 alp2=91.62 rhmc=0.71 rhyp=0.37 eps=0.021 rwsd=0.02
+i=8000 alp=81.83 sig=0.219 tau=1.51 a=0.25 0.21 0.11 0.25 b=0.13 0.04 0.00 0.14 w*=0.41 0.71 1.50 0.41 b2=0.19 0.06 0.01 0.21 alp2=89.56 rhmc=0.72 rhyp=0.38 eps=0.021 rwsd=0.02
+i=10000 alp=73.59 sig=0.233 tau=1.47 a=0.20 0.20 0.09 0.23 b=0.08 0.04 0.00 0.10 w*=0.31 0.75 1.40 0.35 b2=0.12 0.05 0.00 0.15 alp2=80.54 rhmc=0.71 rhyp=0.39 eps=0.021 rwsd=0.02
+i=12000 alp=73.33 sig=0.242 tau=1.57 a=0.19 0.19 0.09 0.22 b=0.08 0.04 0.00 0.10 w*=0.41 0.92 1.39 0.46 b2=0.13 0.06 0.00 0.15 alp2=81.76 rhmc=0.73 rhyp=0.38 eps=0.021 rwsd=0.02
+i=14000 alp=76.63 sig=0.228 tau=1.65 a=0.19 0.20 0.09 0.21 b=0.07 0.04 0.00 0.09 w*=0.43 0.82 1.30 0.39 b2=0.12 0.06 0.00 0.15 alp2=85.85 rhmc=0.70 rhyp=0.39 eps=0.021 rwsd=0.02
+i=16000 alp=66.02 sig=0.256 tau=2.04 a=0.20 0.17 0.08 0.21 b=0.06 0.02 0.00 0.07 w*=0.44 0.93 1.45 0.46 b2=0.12 0.05 0.00 0.14 alp2=79.25 rhmc=0.69 rhyp=0.40 eps=0.021 rwsd=0.02
+i=18000 alp=70.80 sig=0.240 tau=2.07 a=0.20 0.18 0.08 0.19 b=0.07 0.02 0.00 0.07 w*=0.43 0.81 1.52 0.44 b2=0.15 0.05 0.00 0.14 alp2=84.27 rhmc=0.71 rhyp=0.38 eps=0.021 rwsd=0.02
+i=20000 alp=73.01 sig=0.239 tau=2.85 a=0.18 0.16 0.08 0.19 b=0.05 0.02 0.00 0.07 w*=0.42 0.87 1.64 0.43 b2=0.15 0.06 0.01 0.19 alp2=93.84 rhmc=0.71 rhyp=0.41 eps=0.021 rwsd=0.02
 -----------------------------------
  Markov chain 3/3 
 -----------------------------------
-i=2000 alp=150.61 sig=0.161 tau=1.51 a=0.26 0.34 0.24 0.27 b=0.13 0.60 0.11 0.24 w*=0.98 0.56 0.67 0.51 b2=0.20 0.91 0.16 0.36 alp2=160.94 rhmc=0.65 rhyp=0.25 eps=0.016 rwsd=0.028
-i=4000 alp=132.48 sig=0.172 tau=2.05 a=0.20 0.26 0.21 0.22 b=0.06 0.35 0.06 0.10 w*=1.28 0.49 0.65 0.47 b2=0.12 0.71 0.12 0.21 alp2=149.90 rhmc=0.60 rhyp=0.24 eps=0.038 rwsd=0.029
-i=6000 alp=160.23 sig=0.144 tau=3.05 a=0.18 0.24 0.19 0.18 b=0.05 0.34 0.05 0.08 w*=1.20 0.52 0.55 0.55 b2=0.14 1.02 0.16 0.24 alp2=188.05 rhmc=0.70 rhyp=0.24 eps=0.014 rwsd=0.029
-i=8000 alp=143.54 sig=0.153 tau=4.12 a=0.18 0.23 0.17 0.18 b=0.05 0.26 0.04 0.05 w*=1.12 0.55 0.61 0.49 b2=0.20 1.07 0.16 0.22 alp2=178.31 rhmc=0.88 rhyp=0.23 eps=0.014 rwsd=0.029
-i=10000 alp=152.81 sig=0.153 tau=4.38 a=0.17 0.23 0.17 0.16 b=0.04 0.25 0.04 0.05 w*=1.32 0.52 0.62 0.64 b2=0.17 1.10 0.17 0.20 alp2=191.44 rhmc=0.89 rhyp=0.24 eps=0.014 rwsd=0.029
-i=12000 alp=150.76 sig=0.146 tau=4.83 a=0.16 0.22 0.16 0.16 b=0.04 0.25 0.03 0.04 w*=1.02 0.53 0.69 0.62 b2=0.18 1.20 0.15 0.20 alp2=189.79 rhmc=0.88 rhyp=0.24 eps=0.014 rwsd=0.029
-i=14000 alp=179.23 sig=0.117 tau=7.53 a=0.16 0.20 0.15 0.16 b=0.03 0.17 0.03 0.04 w*=1.24 0.56 0.65 0.48 b2=0.22 1.31 0.21 0.28 alp2=226.94 rhmc=0.88 rhyp=0.24 eps=0.014 rwsd=0.029
-i=16000 alp=224.15 sig=0.083 tau=8.27 a=0.16 0.20 0.14 0.15 b=0.04 0.17 0.03 0.03 w*=1.02 0.45 0.51 0.56 b2=0.29 1.38 0.21 0.24 alp2=267.00 rhmc=0.88 rhyp=0.25 eps=0.014 rwsd=0.029
-i=18000 alp=204.00 sig=0.092 tau=8.33 a=0.16 0.18 0.13 0.15 b=0.03 0.15 0.02 0.03 w*=1.08 0.60 0.59 0.52 b2=0.26 1.21 0.14 0.21 alp2=247.76 rhmc=0.88 rhyp=0.25 eps=0.014 rwsd=0.029
-i=20000 alp=181.18 sig=0.116 tau=9.41 a=0.15 0.18 0.13 0.14 b=0.03 0.12 0.02 0.02 w*=0.97 0.52 0.59 0.63 b2=0.26 1.15 0.16 0.23 alp2=234.88 rhmc=0.88 rhyp=0.23 eps=0.014 rwsd=0.029
+i=2000 alp=116.71 sig=0.205 tau=0.91 a=0.19 0.32 0.32 0.37 b=0.04 0.47 0.28 0.60 w*=1.30 0.43 0.63 0.40 b2=0.04 0.42 0.25 0.55 alp2=114.41 rhmc=0.76 rhyp=0.35 eps=0.021 rwsd=0.02
+i=4000 alp=97.05 sig=0.239 tau=1.01 a=0.13 0.29 0.27 0.28 b=0.01 0.36 0.15 0.34 w*=1.68 0.36 0.71 0.39 b2=0.01 0.36 0.15 0.35 alp2=97.30 rhmc=0.72 rhyp=0.37 eps=0.021 rwsd=0.02
+i=6000 alp=93.75 sig=0.212 tau=1.01 a=0.11 0.26 0.25 0.27 b=0.01 0.24 0.11 0.22 w*=1.31 0.31 0.61 0.37 b2=0.01 0.24 0.11 0.22 alp2=93.90 rhmc=0.72 rhyp=0.38 eps=0.021 rwsd=0.02
+i=8000 alp=75.65 sig=0.252 tau=1.24 a=0.09 0.22 0.22 0.25 b=0.01 0.16 0.08 0.15 w*=1.68 0.42 0.64 0.48 b2=0.01 0.19 0.09 0.19 alp2=79.85 rhmc=0.71 rhyp=0.38 eps=0.021 rwsd=0.02
+i=10000 alp=77.82 sig=0.247 tau=1.11 a=0.09 0.22 0.21 0.22 b=0.00 0.17 0.06 0.12 w*=1.64 0.41 0.86 0.50 b2=0.00 0.19 0.07 0.13 alp2=79.84 rhmc=0.70 rhyp=0.38 eps=0.021 rwsd=0.02
+i=12000 alp=66.61 sig=0.260 tau=1.17 a=0.09 0.21 0.21 0.22 b=0.00 0.11 0.05 0.10 w*=1.62 0.42 0.87 0.49 b2=0.00 0.13 0.06 0.12 alp2=69.35 rhmc=0.71 rhyp=0.38 eps=0.021 rwsd=0.02
+i=14000 alp=71.97 sig=0.242 tau=1.40 a=0.08 0.19 0.19 0.21 b=0.00 0.08 0.03 0.08 w*=1.41 0.41 0.93 0.42 b2=0.00 0.12 0.04 0.12 alp2=78.02 rhmc=0.71 rhyp=0.39 eps=0.021 rwsd=0.02
+i=16000 alp=62.97 sig=0.259 tau=1.52 a=0.08 0.20 0.19 0.21 b=0.00 0.07 0.03 0.08 w*=1.70 0.39 0.74 0.43 b2=0.00 0.11 0.05 0.12 alp2=70.21 rhmc=0.72 rhyp=0.40 eps=0.021 rwsd=0.02
+i=18000 alp=70.94 sig=0.237 tau=1.82 a=0.08 0.18 0.19 0.21 b=0.00 0.06 0.03 0.07 w*=1.32 0.39 0.84 0.42 b2=0.00 0.12 0.05 0.12 alp2=81.78 rhmc=0.72 rhyp=0.39 eps=0.021 rwsd=0.02
+i=20000 alp=71.47 sig=0.240 tau=2.27 a=0.07 0.17 0.19 0.21 b=0.00 0.06 0.03 0.07 w*=1.43 0.39 0.83 0.42 b2=0.00 0.14 0.06 0.15 alp2=87.00 rhmc=0.73 rhyp=0.39 eps=0.021 rwsd=0.02
 -----------------------------------
 End MCMC
-Computation time: 0 hour(s) 6 minute(s)
+Computation time: 0 hour(s) 14 minute(s)
 -----------------------------------
 
% Print summary in text file
 print_summary(['summary_' num2str(p) 'f.txt'], titlenetwork, G, niter, nburn, nchains, thin, p, outpath, tstart)
-
% Point estimation of the model parameters
-[estimates, C_st] = graphest(objmcmc);
 
 % Save workspace
 save(fullfile(outpath, ['workspace_' num2str(p) 'f.mat']))
+
% Log posterior approximation
+[lp_nonlat, lp_lat, ll_nonlat, ll_lat] = logpost_approx(objmcmc, G);
+

discard burnin

objmcmc_noburn = objmcmc;
+objmcmc_noburn.samples = discard(objmcmc.samples, floor(nburn/objmcmc.settings.thin));
+objmcmc_noburn.settings.nburn = nburn;
+
% Point estimation of the model parameters
+[estimates, C_st] = graphest(objmcmc_noburn);
 
-----------------------------------
 Start parameters estimation for CGGP graphs: 300 samples
-Estimated end of computation: 08-Nov-2017 18:17:36 (0.0 hours)
+Estimated end of computation: 01-Feb-2020 18:17:59 (0.0 hours)
 |---------------------------------|
 |*********************************|
 End parameters estimation for CGGP graphs
 Computation time: 0.0 hours
 -----------------------------------
-

Plots

prefix = sprintf('%s_%df_', name, p);
+

Plots

prefix = sprintf('%s_%df_', name, p);
 suffix = '';
+
% Plot Log posterior approximation
+iter = (1:size(lp_nonlat,1))*thin;
+plot_logpost(lp_nonlat, iter, [], 'Log-posterior', outpath, prefix, '_nonlat');
+plot_logpost(lp_lat, iter, [], 'Log-posterior', outpath, prefix, '_lat');
+
+% Plot log-posterior autocorr
+lp_nonlat_noburn = lp_nonlat(floor(nburn/niter*size(lp_nonlat, 1)):end, :);
+lp_lat_noburn = lp_lat(floor(nburn/niter*size(lp_lat, 1)):end, :);
+plot_autocorr_logpost(lp_nonlat_noburn, thin, 'Log-posterior', outpath, prefix, '_nonlat');
+plot_autocorr_logpost(lp_lat_noburn, thin, 'Log-posterior', outpath, prefix, '_lat');
 
 % Plot cost
 if ~isempty(C_st)
     plot_cost(C_st, outpath, prefix, suffix);
 end
+
 % Assign max feature for community detection
 [~, nodefeat] = max(estimates.w, [],2);
 
@@ -227,19 +244,19 @@
 else
     featnames = {'Hub', 'East', 'West', 'Alaska'};
 end
-
% Plot traces and histograms
+
% Plot traces and histograms
 variables = {'logalpha2', 'sigma', 'Fparam.a', 'Fparam.b2', 'mean_w_rem'};
 namesvar = {'$\log \tilde\alpha$', '$\sigma$', '$a$', '$\tilde b$', '$\overline{w}_{\ast}$'};
 plot_trace(objmcmc.samples, objmcmc.settings, variables, namesvar, [], outpath, prefix, suffix);
-plot_hist(objmcmc.samples, variables, namesvar, [], ind_features, [], outpath, prefix, suffix);
-
% Plot the graph by sorting the nodes by max feature
+plot_hist(objmcmc_noburn.samples, variables, namesvar, [], ind_features, [], outpath, prefix, suffix);
+
% Plot the graph by sorting the nodes by max feature
 plot_sortedgraph(G, nodefeat, nodefeat, ind_features, labels, outpath, prefix, suffix, {'png'});
 
 if isfield(meta, 'groups')
     % Plots by groups right vs left
     plot_groups(estimates.w, meta.groups, meta.(groupfield), ind_features, label_groups, featnames, color_groups, outpath, prefix, suffix);
 end
-
% Show the proportion in each features for a few nodes
+
% Show the proportion in each features for a few nodes
 % https://www.mapcustomizer.com/
 names = {
     'New York, NY'
@@ -292,7 +309,7 @@
 names = names(ind2);
 color = hsv(p);
 plot_nodesfeatures(estimates.w, ind, ind_features, names, featnames, color, outpath, prefix, suffix);
-
% Show some of the nodes in each feature
+
% Show some of the nodes in each feature
 fnames = {'degree', 'city'}; % meta fields displayed for features exploration
 formats = {'#%d,', '%s.'}; %
 print_features( fullfile(outpath, ['features_' num2str(p) 'f.txt']), ...
@@ -310,190 +327,190 @@
     ind_features, featnames, meta, fnames, formats)
 
& %--- Hub ---
 #291, New York, NY. 
-#299, Washington, DC. 
 #261, Miami, FL. 
+#299, Washington, DC. 
+#314, Atlanta, GA. 
 #245, Boston, MA. 
-#292, Los Angeles, CA. 
 #273, Newark, NJ. 
-#314, Atlanta, GA. 
-#211, Fort Lauderdale, FL. 
-#231, Orlando, FL. 
+#292, Los Angeles, CA. 
+#296, Chicago, IL. 
 #244, Philadelphia, PA. 
+#267, Houston, TX. 
 & %--- East ---
-#296, Chicago, IL. 
 #252, Detroit, MI. 
+#299, Washington, DC. 
+#203, Cleveland, OH. 
 #314, Atlanta, GA. 
 #204, Nashville, TN. 
+#296, Chicago, IL. 
 #184, Indianapolis, IN. 
-#203, Cleveland, OH. 
+#145, Knoxville, TN. 
 #195, Pittsburgh, PA. 
-#173, Louisville, KY. 
-#299, Washington, DC. 
-#189, Memphis, TN. 
+#195, Milwaukee, WI. 
 & %--- West ---
 #274, Denver, CO. 
 #240, Las Vegas, NV. 
-#219, Burbank, CA. 
 #292, Los Angeles, CA. 
-#183, Salt Lake City, UT. 
-#214, San Francisco, CA. 
 #190, Phoenix, AZ. 
+#219, Burbank, CA. 
 #193, Seattle, WA. 
+#183, Salt Lake City, UT. 
+#269, Minneapolis, MN. 
 #254, Dallas/Fort Worth, TX. 
-#267, Houston, TX. 
+#154, Portland, OR. 
 & %--- Alaska ---
 #172, Anchorage, AK. 
 #131, Fairbanks, AK. 
 #83, Bethel, AK. 
-#37, Iliamna, AK. 
-#60, King Salmon, AK. 
-#48, St. Mary's, AK. 
-#49, McGrath, AK. 
-#47, Dillingham, AK. 
+#55, Nome, AK. 
 #49, Galena, AK. 
+#43, Unalakleet, AK. 
+#37, Iliamna, AK. 
+#36, Kasigluk, AK. 
 #44, Kotzebue, AK. 
+#40, Kodiak, AK. 
 & %--- Hub ---
-#3, Johnstown, PA. 
-#1, Sarajevo, Yugoslavia. 
-#2, Oneonta, NY. 
-#1, Ahmedabad, India. 
-#3, Pittsfield, MA. 
-#37, Charlotte Amalie, Virgin Islands. 
-#1, Palermo, Italy. 
-#3, La Romana, Dominican Republic. 
-#1, Casablanca, Morocco. 
-#3, Barrancabermeja, Colombia. 
+#10, Fort Lauderdale, FL. 
+#2, Altoona, PA. 
+#2, Governors Harbour, The Bahamas. 
+#4, Lajes, Portugal. 
+#9, Medellin, Colombia. 
+#17, Manchester, United Kingdom. 
+#9, Copenhagen, Denmark. 
+#5, Presque Isle/Houlton, ME. 
+#9, Prague, Czechoslovakia. 
+#1, Iquique, Chile. 
 & %--- East ---
-#70, Daytona Beach, FL. 
-#22, Binghamton, NY. 
+#94, Tallahassee, FL. 
+#27, Lafayette, LA. 
+#4, Hagerstown, MD. 
+#83, Flint, MI. 
 #75, Pensacola, FL. 
-#46, Newport News/Williamsburg, VA. 
-#30, London, Canada. 
-#51, Kalamazoo, MI. 
-#51, Fayetteville, NC. 
-#50, Scranton/Wilkes-Barre, PA. 
-#4, Cape Girardeau, MO. 
-#3, Williamsport, PA. 
+#87, Fort Wayne, IN. 
+#43, Gainesville, FL. 
+#13, Kinston, NC. 
+#5, Muscle Shoals, AL. 
+#9, Worcester, MA. 
 & %--- West ---
-#9, Leon/Guanajuato, Mexico. 
-#51, Kalispell, MT. 
-#20, Durango, CO. 
-#3, Santa Cruz/Huatulco, Mexico. 
-#1, Philadelphia, PA. 
-#136, Reno, NV. 
-#3, Battle Creek, MI. 
+#3, Moab, UT. 
+#5, Visalia, CA. 
+#5, Camp Douglas, WI. 
+#4, Hermosillo, Mexico. 
+#7, Santa Fe, NM. 
+#55, Missoula, MT. 
+#15, Redding, CA. 
 #30, Medford, OR. 
-#76, Lubbock, TX. 
-#16, San Luis Obispo, CA. 
+#4, Cortez, CO. 
+#8, Santa Rosa, CA. 
 & %--- Alaska ---
-#4, Cape Newenham, AK. 
-#21, Napakiak, AK. 
-#4, Majuro, Marshall Islands District (TTPI). 
-#24, Alakanuk, AK. 
-#8, Hoolehua, HI. 
-#1, Dunbar, Australia. 
-#17, Sheldon Point, AK. 
-#27, Kalskag, AK. 
-#2, Seward, AK. 
-#23, Kwigillingok, AK. 
+#28, Juneau, AK. 
+#12, Gambell, AK. 
+#9, Atqasuk, AK. 
+#31, St. Michael, AK. 
+#18, Crooked Creek, AK. 
+#5, Circle Hot Springs, AK. 
+#5, 47-Mile Mine, AK. 
+#24, Togiak, AK. 
+#6, Whitmore, AZ. 
+#5, Galbraith Lake, AK. 
 & %--- Hub ---
 New York, NY. 
-Washington, DC. 
 Miami, FL. 
+Washington, DC. 
+Atlanta, GA. 
 Boston, MA. 
-Los Angeles, CA. 
 Newark, NJ. 
-Atlanta, GA. 
-Fort Lauderdale, FL. 
-Orlando, FL. 
+Los Angeles, CA. 
+Chicago, IL. 
 Philadelphia, PA. 
+Houston, TX. 
 & %--- East ---
-Chicago, IL. 
 Detroit, MI. 
+Washington, DC. 
+Cleveland, OH. 
 Atlanta, GA. 
 Nashville, TN. 
+Chicago, IL. 
 Indianapolis, IN. 
-Cleveland, OH. 
+Knoxville, TN. 
 Pittsburgh, PA. 
-Louisville, KY. 
-Washington, DC. 
-Memphis, TN. 
+Milwaukee, WI. 
 & %--- West ---
 Denver, CO. 
 Las Vegas, NV. 
-Burbank, CA. 
 Los Angeles, CA. 
-Salt Lake City, UT. 
-San Francisco, CA. 
 Phoenix, AZ. 
+Burbank, CA. 
 Seattle, WA. 
+Salt Lake City, UT. 
+Minneapolis, MN. 
 Dallas/Fort Worth, TX. 
-Houston, TX. 
+Portland, OR. 
 & %--- Alaska ---
 Anchorage, AK. 
 Fairbanks, AK. 
 Bethel, AK. 
-Iliamna, AK. 
-King Salmon, AK. 
-St. Mary's, AK. 
-McGrath, AK. 
-Dillingham, AK. 
+Nome, AK. 
 Galena, AK. 
+Unalakleet, AK. 
+Iliamna, AK. 
+Kasigluk, AK. 
 Kotzebue, AK. 
+Kodiak, AK. 
 & %--- Hub ---
-Johnstown, PA. 
-Sarajevo, Yugoslavia. 
-Oneonta, NY. 
-Ahmedabad, India. 
-Pittsfield, MA. 
-Charlotte Amalie, Virgin Islands. 
-Palermo, Italy. 
-La Romana, Dominican Republic. 
-Casablanca, Morocco. 
-Barrancabermeja, Colombia. 
+Fort Lauderdale, FL. 
+Altoona, PA. 
+Governors Harbour, The Bahamas. 
+Lajes, Portugal. 
+Medellin, Colombia. 
+Manchester, United Kingdom. 
+Copenhagen, Denmark. 
+Presque Isle/Houlton, ME. 
+Prague, Czechoslovakia. 
+Iquique, Chile. 
 & %--- East ---
-Daytona Beach, FL. 
-Binghamton, NY. 
+Tallahassee, FL. 
+Lafayette, LA. 
+Hagerstown, MD. 
+Flint, MI. 
 Pensacola, FL. 
-Newport News/Williamsburg, VA. 
-London, Canada. 
-Kalamazoo, MI. 
-Fayetteville, NC. 
-Scranton/Wilkes-Barre, PA. 
-Cape Girardeau, MO. 
-Williamsport, PA. 
+Fort Wayne, IN. 
+Gainesville, FL. 
+Kinston, NC. 
+Muscle Shoals, AL. 
+Worcester, MA. 
 & %--- West ---
-Leon/Guanajuato, Mexico. 
-Kalispell, MT. 
-Durango, CO. 
-Santa Cruz/Huatulco, Mexico. 
-Philadelphia, PA. 
-Reno, NV. 
-Battle Creek, MI. 
+Moab, UT. 
+Visalia, CA. 
+Camp Douglas, WI. 
+Hermosillo, Mexico. 
+Santa Fe, NM. 
+Missoula, MT. 
+Redding, CA. 
 Medford, OR. 
-Lubbock, TX. 
-San Luis Obispo, CA. 
+Cortez, CO. 
+Santa Rosa, CA. 
 & %--- Alaska ---
-Cape Newenham, AK. 
-Napakiak, AK. 
-Majuro, Marshall Islands District (TTPI). 
-Alakanuk, AK. 
-Hoolehua, HI. 
-Dunbar, Australia. 
-Sheldon Point, AK. 
-Kalskag, AK. 
-Seward, AK. 
-Kwigillingok, AK. 
-
 % Plot posterior predictive of degrees
- plot_degreepostpred(G, objmcmc, nsamples, 1e-6, outpath, prefix, suffix);
+Juneau, AK. 
+Gambell, AK. 
+Atqasuk, AK. 
+St. Michael, AK. 
+Crooked Creek, AK. 
+Circle Hot Springs, AK. 
+47-Mile Mine, AK. 
+Togiak, AK. 
+Whitmore, AZ. 
+Galbraith Lake, AK. 
+
% Plot posterior predictive of degrees
+plot_degreepostpred(G, objmcmc_noburn, ndraws, 1e-6, outpath, prefix, suffix);
 
-----------------------------------
 Start degree posterior predictive estimation: 100 draws
-Estimated end of computation: 08-Nov-2017 18:18:07 (0.0 hours)
+Estimated end of computation: 01-Feb-2020 18:20:54 (0.0 hours)
 |---------------------------------|
 |*********************************|
 End degree posterior predictive (0.0 hours)
 -----------------------------------
-
\ No newline at end of file diff --git a/docs/demo_usairport.png b/docs/demo_usairport.png index 6bd7120..3666442 100644 Binary files a/docs/demo_usairport.png and b/docs/demo_usairport.png differ diff --git a/docs/demo_usairport_01.png b/docs/demo_usairport_01.png index c6b7583..0c8b36a 100644 Binary files a/docs/demo_usairport_01.png and b/docs/demo_usairport_01.png differ diff --git a/docs/demo_usairport_02.png b/docs/demo_usairport_02.png index 6451e6e..9849552 100644 Binary files a/docs/demo_usairport_02.png and b/docs/demo_usairport_02.png differ diff --git a/docs/demo_usairport_03.png b/docs/demo_usairport_03.png index 3b1c698..bc07aeb 100644 Binary files a/docs/demo_usairport_03.png and b/docs/demo_usairport_03.png differ diff --git a/docs/demo_usairport_04.png b/docs/demo_usairport_04.png index 641214c..c3d4189 100644 Binary files a/docs/demo_usairport_04.png and b/docs/demo_usairport_04.png differ diff --git a/docs/demo_usairport_05.png b/docs/demo_usairport_05.png index f1bf8ac..23e0dce 100644 Binary files a/docs/demo_usairport_05.png and b/docs/demo_usairport_05.png differ diff --git a/docs/demo_usairport_06.png b/docs/demo_usairport_06.png index 72e2e4c..5c4735f 100644 Binary files a/docs/demo_usairport_06.png and b/docs/demo_usairport_06.png differ diff --git a/docs/demo_usairport_07.png b/docs/demo_usairport_07.png index a3f324b..235e723 100644 Binary files a/docs/demo_usairport_07.png and b/docs/demo_usairport_07.png differ diff --git a/docs/demo_usairport_08.png b/docs/demo_usairport_08.png index fef84ba..bb81fd0 100644 Binary files a/docs/demo_usairport_08.png and b/docs/demo_usairport_08.png differ diff --git a/docs/demo_usairport_09.png b/docs/demo_usairport_09.png index 2d9e561..ffc8338 100644 Binary files a/docs/demo_usairport_09.png and b/docs/demo_usairport_09.png differ diff --git a/docs/demo_usairport_10.png b/docs/demo_usairport_10.png index e304dc8..5d1a052 100644 Binary files a/docs/demo_usairport_10.png and b/docs/demo_usairport_10.png differ diff --git a/docs/demo_usairport_11.png b/docs/demo_usairport_11.png index 6e58afe..a5b7433 100644 Binary files a/docs/demo_usairport_11.png and b/docs/demo_usairport_11.png differ diff --git a/docs/demo_usairport_12.png b/docs/demo_usairport_12.png index 79fe5e8..97db082 100644 Binary files a/docs/demo_usairport_12.png and b/docs/demo_usairport_12.png differ diff --git a/docs/demo_usairport_13.png b/docs/demo_usairport_13.png index 78ec5d8..03e0a71 100644 Binary files a/docs/demo_usairport_13.png and b/docs/demo_usairport_13.png differ diff --git a/docs/demo_usairport_14.png b/docs/demo_usairport_14.png index 1041a7f..23e97c5 100644 Binary files a/docs/demo_usairport_14.png and b/docs/demo_usairport_14.png differ diff --git a/docs/demo_usairport_15.png b/docs/demo_usairport_15.png index 8b332ae..81c7737 100644 Binary files a/docs/demo_usairport_15.png and b/docs/demo_usairport_15.png differ diff --git a/docs/demo_usairport_16.png b/docs/demo_usairport_16.png index b27cc07..17e553b 100644 Binary files a/docs/demo_usairport_16.png and b/docs/demo_usairport_16.png differ diff --git a/publish_all.m b/publish_all.m index ac83da4..27c2429 100644 --- a/publish_all.m +++ b/publish_all.m @@ -1,10 +1,7 @@ % publish_all demo files in html -opts.format = 'html'; -opts.outputDir = 'docs'; - -publish('demo_overlappingcommunity', opts); -publish('demo_polblogs', opts); -publish('demo_sparsity', opts); -publish('demo_simulations', opts); -publish('demo_usairport', opts); +publish('demo_overlappingcommunity', struct('format', 'html', 'outputDir', 'docs')); +publish('demo_polblogs', struct('format', 'html', 'outputDir', 'docs')); +publish('demo_sparsity', struct('format', 'html', 'outputDir', 'docs')); +publish('demo_simulations', struct('format', 'html', 'outputDir', 'docs')); +publish('demo_usairport', struct('format', 'html', 'outputDir', 'docs'));