Title: | Markov Random Field Structure Estimator |
---|---|
Description: | Three algorithms for estimating a Markov random field structure.Two of them are an exact version and a simulated annealing version of a penalized maximum conditional likelihood method similar to the Bayesian Information Criterion. These algorithm are described in Frondana (2016) <doi:10.11606/T.45.2018.tde-02022018-151123>.The third one is a greedy algorithm, described in Bresler (2015) <doi:10.1145/2746539.2746631). |
Authors: | Rodrigo Carvalho [aut, cre], Florencia Leonardi [rev, ths] |
Maintainer: | Rodrigo Carvalho <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.4.2 |
Built: | 2024-11-21 03:49:25 UTC |
Source: | https://github.com/cran/mrfse |
A greedy algorithm to estimate Markovian neighborhoods.
mrfse.ci(a_size, sample, tau, max_degree=ncol(sample)-1)
mrfse.ci(a_size, sample, tau, max_degree=ncol(sample)-1)
a_size |
Size of the alphabet. |
sample |
A integer-valued matrix. Each value must belong range |
tau |
A hyperparameter. See references. |
max_degree |
The maximum length of a candidate Markovian neighborhood. Must be
non-negative and less than |
A list filled with estimated Markov neighborhood for each graph vertex
Rodrigo Carvalho
Guy Bresler. 2015. Efficiently Learning Ising Models on Arbitrary Graphs. In Proceedings of the forty-seventh annual ACM symposium on Theory of Computing (STOC '15). Association for Computing Machinery, New York, NY, USA, 771–782. DOI:https://doi.org/10.1145/2746539.2746631
library(mrfse) a_size = c(0, 1) s = matrix(sample(a_size, size=1000, replace=TRUE), ncol=5) mrfse.ci(length(a_size), s, 0.2)
library(mrfse) a_size = c(0, 1) s = matrix(sample(a_size, size=1000, replace=TRUE), ncol=5) mrfse.ci(length(a_size), s, 0.2)
A greedy algorithm to estimate Markovian neighborhoods.
mrfse.ci.con(a_size, sample, tau, max_degree=ncol(sample)-1)
mrfse.ci.con(a_size, sample, tau, max_degree=ncol(sample)-1)
a_size |
Size of the alphabet. |
sample |
A integer-valued matrix. Each value must belong range |
tau |
A hyperparameter. See references. |
max_degree |
The maximum length of a candidate Markovian neighborhood. Must be
non-negative and less than |
A adjacency matrix of the estimated Markov random field graph.
Rodrigo Carvalho
Guy Bresler. 2015. Efficiently Learning Ising Models on Arbitrary Graphs. In Proceedings of the forty-seventh annual ACM symposium on Theory of Computing (STOC '15). Association for Computing Machinery, New York, NY, USA, 771–782. DOI:https://doi.org/10.1145/2746539.2746631
library(mrfse) a_size = c(0, 1) s = matrix(sample(a_size, size=1000, replace=TRUE), ncol=5) mrfse.ci.con(length(a_size), s, 0.2)
library(mrfse) a_size = c(0, 1) s = matrix(sample(a_size, size=1000, replace=TRUE), ncol=5) mrfse.ci.con(length(a_size), s, 0.2)
A greedy algorithm to estimate Markovian neighborhoods.
mrfse.ci.ncon(a_size, sample, tau, max_degree=ncol(sample)-1)
mrfse.ci.ncon(a_size, sample, tau, max_degree=ncol(sample)-1)
a_size |
Size of the alphabet. |
sample |
A integer-valued matrix. Each value must belong range |
tau |
A hyperparameter. See references. |
max_degree |
The maximum length of a candidate Markovian neighborhood. Must be
non-negative and less than |
A adjacency matrix of the estimated Markov random field graph.
Rodrigo Carvalho
Guy Bresler. 2015. Efficiently Learning Ising Models on Arbitrary Graphs. In Proceedings of the forty-seventh annual ACM symposium on Theory of Computing (STOC '15). Association for Computing Machinery, New York, NY, USA, 771–782. DOI:https://doi.org/10.1145/2746539.2746631
library(mrfse) a_size = c(0, 1) s = matrix(sample(a_size, size=1000, replace=TRUE), ncol=5) mrfse.ci.ncon(length(a_size), s, 0.2)
library(mrfse) a_size = c(0, 1) s = matrix(sample(a_size, size=1000, replace=TRUE), ncol=5) mrfse.ci.ncon(length(a_size), s, 0.2)
Create a sampler for Markov random field from a DAG
mrfse.create.sampler(dag_adj, A)
mrfse.create.sampler(dag_adj, A)
dag_adj |
An direct acyclic graph adjacency matrix |
A |
Size of alphabet |
A list filled with the following components:
neigh: A list of neighborhood. For each i, neigh[[i]] is a markovian neighborhood of vertex i
probs: A list of probabilities. For each i, probs[[i]] is matrix of probabilities of vertex i given your markovian neighborhood. Those probabilites will be used to generate a sample.
moral_adj: moral graph of adj_dag
topol_sort: topological sort of adj_dag
num_nodes: number of nodes de adj_dag
A: alphabet size
Rodrigo Carvalho
library(mrfse) adj = matrix(c(0, 1, 0, 0, 0, 0, 0, 1, 0), byrow=TRUE, ncol=3) mrfse.create.sampler(adj, 3)
library(mrfse) adj = matrix(c(0, 1, 0, 0, 0, 0, 0, 1, 0), byrow=TRUE, ncol=3) mrfse.create.sampler(adj, 3)
A penalized likelihood BIC-based to estimate Markovian neighborhoods.
mrfse.exact(a_size, sample, c, max_neigh= ncol(sample) - 1)
mrfse.exact(a_size, sample, c, max_neigh= ncol(sample) - 1)
a_size |
Size of the alphabet. |
sample |
A integer-valued matrix. Each value must belong range |
c |
The penalization constant. Must be positive. |
max_neigh |
The maximum length of a candidate Markovian neighborhood. Must be
non-negative and less than |
A list filled with estimated Markov neighborhood for each graph vertex
Rodrigo Carvalho
FRONDANA, Iara Moreira. Model selection for discrete Markov random fields on graphs. São Paulo : Instituto de Matemática e Estatística, University of São Paulo, 2016. Doctoral Thesis in Estatística. <doi:10.11606/T.45.2018.tde-02022018-151123> http://www.teses.usp.br/teses/disponiveis/45/45133/tde-02022018-151123/publico/tese_Iara_Frondana.pdf
library(mrfse) a_size = c(0, 1) s = matrix(sample(a_size, size=1000, replace=TRUE), ncol=5) mrfse.exact(length(a_size), s, 1.0)
library(mrfse) a_size = c(0, 1) s = matrix(sample(a_size, size=1000, replace=TRUE), ncol=5) mrfse.exact(length(a_size), s, 1.0)
Conservative construction of the estimated Markov random field graph.
mrfse.exact.con(a_size, sample, c, max_neigh = ncol(sample) - 1)
mrfse.exact.con(a_size, sample, c, max_neigh = ncol(sample) - 1)
a_size |
Size of the alphabet. |
sample |
A integer-valued matrix. Each value must belong range |
c |
The penalization constant. Must be positive. |
max_neigh |
The maximum length of a candidate Markovian neighborhood. Must be
non-negative and less than |
A adjacency matrix of the estimated Markov random field graph.
Rodrigo Carvalho
FRONDANA, Iara Moreira. Model selection for discrete Markov random fields on graphs. São Paulo : Instituto de Matemática e Estatística, University of São Paulo, 2016. Doctoral Thesis in Estatística. <doi:10.11606/T.45.2018.tde-02022018-151123> http://www.teses.usp.br/teses/disponiveis/45/45133/tde-02022018-151123/publico/tese_Iara_Frondana.pdf
library(mrfse) a = c(0, 1) s = matrix(sample(a, size=1000, replace=TRUE), ncol=5) mrfse.exact.con(length(a), s, 1.0)
library(mrfse) a = c(0, 1) s = matrix(sample(a, size=1000, replace=TRUE), ncol=5) mrfse.exact.con(length(a), s, 1.0)
Conservative construction of the estimated Markov random field graph.
mrfse.exact.ncon(a_size, sample, c, max_neigh = ncol(sample) - 1)
mrfse.exact.ncon(a_size, sample, c, max_neigh = ncol(sample) - 1)
a_size |
Size of the alphabet. |
sample |
A integer-valued matrix. Each value must belong range |
c |
The penalization constant. Must be positive. |
max_neigh |
The maximum length of a candidate Markovian neighborhood. Must be
non-negative and less than |
A adjacency matrix of the estimated Markov random field graph.
Rodrigo Carvalho
FRONDANA, Iara Moreira. Model selection for discrete Markov random fields on graphs. São Paulo : Instituto de Matemática e Estatística, University of São Paulo, 2016. Doctoral Thesis in Estatística. <doi:10.11606/T.45.2018.tde-02022018-151123> http://www.teses.usp.br/teses/disponiveis/45/45133/tde-02022018-151123/publico/tese_Iara_Frondana.pdf
library(mrfse) a = c(0, 1) s = matrix(sample(a, size=1000, replace=TRUE), ncol=5) mrfse.exact.ncon(length(a), s, 1.0)
library(mrfse) a = c(0, 1) s = matrix(sample(a, size=1000, replace=TRUE), ncol=5) mrfse.exact.ncon(length(a), s, 1.0)
A penalized likelihood BIC-based to estimate Markovian neighborhoods.
mrfse.sa(a_size, sample, c, t0, iterations=1000, max_neigh=ncol(sample)-1)
mrfse.sa(a_size, sample, c, t0, iterations=1000, max_neigh=ncol(sample)-1)
a_size |
Size of the alphabet. |
sample |
A integer-valued matrix. Each value must belong range |
c |
The penalization constant. Must be positive. |
t0 |
Inital temperature |
iterations |
Number of simulated annealing iterations |
max_neigh |
The maximum length of a candidate Markovian neighborhood. Must be
non-negative and less than |
A list filled with estimated Markov neighborhood for each graph vertex
Rodrigo Carvalho
FRONDANA, Iara Moreira. Model selection for discrete Markov random fields on graphs. São Paulo : Instituto de Matemática e Estatística, University of São Paulo, 2016. Doctoral Thesis in Estatística. <doi:10.11606/T.45.2018.tde-02022018-151123> http://www.teses.usp.br/teses/disponiveis/45/45133/tde-02022018-151123/publico/tese_Iara_Frondana.pdf
library(mrfse) a_size = c(0, 1) s = matrix(sample(a_size, size=1000, replace=TRUE), ncol=5) mrfse.sa(length(a_size), s, 1.0, 500, 1000)
library(mrfse) a_size = c(0, 1) s = matrix(sample(a_size, size=1000, replace=TRUE), ncol=5) mrfse.sa(length(a_size), s, 1.0, 500, 1000)
A penalized likelihood BIC-based to estimate Markovian neighborhoods.
mrfse.sa.con(a_size, sample, c, t0, iterations=1000, max_neigh=ncol(sample)-1)
mrfse.sa.con(a_size, sample, c, t0, iterations=1000, max_neigh=ncol(sample)-1)
a_size |
Size of the alphabet. |
sample |
A integer-valued matrix. Each value must belong range |
c |
The penalization constant. Must be positive. |
t0 |
Inital temperature |
iterations |
Number of simulated annealing iterations |
max_neigh |
The maximum length of a candidate Markovian neighborhood. Must be
non-negative and less than |
A adjacency matrix of the estimated Markov random field graph.
Rodrigo Carvalho
FRONDANA, Iara Moreira. Model selection for discrete Markov random fields on graphs. São Paulo : Instituto de Matemática e Estatística, University of São Paulo, 2016. Doctoral Thesis in Estatística. <doi:10.11606/T.45.2018.tde-02022018-151123> http://www.teses.usp.br/teses/disponiveis/45/45133/tde-02022018-151123/publico/tese_Iara_Frondana.pdf
library(mrfse) a_size = c(0, 1) s = matrix(sample(a_size, size=1000, replace=TRUE), ncol=5) mrfse.sa.con(length(a_size), s, 1.0, 500, 1000)
library(mrfse) a_size = c(0, 1) s = matrix(sample(a_size, size=1000, replace=TRUE), ncol=5) mrfse.sa.con(length(a_size), s, 1.0, 500, 1000)
A penalized likelihood BIC-based to estimate Markovian neighborhoods.
mrfse.sa.ncon(a_size, sample, c, t0, iterations=1000, max_neigh=ncol(sample)-1)
mrfse.sa.ncon(a_size, sample, c, t0, iterations=1000, max_neigh=ncol(sample)-1)
a_size |
Size of the alphabet. |
sample |
A integer-valued matrix. Each value must belong range |
c |
The penalization constant. Must be positive. |
t0 |
Inital temperature |
iterations |
Number of simulated annealing iterations |
max_neigh |
The maximum length of a candidate Markovian neighborhood. Must be
non-negative and less than |
A adjacency matrix of the estimated Markov random field graph.
Rodrigo Carvalho
FRONDANA, Iara Moreira. Model selection for discrete Markov random fields on graphs. São Paulo : Instituto de Matemática e Estatística, University of São Paulo, 2016. Doctoral Thesis in Estatística. <doi:10.11606/T.45.2018.tde-02022018-151123> http://www.teses.usp.br/teses/disponiveis/45/45133/tde-02022018-151123/publico/tese_Iara_Frondana.pdf
library(mrfse) a_size = c(0, 1) s = matrix(sample(a_size, size=1000, replace=TRUE), ncol=5) mrfse.sa.ncon(length(a_size), s, 1.0, 500, 1000)
library(mrfse) a_size = c(0, 1) s = matrix(sample(a_size, size=1000, replace=TRUE), ncol=5) mrfse.sa.ncon(length(a_size), s, 1.0, 500, 1000)
Generate a independent sample of a Markov random field according to the probilities of the sampler.
mrfse.sample(sampler, n)
mrfse.sample(sampler, n)
sampler |
A sampler created by |
n |
Size of sample |
A matrix whose number of columns is the number of nodes. Each line is a single independent sample of Markov random field given by the probabilites of sampler.
Rodrigo Carvalho
library(mrfse) adj = matrix(c(0, 1, 0, 0, 0, 0, 0, 1, 0), byrow=TRUE, ncol=3) sampler = mrfse.create.sampler(adj, 3) mrfse.sample(sampler, 3000)
library(mrfse) adj = matrix(c(0, 1, 0, 0, 0, 0, 0, 1, 0), byrow=TRUE, ncol=3) sampler = mrfse.create.sampler(adj, 3) mrfse.sample(sampler, 3000)