Runs a Natural Gradient Ascent algorithm to maximise the variational objective for a Sparse LPM.
slpm_nga(X, K, var_pars_init, hyper_pars = NULL, tol = 0.01, n_iter_max = 100000,
natural_gradient = T, learning_rate_factor_up = 2, learning_rate_factor_down = 2,
verbose = F)Rectangular adjacency matrix with non-negative entries.
The number of latent dimension of the model.
List of variational parameters to be used as starting point for the optimisation. See Details for more specific indications.
List defining the hyperparameters of the model. The list should contain three vectors of K positive values denoted delta, a_gamma and b_gamma, respectively, where K is the number of latent dimensions. If left as null, all delta parameters are set to 0.001, whereas the rest is set to 1.
Positive number setting the stop condition: the algorithm stops if one entire iteration yields an increase in the objective function smaller than this value.
Maximum number of iterations the algorithm should be run for.
TRUE or FALSE indicating whether the natural gradient instead of the standard gradient should be used.
Before any natural gradient ascent update, the current step size is multiplied by this number to ensure that the algorithms tries new solutions which are relatively far from the current one.
During any natural gradient ascent update, if a certain step size leads to a decrease in the objective function, then the step is divided by this number repeatedly until an increase is ensured.
TRUE or FALSE indicating whether a lengthy output should be printed out.
A list with components:
Number of seconds required for the optimisation process.
List containing the optimal values for the variational parameters.
Current step-size for the update of the variational parameters of each Gaussian distribution on the latent positions of senders.
Current step-size for the update of the variational parameters of each Gaussian distribution on the latent positions of receivers.
Values of the variational objective at the end of each of the iterations.
Value of the variational objective for the initial configuration.
Value of the variational objective for the optimal solution found.
var_pars and var_pars_init are lists with components:
M*K matrix representing the Gaussian means for the latent positions of senders.
N*K matrix representing the Gaussian means for the latent positions of receivers.
M*K matrix representing the Gaussian variances for the latent positions of senders.
N*K matrix representing the Gaussian variances for the latent positions of receivers.
M*N*K array with entries corresponding to the posterior probabilities of assigning each edge to each latent dimension.
Vector of K positive values representing the Dirichlet parameters generating the mixing proportions.
Vector of K positive values corresponding to the shapes of the variational Gamma distribution on the precisions.
Vector of K positive values corresponding to the rates of the variational Gamma distribution on the precisions.
Rastelli, R. (2018) "The Sparse Latent Position Model for nonnegative weighted networks", https://arxiv.org/abs/1808.09262
# NOT RUN {
set.seed(12345)
network <- slpm_gen(M = 15, N = 10, K = 2)
K <- 6
var_pars_init <- slpm_init(X = network$adj, K = K)
res <- slpm_nga(X = network$adj, K = K, var_pars_init = var_pars_init)
# }
Run the code above in your browser using DataLab