gns.ns_loop_funcs module¶
-
gns.ns_loop_funcs.getEofWeightsLive(Eofw, LhoodStar, liveLhoods, trapezoidalFlag, ZLiveType)[source]¶ as above but non-log space version
-
gns.ns_loop_funcs.getEofZLive(nLive, EofX, livePointsLhood, LhoodStar, ZLiveType, trapezoidalFlag)[source]¶ as above but in linear space
-
gns.ns_loop_funcs.getLogEofWeightsLive(logEofw, LLhoodStar, liveLLhoods, trapezoidalFlag, ZLiveType)[source]¶ From Will’s implementation, Z = sum (X_im1 - X_i) * 0.5 * (L_i + L_im1) Unsure whether you should treat final contribution using trapezium rule (when it is used for rest of sum). I think you should and in case of ZLiveType == ‘average ‘, the L values used are L + {L_live} and in the case of ZLiveType == ‘max’, the L values used are L* + {max(L_live)}. When trapezium rule isn’t used (for rest of sum), L values used are {L_live} in case of ZLiveType == ‘average ‘ and {max(L_live)} in case of ZLiveType == ‘max’. When ZLiveType == ‘average *’ there is an added complication of what the average is ‘taken over’ (for both trapezium rule and standard quadrature) i.e. over the prior volume or the likelihood. If ZLiveType == ‘average X’ the average is taken over X, meaning there are still nLive live log weights (equally spaced in X with values X / nLive) which for standard quadrature have values: {log(X / nLive) + log(L_1), …, log(X / nLive) + log(L_nLive)} and for trapezium rule: {log(X / nLive) + log((L + L_1) / 2. ), …, log(X / nLive) + log((L_nLive-1 + L_nLive) / 2. )} If ZLiveType == ‘average Lhood’ the average is taken over the remaining L values, meaning there is 1 live log weight with X value X (i.e. the L_average value is assumed to be at X = 0). For the standard quadrature method the live log weight thus has a value log(X) + log(sum_i^nLive[L_i] / nLive) and for the trapezoidal rule log(X) + log((L* + sum_i^nLive[L_i] / nLive) / 2.). When ZLiveType == ‘max’, the maximum is obviously taken over the remaining Lhoods. Thus there is only one live log weight. For standard quadrature this is log(X) + log(max(L_i) and for the trapezium rule it is log(X) + log((L* + max(L_i)) / 2.) If averaging over L, final livepoint needs to be attributed this L, so it is stored here under the variable avLLhood
-
gns.ns_loop_funcs.getLogEofZLive(nLive, logEofX, livePointsLLhood, LLhoodStar, ZLiveType, trapezoidalFlag)[source]¶ NOTE logWeightsLive here is an np array newLiveLLhoods has same shape as logWeightsLive (i.e. account for averageLhoodOrX value). If ZLiveType == ‘max’ avLLhood will just be the maximum LLhood value. there is no averaging to consider if ZLiveType == ‘max Lhood’. Could return live weights, but these need to be calculated again in final contribution function so don’t bother
-
gns.ns_loop_funcs.getLogEofwLive(nLive, logEofX, ZLiveType)[source]¶ Determines final logw based on ZLiveType and averageLhoodOrX, i.e. it determines whether final contribution is averaged/ maximised over L or averaged over X.
-
gns.ns_loop_funcs.getMaxLhood(ZLiveType, livePointsLhood)[source]¶ For ZLiveType == ‘max’ returns a 1 element array with maximum LLhood value, its value as a scalar, and the index of the max LLhood in the given array. For ZLiveType == ‘average’ it essentially does nothing
-
gns.ns_loop_funcs.tryTermination(verbose, terminationType, terminationFactor, nest, nLive, EofX, livePointsLhood, LhoodStar, ZLiveType, trapezoidalFlag, EofZ, H)[source]¶ as above but in linear space
-
gns.ns_loop_funcs.tryTerminationLog(verbose, terminationType, terminationFactor, nest, nLive, logEofX, livePointsLLhood, LLhoodStar, ZLiveType, trapezoidalFlag, logEofZ, H)[source]¶ See if termination condition for main loop of NS has been met. Can be related to information value H or whether estimated remaining evidence is below a given fraction of the Z value calculated up to that iteration