Internal API
This is the documentation of AHMI's internal API, it is subject to change without deprecation.
Types
AHMI.DataSet
AHMI.HMIData
AHMI.HMISettings
AHMI.IntegrationVolume
AHMI.PointCloud
AHMI.SearchResult
AHMI.WhiteningResult
Functions and macros
AHMI.create_hypercube
AHMI.create_hyperrectangle
AHMI.find_hypercube_centers
AHMI.hm_init
AHMI.hm_integrate!
AHMI.hm_whiteningtransformation!
AHMI.hyperrectangle_creationproccess!
AHMI.integrate_hyperrectangle_cov
AHMI.modify_hypercube!
AHMI.modify_integrationvolume!
AHMI.reduced_volume_hm
Documentation
AHMI.DataSet
— TypeDataSet{T<:AbstractFloat, I<:Integer}
AHMI-internal, not part of stable public API.
Holds the MCMC output. For construction use constructor: function DataSet{T<:Real}(data::Matrix{T}, logprob::Vector{T}, weights::Vector{T})
Variables
- 'data' : An P x N array with N data points with P parameters.
- 'logprob' : The logarithmic probability for each samples stored in an array
- 'weights' : How often each sample occurred. Set to an array of ones if working directly on MCMC output
- 'ids' : Array which is used to assign each sample to a batch, required for the cov. weighed uncertainty estimation
- .sortids : an array of indices which stores the original ordering of the samples (the space partitioning tree reorders the samples), required to calculate an effective sample size.
- 'N' : number of samples
- 'P' : number of parameters
- 'nsubsets' : the number of batches
- 'iswhitened' : a boolean value which indicates whether the data set is iswhitened
- 'isnew' : a boolean value which indicates whether the data set was swapped out with a different one (it is possible to redo the integration with a different sample set using previously generated hyper-rectangles)
- 'partitioningtree' : The space partitioning tree, used to efficiently identify samples in a point cloud
- 'startingIDs' : The Hyper-Rectangle Seed Samples are stored in this array
- 'tolerance' : A threshold required for the hyper-rectangle creation process.
AHMI.HMIData
— TypeHMIData{T<:AbstractFloat, I<:Integer}
AHMI-internal, not part of stable public API.
Includes all the informations of the integration process, including a list of hyper-rectangles, the results of the whitening transformation, the starting ids, and the average number of points and volume of the created hyper-rectangles.
Variables
- 'dataset1' : Data Set 1
- 'dataset2' : Data Set 2
- 'whiteningresult' : contains the whitening matrix and its determinant, required to scale the final integral estimate
- 'volumelist1' : An array of integration volumes created using dataset1, but filled with samples from dataset2
- 'volumelist2' : An array of integration volumes created using dataset2, but filled with samples from dataset1
- 'cubelist1' : An array of small hyper-cubes created around seeding samples of dataset 1
- 'cubelist2' : An array of small hyper-cubes created around seeding samples of dataset 2
- 'iterations1' : The number of volume adapting iterations for the creating volumelist1
- 'iterations2' : The number of volume adapting iterations for the creating volumelist2
- 'rejectedrects1' : An array of ids, indicating which hyper-rectangles of volumelist1 were rejected due to trimming
- 'rejectedrects2' : An array of ids, indicating which hyper-rectangles of volumelist2 were rejected due to trimming
- 'integralestimates' : A dictionary containing the final integral estimates with uncertainty estimation using different uncertainty estimators. Also includes all intermediate results required for the integral estimate combination
AHMI.HMISettings
— TypeHMISettings
AHMI-internal, not part of stable public API.
holds the settings for the hm_integrate function. There are several default constructors available: HMIFastSettings() HMIStandardSettings() HMIPrecisionSettings()
#Variables
- 'whitening_method::Symbol' : which whitening method to use
- 'max_startingIDs::Integer' : influences how many starting ids are allowed to be generated
- 'maxstartingIDsfraction::AbstractFloat' : how many points are considered as possible starting points as a fraction of total points available
- 'rect_increase::AbstractFloat' : describes the procentual rectangle volume increase/decrease during hyperrectangle creation. Low values can increase the precision if enough points are available but can cause systematically wrong results if not enough points are available.
- 'useallrects::Bool' : All rectangles are used for the integration process no matter how big their overlap is. If enabled the rectangles are weighted by their overlap.
- 'useMultiThreading' : activate multithreading support.
- 'warning_minstartingids' : the required minimum amount of starting samples
- 'dotrimming' : determines whether the integral estimates are trimmed (1σ trim) before combining them into a final result (more robust)
- 'uncertaintyestimators' : A dictionary of different uncertainty estimator functions. Currently three functions are available: hmcombineresultslegacy! (outdated, overestimates uncertainty significantly in higher dimensions), hmcombineresultscovweighted! (very fast) and hmcombineresults_analyticestimation! (recommended)
end
AHMI.IntegrationVolume
— TypeIntegrationVolume{T<:AbstractFloat, I<:Integer}
AHMI-internal, not part of stable public API.
Variables
- 'pointcloud' : holds the point cloud of the integration volume
- 'spatialvolume' : the boundaries of the integration volume
- 'volume' : the volume
Hold the point cloud and the spatial volume for integration.
AHMI.PointCloud
— TypePointCloud{T<:AbstractFloat, I<:Integer}
AHMI-internal, not part of stable public API.
Stores the information of the points of an e.g. HyperRectVolume
Variables
- 'maxLogProb' : The maximum log. probability of one of the points inside the hyper-rectangle
- 'minLogProb' : The minimum log. probability of one of the points inside the hyper-rectangle
- 'maxWeightProb' : the weighted max. log. probability
- 'minWeightProb' : the weighted min. log. probability
- 'probfactor' : The probability factor of the hyper-rectangle
- 'probweightfactor' : The weighted probability factor
- 'points' : The number of points inside the hyper-rectangle
- 'pointIDs' : the IDs of the points inside the hyper-rectangle, might be empty because it is optional and costs performance
- 'searchres' : used to boost performance
AHMI.SearchResult
— TypeSearchResult{T<:AbstractFloat, I<:Integer}
AHMI-internal, not part of stable public API.
Stores the results of the space partitioning tree's search function
Variables
- 'pointIDs' : the IDs of samples found, might be empty because it is optional
- 'points' : The number of points found.
- 'maxLogProb' : the maximum log. probability of the points found.
- 'minLogProb' : the minimum log. probability of the points found.
- 'maxWeightProb' : the weighted minimum log. probability found.
- 'minWeightProb' : the weighted maximum log. probfactor found.
AHMI.WhiteningResult
— TypeWhiteningResult{T<:AbstractFloat}
AHMI-internal, not part of stable public API.
Stores the information obtained during the Whitening Process
Variables
- 'determinant' : The determinant of the whitening matrix
- 'targetprobfactor' : The suggested target probability factor
- 'whiteningmatrix' : The whitening matrix
- 'meanvalue' : the mean vector of the input data
AHMI.create_hypercube
— Functioncreate_hypercube{T<:Real}(origin::Vector{T}, edgelength::T)::HyperRectVolume
AHMI-internal, not part of stable public API.
creates a hypercube shaped spatial volume
AHMI.create_hyperrectangle
— Functioncreate_hyperrectangle(...)
AHMI-internal, not part of stable public API.
This function creates a hyper-rectangle around each starting sample. It starts by building a hyper-cube and subsequently adapts each face individually, thus turning the hyper-cube into a hyper-rectangle. The faces are adjusted in a way to match the shape of the distribution as best as possible.
AHMI.find_hypercube_centers
— Functionfind_hypercube_centers(dataset::DataSet{T, I}, whiteningresult::WhiteningResult, settings::HMISettings)::Vector{I}
AHMI-internal, not part of stable public API.
finds possible starting points for the hyperrectangle creation
AHMI.hm_init
— Functionhm_init!(result, settings)
AHMI-internal, not part of stable public API.
Sets the global multithreading setting and ensures that a minimum number of samples, dependent on the number of dimensions, are provided.
AHMI.hm_integrate!
— Functionhm_integrate!(result, settings = HMIPrecisionSettings())
AHMI-internal, not part of stable public API.
This function starts the adaptive harmonic mean integration. See arXiv:1808.08051 for more details. It needs a HMIData struct as input, which holds the samples, in form of a dataset, the integration volumes and other properties, required for the integration, and the final result.
AHMI.hm_whiteningtransformation!
— Functionhm_whiteningtransformation!(result, settings)
AHMI-internal, not part of stable public API.
Applies a whitening transformation to the samples. A custom whitening method can be used by overriding settings.whitening_function!
AHMI.hyperrectangle_creationproccess!
— Functionhyperrectangle_creationproccess!(...)
AHMI-internal, not part of stable public API.
This function assigns each thread its own hyper-rectangle to build, if in multithreading-mode.
AHMI.integrate_hyperrectangle_cov
— FunctionEstimates reducedvolumehm quantity for one hyperrectangle including estimates from batches (for covariance calculations).
AHMI.modify_hypercube!
— Functioncreate_hypercube!{T<:Real}(origin::Vector{T}, edgelength::T)::HyperRectVolume
AHMI-internal, not part of stable public API.
resizes a hypercube shaped spatial volume
AHMI.modify_integrationvolume!
— Functionmodify_integrationvolume!(intvol::IntegrationVolume{T, I}, dataset::DataSet{T, I}, spvol::HyperRectVolume{T}, searchpts::Bool = true)
AHMI-internal, not part of stable public API.
updates an integration volume with new boundaries. Recalculates the pointcloud and volume.
AHMI.reduced_volume_hm
— Functionreduced_volume_hm!(log_prob, sample_weights, volume_size, n_total, weight_total, bias_correction==true)
Estimate reduced volume harmonic mean for given arguments. Includes bias corection by default. Note: Weights are expected to be frequency weights (i.e. counts).