diff --git a/PEUQSE/InverseProblem.py b/PEUQSE/InverseProblem.py index bba1599f..d017a006 100644 --- a/PEUQSE/InverseProblem.py +++ b/PEUQSE/InverseProblem.py @@ -381,7 +381,7 @@ def __init__(self, UserInput = None): else: #Getting initial guess of parameters and populating the internal variable for it. 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. - self.UserInput.model['InputParameterInitialGuess'] = np.array(self.UserInput.mu_prior, dtype='float') + self.UserInput.model['InputParameterInitialGuess'] = np.array(UserInput.model['InputParameterPriorValues'], dtype='float') #From now, we switch to self.UserInput.InputParameterInitialGuess because this is needed in case we're going to do reducedParameterSpace or grid sampling. self.UserInput.InputParameterInitialGuess = np.array(self.UserInput.model['InputParameterInitialGuess'], dtype='float') # reassure the initial guess is a numpy array diff --git a/PEUQSE/UserInput.py b/PEUQSE/UserInput.py index 854633a6..f38dd6b2 100644 --- a/PEUQSE/UserInput.py +++ b/PEUQSE/UserInput.py @@ -38,7 +38,7 @@ 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. 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. 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). -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. +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. 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. 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. 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' diff --git a/setup.py b/setup.py index 182c54ff..edf1db31 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ AUTHOR = 'Aditya Savara' REQUIRES_PYTHON = '>=3.5.0' -VERSION = '1.2.4' +VERSION = '1.2.5' LICENSE = 'BSD-3-Clause'