pySINGLE Documentation - piomonti/pySINGLE GitHub Wiki
Python implementation of the SINGLE algorithm. For details please see here.
Any questions/feedback please email [email protected]
###The SINGLE
class
Everything is held within the SINGLE
class.
This takes the following inputs:
- data: (numpy array) observations on which to apply algorithm
- h: (integer, optional) width of Gaussian kernel used to estimate sample covariance matrices. Alternatively this parameter can be learnt using the
fit_radius
method - pen_type: (text) determines the nature of the temporal homogeneity penalty. Can be either "Fused" for a fused lasso penalty (l1 norm of differences) or "Elastic" for a elastic net penalty (l2 norm of differences). Will be "Fused" by default, however use "Elastic" to considerably speed improvement. Also note that "Fused" will require the spams module to be installed.
- l1, l2 (float, optional): sparsity & temporal homogeneity regularisation parameters. Alternatively these can be learnt using the
tune_params
method - parallel (boolean, optional): should code be implemented in parallel. Default is True.
- tol (float, optional): convergence criterion. Default is 0.001
- max_iter (int, optional): maximum number of iterations. Default is 100.
###Methods
The SINGLE
class has the following methods:
fit_radius Used to estimate the width of the Gaussian kernel in a cross-validation framework. This method takes the following inputs:
- h_vals (list): list of potential widths to consider.
- samples (list, optional): list of time indices over which to compare various width values. If this is omitted then all observations are used.
est_S Estimate sample covariance matrices using a Gaussian kernel. This method does not require any input.
tune_params Estimate l1 and l2 parameters by minimising AIC This method takes the following inputs:
- l1 (list, optional): list of potential l1 values to consider. If omitted then potential values are guessed from the data
- l2 (list, optional): list of potential l1 values to consider. If omitted then potential values are guessed from the data
fit Given all parameters have been estimated, this method is used to obtain estimates precision matrices using the SINGLE algorithm. This methods does not take any inputs.
plot Plot result partial correlations. This method takes the following inputs:
- index (list): list of which nodes to plot (all pairwise partial correlations will be displayed)
- ncol_(int, optional): number of columns in resulting plot