# idmtools_calibra.algorithms.fisher_inf_matrix module#

idmtools_calibra.algorithms.fisher_inf_matrix.perturbed_points(center, xmin, xmax, m=10, n=5, sample_size=1, resolution_raw=None)[source]#

Having the estimated optimal point (θ*), the next step is generating a set of perturbed points (samples). At this step, you can specify the size of perturbation (resolution). In case you do not input the perturbation size (resolution_raw=None), the script will pick a perturbation using the given range for each parameter (Xmin-Xmax). You need to allocate per-realization (M) and cross-realization (N). Note that $$M>p^2$$, where p is the number of parameters (size of θ). The number of cross-realization (N) should be set depending on the uncertainty of the model at the given final point (θ*). To choose N, you can use Chebyshev’s inequality.

You can allocate number of replicates of the model (n). The log-likelihood at each point obtains from n replicates of the model with different run numbers. Then these n replicates are used to compute the likelihood at that point. When we have a model with high uncertainty, the easiest way to compute the likelihood might be taking average of the multiple (n) replicates of the model run to compute the likelihood. Note that the algorithm only accepts n=1 now. But the Cramer Rao script has the potential to accept higher n, whenever a smoothing technique which requires multiple replicates of the model for computing the likelihood be added to the Analyzers.

Parameters:
• center – center point 1xp nparray

• xmin – minimum of parameters 1xp nparray

• xmax – maximum of parameters 1xp nparray

• m – number of Hessian estimates scalar-positive integer

• n – number of pseudodata vectors scalar-positive integer

• sample_size – sample size scalar-positive integer

• resolution_raw – minimum meaningful perturbation for each parameter 1xp nparray

Returns:

perturbed points (4MNn x 4+p) nparray

Return type:

X_perturbed

idmtools_calibra.algorithms.fisher_inf_matrix.compute_fisher_inf_matrix(center_point, df_ll_points, data_columns)[source]#

Compute the Fisher Information matrix using the LL of perturbed points

Computation of the Fisher information matrix (covariance matrix) This step returns a p×p covariance matrix, called Σ.

Atiye Alaeddini, 12/15/2017

Parameters:
• center_point – center point (1 x p) nparray

• df_ll_points – Log Likelihood of points DataFrame

• data_columns – List of columns to filter points with

Returns:

Fisher Information matrix (p x p) np array

Return type:

Fisher

idmtools_calibra.algorithms.fisher_inf_matrix.sample_cov_ellipse(cov, pos, num_of_pts=10)[source]#

Sample ‘num_of_pts’ points from the specified covariance matrix (cov).

Parameters:
• cov – 2-D array_like, The covariance matrix (inverse of fisher matrix). It must be symmetric and positive-semidefinite for proper sampling.

• pos – 1-D array_like, The location of the center of the ellipse, Mean of the multi variate distribution

• num_of_pts – The number of sample points.

Returns:

ndarray of the drawn samples, of shape (num_of_pts,).

idmtools_calibra.algorithms.fisher_inf_matrix.trunc_gauss(mu, sigma, low_bound, high_bound, num_of_pts, batch_size=100)[source]#
idmtools_calibra.algorithms.fisher_inf_matrix.div0(a, b)[source]#

ignore / 0, div0( [-1, 0, 1], 0 ) -> [0, 0, 0]

idmtools_calibra.algorithms.fisher_inf_matrix.near_pd(a, nit=10)[source]#