Skip to content

Commit 44c9b31

Browse files
committed
making initial guess more intuitive for uniform distributions
1 parent a26dde0 commit 44c9b31

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

PEUQSE/InverseProblem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ def __init__(self, UserInput = None):
381381
else:
382382
#Getting initial guess of parameters and populating the internal variable for it.
383383
if ('InputParameterInitialGuess' not in self.UserInput.model) or (len(self.UserInput.model['InputParameterInitialGuess'])== 0): #if an initial guess is not provided, we use the prior.
384-
self.UserInput.model['InputParameterInitialGuess'] = np.array(self.UserInput.mu_prior, dtype='float')
384+
self.UserInput.model['InputParameterInitialGuess'] = np.array(UserInput.model['InputParameterPriorValues'], dtype='float')
385385
#From now, we switch to self.UserInput.InputParameterInitialGuess because this is needed in case we're going to do reducedParameterSpace or grid sampling.
386386
self.UserInput.InputParameterInitialGuess = np.array(self.UserInput.model['InputParameterInitialGuess'], dtype='float')
387387
# reassure the initial guess is a numpy array

PEUQSE/UserInput.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
model['simulateByInputParametersOnlyFunction'] = None #A function must be provided! This cannot be left as None. The function should normally return an array the same size and shape as responses_observed, or should return a None object when the simulation fails or the result is considered non-physical. Alternatively, the function can written an object that needs to be processed further by SimulationOutputProcessingFunction.
3939
model['simulationOutputProcessingFunction'] = None #An optional function may be provided which takes the outputs from simulateByInputParametersOnlyFunction and then processes them to match the size, shape, and scale of responses_observed. A None object can be returned when the simulation fails or the result is considered non-physical.
4040
model['reducedParameterSpace'] = [] #This is to keep parameters as 'constants'. Any parameter index in this list will be allowed to change, the rest will be held as constants. For example, using [0,3,4] would allow the first, fourth, and fifth parameters to vary and would keep the rest as constants (note that array indexing is used).
41-
model['responses_simulation_uncertainties'] = None #Optional. Can be none (not used in that case), a blank list [], or a list of lists the same shape as the observed responses with scalars that represent 1 standard deviation of uncertainty, or can be a function that returns such a list of the uncertainties after each simulation is done. For the function way, easiest way would be to have a function that extracts a list that gets updated in another namespace after each simulation. If a blank list is provided, [], then a heurestic will be used.
41+
model['responses_simulation_uncertainties'] = None #Optional. Can be none (not used in that case), a blank list [], or a list of lists the same shape as the observed responses with scalars that represent 1 standard deviation of uncertainty, or can be a function that returns such a list of the uncertainties after each simulation is done. For the function way, it should take the same type of discrete parameter vector as the simulation function. To avoid having the simulations run twice, one can use a a function that extracts a list that gets updated in another namespace after each simulation. If a blank list is provided, [], then a heurestic will be used.
4242
model['custom_logLikelihood'] = None #Optional. This should point to a function that takes the discrete parameter values as an argument and returns "logLikelihood, simulatedResponses". So the function returns a value for the logLikelihood (or proportional to it). The function must *also* return the simulated response output, though technically can just return the number 0 as the ssecond return. The function can be a simple as accessing a global dictionary. This feature is intended for cases where the likelihood cannot be described by a normal/gaussian distribution.
4343
model['custom_logPrior'] = None #Optional. This feature has been implemented but not tested, it is intended for cases where the prior distribution is not described by a normal distribution. The user will provide a function that takes in the parameters and returns a logPrior (or something proportional to a logPrior). If MCMC will be performed, the user will still need to fill out InputParametersPriorValuesUncertainties with std deviations or a covariance matrix since that is used to decide the mcmc steps.
4444
model['InputParameterPriorValues_upperBounds'] = [] #Optional. This should be a list/array of the same shape as InputParameterPriorValues. Use a value of "None" for any parameter that should not be bounded in this direction. The code then truncates any distribution to have a probability of 0 when any of the parameters go beyond their bounds (parameters equal to the bounds do not cause 0 probability to occur). ##As of May 4th 2020, this only has been checked for parameter_estimation_settings['scaling_uncertainties_type'] = 'off'

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
AUTHOR = 'Aditya Savara'
2323
REQUIRES_PYTHON = '>=3.5.0'
2424

25-
VERSION = '1.2.4'
25+
VERSION = '1.2.5'
2626

2727
LICENSE = 'BSD-3-Clause'
2828

0 commit comments

Comments
 (0)