linear_model#
AB2intAB#
amap#
bnf2CG#
data2AB#
data2graph#
data2VARgraph#
decide_absences#
drawsamplesLG#
drawsamplesMA#
estimateG#
estimateSVAR#
G2AH#
G2SVAR#
genData#
- gunfolds.estimation.linear_model.genData(n, rate=2, density=0.1, burnin=100, ssize=2000, noise=0.1, dist='beta')[source]#
Given a number of nodes this function randomly generates a ring SCC and the corresponding stable transition matrix. It tries until succeeds and for some graph densities and parameters of the distribution of transition matrix values it may take forever. Please play with the dist parameter to stableVAR. Then using this transition matrix it generates ssize samples of data and undersamples them by rate discarding the burnin number of samples at the beginning.
- Parameters:
n ((guess)integer) – number of nodes in the desired graph
rate (integer) – undersampling rate (1 - no undersampling)
density ((guess) float) – density of the graph to be generted
burnin (integer) – number of samples to discard since the beginning of VAR sampling
ssize ((guess)integer) – how many samples to keep at the causal sampling rate
noise ((guess)float) – noise standard deviation for the VAR model
dist ((guess)string) – (GUESS)distribution from which to sample the weights. Available options are flat, flatsigned, beta, normal, uniform
- Returns:
- Return type:
getAgraph#
getAring#
initRandomMatrix#
- gunfolds.estimation.linear_model.initRandomMatrix(A, edges, distribution='beta')[source]#
possible distributions: flat flatsigned beta normal uniform
- Parameters:
A –
edges –
distribution (string) – (GUESS)distribution from which to sample the weights. Available options are flat, flatsigned, beta, normal, uniform
- Returns:
- Return type:
listplace#
nllf#
nllf2#
noiseData#
npG2SVAR#
presence_probs#
randomSVAR#
- gunfolds.estimation.linear_model.randomSVAR(n, rate=2, density=0.1, th=0.09, burnin=100, ssize=2000, noise=0.1, dist='beta')[source]#
Given a number of nodes this function randomly generates a ring SCC and the corresponding stable transition matrix. It tries until succeeds and for some graph densities and parameters of the distribution of transition matrix values it may take forever. Please play with the dist parameter to stableVAR. Then using this transition matrix it generates ssize samples of data and undersamples them by rate discarding the burnin number of samples at the beginning. For these data the funcion solves the SVAR estimation maximizing log likelihood and returns the A and B matrices.
- Parameters:
n ((guess)integer) – number of nodes in the desired graph
rate (integer) – undersampling rate (1 - no undersampling)
density ((guess)float) – density of the graph to be generted
th ((guess)float) – threshold for discarding edges in A and B
burnin ((guess)integer) – number of samples to discard since the beginning of VAR sampling
ssize ((guess)integer) – how many samples to keep at the causal sampling rate
noise ((guess)float) – noise standard deviation for the VAR model
dist ((guess)string) – (GUESS)distribution from which to sample the weights. Available options are flat, flatsigned, beta, normal, uniform
- Returns:
- Return type:
randomSVARs#
- gunfolds.estimation.linear_model.randomSVARs(n, repeats=100, rate=2, density=0.1, th=0.09, burnin=100, ssize=2000, noise=0.1, strap_noise=0.1)[source]#
does what requested - help is on the way
- Parameters:
n (integer) – number of nodes in the desired graph
repeats (integer) – how many times to add noise and re-estiamte
rate (integer) – undersampling rate (1 - no undersampling)
density ((guess)float) – density of the graph to be generted
th ((guess)float) – threshold for discarding edges in A and B
burnin (integer) – number of samples to discard since the beginning of VAR sampling
ssize (integer) – how many samples to keep at the causal sampling rate
noise (float) – noise standard deviation for the VAR model
strap_noise (float) – amount of noise for bootstrapping
- Returns:
- Return type:
randweights#
sampleWeights#
scoreAGraph#
stableVAR#
- gunfolds.estimation.linear_model.stableVAR(n, density=0.1, dist='beta')[source]#
This function keeps trying to create a random graph and a random corresponding transition matrix until it succeeds.
- Parameters:
n ((guess)integer) – number of nodes in the graph
density ((guess)float) – ratio of total nodes to n^2 possible nodes
dist ((guess)string) – distribution from which to sample the weights. Available options are flat, flatsigned, beta, normal, uniform
- Returns:
- Return type:
symchol#
transitionMatrix#
transitionMatrix2#
transitionMatrix3#
transitionMatrix4#
- gunfolds.estimation.linear_model.transitionMatrix4(g, minstrength=0.1, distribution='normal', maxtries=1000)[source]#
- Parameters:
g (dictionary (
gunfolds
graph)) –gunfolds
graphminstrength (float) –
distribution (string) – (GUESS)distribution from which to sample the weights. Available options are flat, flatsigned, beta, normal, uniform
maxtries ((guess)integer) –
- Returns:
- Return type: