Skip to content

Commit

Permalink
Merge pull request #300 from AdityaSavara/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
AdityaSavara authored Aug 5, 2022
2 parents 7a44cfe + 92ba6c0 commit c0779e0
Show file tree
Hide file tree
Showing 91 changed files with 9,273 additions and 905,309 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import sys; sys.path.insert(0, '../../'); import PEUQSE as PEUQSE
import PEUQSE.UserInput as UserInput

if __name__ == "__main__":
import observed_values_00 #Just a simple example. The user can also put the values in directly into the runfile or extract from a csv, for example.
import simulation_model_00 #Simple example.

UserInput.responses['responses_abscissa'] = observed_values_00.observed_data_x_values
UserInput.responses['responses_observed'] = observed_values_00.observed_data_y_values
UserInput.responses['responses_observed_uncertainties'] = observed_values_00.observed_data_y_values_uncertainties


UserInput.simulated_response_plot_settings['x_label'] = 'distance (m)'
UserInput.simulated_response_plot_settings['y_label'] = r'$time (s)$'


UserInput.model['parameterNamesAndMathTypeExpressionsDict'] = {'a':'a','b':'b'}
UserInput.model['InputParameterPriorValues'] = [200, 500] #prior expected values for a and b
UserInput.model['InputParametersPriorValuesUncertainties'] = [-1, -1] #required. #If user wants to use a prior with covariance, then this must be a 2D array/ list. To assume no covariance, a 1D
UserInput.model['InputParameterPriorValues_upperBounds'] = [1E6, 1E6]
UserInput.model['InputParameterPriorValues_lowerBounds'] = [-1E6, -1E6]
UserInput.parameter_estimation_settings['scaling_uncertainties_type'] = "off"
UserInput.parameter_estimation_settings['mcmc_random_seed'] = 0
#UserInput.model['InputParameterInitialGuess'] = [150,400] #Can optionally change the initial guess to be different from prior means.

UserInput.model['simulateByInputParametersOnlyFunction'] = simulation_model_00.simulation_function_wrapper #This must simulate with *only* the parameters listed above, and no other arguments.
#UserInput.parameter_estimation_settings['mcmc_burn_in'] = 10000
#UserInput.parameter_estimation_settings['mcmc_length'] = 100000 #The uninformed prior int his example has a "bad" MCMC walker so requires lots of sampling to converge.
UserInput.parameter_estimation_settings['multistart_checkPointFrequency'] = 10000 #This example is long enough that it's good to get updates.

UserInput.parameter_estimation_settings['multistart_searchType'] = 'doEnsembleSliceSampling'
UserInput.parameter_estimation_settings['multistart_initialPointsDistributionType'] = 'uniform'
UserInput.parameter_estimation_settings['multistart_exportLog'] = True
UserInput.parameter_estimation_settings['multistart_gridsearch_threshold_filter_coefficient'] = 2.0 #The lower this is, the more the points become filtered. It is not recommended to go below 2.0.
UserInput.parameter_estimation_settings['multistart_numStartPoints'] = 30
UserInput.parameter_estimation_settings['mcmc_length'] = 1000
UserInput.parameter_estimation_settings['multistart_relativeInitialDistributionSpread'] = 0.50


#After making the UserInput, now we make a 'parameter_estimation' object from it.
PE_object = PEUQSE.parameter_estimation(UserInput)

PE_object.doMultiStart()
PE_object.createAllPlots() #This function calls each of the below functions so that the user does not have to.
# PE_object.makeHistogramsForEachParameter()
# PE_object.makeSamplingScatterMatrixPlot()
# PE_object.createSimulatedResponsesPlots()
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import sys; sys.path.insert(0, '../../'); import PEUQSE as PEUQSE
import PEUQSE.UserInput as UserInput

if __name__ == "__main__":
import observed_values_00 #Just a simple example. The user can also put the values in directly into the runfile or extract from a csv, for example.
import simulation_model_00 #Simple example.

UserInput.responses['responses_abscissa'] = observed_values_00.observed_data_x_values
UserInput.responses['responses_observed'] = observed_values_00.observed_data_y_values
UserInput.responses['responses_observed_uncertainties'] = observed_values_00.observed_data_y_values_uncertainties


UserInput.simulated_response_plot_settings['x_label'] = 'distance (m)'
UserInput.simulated_response_plot_settings['y_label'] = r'$time (s)$'


UserInput.model['parameterNamesAndMathTypeExpressionsDict'] = {'a':'a','b':'b'}
UserInput.model['InputParameterPriorValues'] = [200, 500] #prior expected values for a and b
UserInput.model['InputParametersPriorValuesUncertainties'] = [-1, -1] #required. #If user wants to use a prior with covariance, then this must be a 2D array/ list. To assume no covariance, a 1D
UserInput.model['InputParameterPriorValues_upperBounds'] = [1E6, 1E6]
UserInput.model['InputParameterPriorValues_lowerBounds'] = [-1E6, -1E6]
UserInput.parameter_estimation_settings['scaling_uncertainties_type'] = "off"
UserInput.parameter_estimation_settings['mcmc_random_seed'] = 0
#UserInput.model['InputParameterInitialGuess'] = [150,400] #Can optionally change the initial guess to be different from prior means.

UserInput.model['simulateByInputParametersOnlyFunction'] = simulation_model_00.simulation_function_wrapper #This must simulate with *only* the parameters listed above, and no other arguments.
#UserInput.parameter_estimation_settings['mcmc_burn_in'] = 10000
#UserInput.parameter_estimation_settings['mcmc_length'] = 100000 #The uninformed prior int his example has a "bad" MCMC walker so requires lots of sampling to converge.
UserInput.parameter_estimation_settings['multistart_checkPointFrequency'] = 10000 #This example is long enough that it's good to get updates.

UserInput.parameter_estimation_settings['multistart_searchType'] = 'doEnsembleJumpSampling'
UserInput.parameter_estimation_settings['multistart_initialPointsDistributionType'] = 'uniform'
UserInput.parameter_estimation_settings['multistart_exportLog'] = True
UserInput.parameter_estimation_settings['multistart_gridsearch_threshold_filter_coefficient'] = 2.0 #The lower this is, the more the points become filtered. It is not recommended to go below 2.0.
UserInput.parameter_estimation_settings['multistart_numStartPoints'] = 30
UserInput.parameter_estimation_settings['mcmc_length'] = 1000
UserInput.parameter_estimation_settings['multistart_relativeInitialDistributionSpread'] = 0.50


#After making the UserInput, now we make a 'parameter_estimation' object from it.
PE_object = PEUQSE.parameter_estimation(UserInput)

PE_object.doMultiStart()
PE_object.createAllPlots() #This function calls each of the below functions so that the user does not have to.
# PE_object.makeHistogramsForEachParameter()
# PE_object.makeSamplingScatterMatrixPlot()
# PE_object.createSimulatedResponsesPlots()
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import sys; sys.path.insert(0, '../../'); import PEUQSE as PEUQSE
import PEUQSE.UserInput as UserInput

if __name__ == "__main__":
import observed_values_00 #Just a simple example. The user can also put the values in directly into the runfile or extract from a csv, for example.
import simulation_model_00 #Simple example.

UserInput.responses['responses_abscissa'] = observed_values_00.observed_data_x_values
UserInput.responses['responses_observed'] = observed_values_00.observed_data_y_values
UserInput.responses['responses_observed_uncertainties'] = observed_values_00.observed_data_y_values_uncertainties


UserInput.simulated_response_plot_settings['x_label'] = 'distance (m)'
UserInput.simulated_response_plot_settings['y_label'] = r'$time (s)$'


UserInput.model['parameterNamesAndMathTypeExpressionsDict'] = {'a':'a','b':'b'}
UserInput.model['InputParameterPriorValues'] = [200, 500] #prior expected values for a and b
UserInput.model['InputParametersPriorValuesUncertainties'] = [-1, -1] #required. #If user wants to use a prior with covariance, then this must be a 2D array/ list. To assume no covariance, a 1D
UserInput.model['InputParameterPriorValues_upperBounds'] = [1E6, 1E6]
UserInput.model['InputParameterPriorValues_lowerBounds'] = [-1E6, -1E6]
UserInput.parameter_estimation_settings['scaling_uncertainties_type'] = "off"
UserInput.parameter_estimation_settings['mcmc_random_seed'] = 0
#UserInput.model['InputParameterInitialGuess'] = [150,400] #Can optionally change the initial guess to be different from prior means.

UserInput.model['simulateByInputParametersOnlyFunction'] = simulation_model_00.simulation_function_wrapper #This must simulate with *only* the parameters listed above, and no other arguments.
#UserInput.parameter_estimation_settings['mcmc_burn_in'] = 10000
#UserInput.parameter_estimation_settings['mcmc_length'] = 100000 #The uninformed prior int his example has a "bad" MCMC walker so requires lots of sampling to converge.
UserInput.parameter_estimation_settings['multistart_checkPointFrequency'] = 10000 #This example is long enough that it's good to get updates.

UserInput.parameter_estimation_settings['multistart_searchType'] = 'doMetropolisHastings'
UserInput.parameter_estimation_settings['multistart_initialPointsDistributionType'] = 'uniform'
UserInput.parameter_estimation_settings['multistart_exportLog'] = True
UserInput.parameter_estimation_settings['multistart_gridsearch_threshold_filter_coefficient'] = 2.0 #The lower this is, the more the points become filtered. It is not recommended to go below 2.0.
UserInput.parameter_estimation_settings['multistart_numStartPoints'] = 30
UserInput.parameter_estimation_settings['mcmc_length'] = 1000
UserInput.parameter_estimation_settings['multistart_relativeInitialDistributionSpread'] = 0.50


#After making the UserInput, now we make a 'parameter_estimation' object from it.
PE_object = PEUQSE.parameter_estimation(UserInput)

PE_object.doMultiStart()
PE_object.createAllPlots() #This function calls each of the below functions so that the user does not have to.
# PE_object.makeHistogramsForEachParameter()
# PE_object.makeSamplingScatterMatrixPlot()
# PE_object.createSimulatedResponsesPlots()
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import sys; sys.path.insert(0, '../../'); import PEUQSE as PEUQSE
import PEUQSE.UserInput as UserInput

if __name__ == "__main__":
"""
This file is used to show how to continue sampling without keeping the previous data.
This file works in conjunction with Example_00d4.
The example will start with a EJS mcmc run then use ESS as the second sampler in the d4 file.
The number of walkers should be the same between runs for the last points to continue as the next sampling starting points.
"""
import observed_values_00 #Just a simple example. The user can also put the values in directly into the runfile or extract from a csv, for example.
import simulation_model_00 #Simple example.

UserInput.responses['responses_abscissa'] = observed_values_00.observed_data_x_values
UserInput.responses['responses_observed'] = observed_values_00.observed_data_y_values
UserInput.responses['responses_observed_uncertainties'] = observed_values_00.observed_data_y_values_uncertainties


UserInput.simulated_response_plot_settings['x_label'] = 'distance (m)'
UserInput.simulated_response_plot_settings['y_label'] = r'$time (s)$'
UserInput.simulated_response_plot_settings['fontdict'] = {'size':16}


UserInput.model['parameterNamesAndMathTypeExpressionsDict'] = {'a':'a','b':'b'}
UserInput.model['InputParameterPriorValues'] = [200, 500] #prior expected values for a and b
UserInput.model['InputParametersPriorValuesUncertainties'] = [100, 200] #required. #If user wants to use a prior with covariance, then this must be a 2D array/ list. To assume no covariance, a 1D
#UserInput.model['InputParameterInitialGuess'] = [150,400] #Can optionally change the initial guess to be different from prior means.
UserInput.parameter_estimation_settings['mcmc_nwalkers'] = 10

UserInput.model['simulateByInputParametersOnlyFunction'] = simulation_model_00.simulation_function_wrapper #This must simulate with *only* the parameters listed above, and no other arguments.


UserInput.parameter_estimation_settings['mcmc_threshold_filter_samples'] = True

UserInput.parameter_estimation_settings['mcmc_random_seed'] = None

UserInput.parameter_estimation_settings['mcmc_continueSampling'] = False # this example does not truly continue sampling since the old points are not saved.
#After making the UserInput, now we make a 'parameter_estimation' object from it.
PE_object = PEUQSE.parameter_estimation(UserInput)

PE_object.doEnsembleJumpSampling() #one can also use PE_object.doMetropolisHastings(continueSampling = True)
PE_object.createAllPlots() #This function calls each of the below functions so that the user does not have to.
# PE_object.makeHistogramsForEachParameter()
# PE_object.makeSamplingScatterMatrixPlot()
# PE_object.createSimulatedResponsesPlots()
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import sys; sys.path.insert(0, '../../'); import PEUQSE as PEUQSE
import PEUQSE.UserInput as UserInput

if __name__ == "__main__":
"""
This file is used to show how to continue sampling without keeping the previous data.
This file works in conjunction with Example_00d4.
The example will start with a EJS mcmc run then use ESS as the second sampler in the d4 file.
The number of walkers should be the same between runs for the last points to continue as the next sampling starting points.
"""
import observed_values_00 #Just a simple example. The user can also put the values in directly into the runfile or extract from a csv, for example.
import simulation_model_00 #Simple example.

UserInput.responses['responses_abscissa'] = observed_values_00.observed_data_x_values
UserInput.responses['responses_observed'] = observed_values_00.observed_data_y_values
UserInput.responses['responses_observed_uncertainties'] = observed_values_00.observed_data_y_values_uncertainties


UserInput.simulated_response_plot_settings['x_label'] = 'distance (m)'
UserInput.simulated_response_plot_settings['y_label'] = r'$time (s)$'
UserInput.simulated_response_plot_settings['fontdict'] = {'size':16}


UserInput.model['parameterNamesAndMathTypeExpressionsDict'] = {'a':'a','b':'b'}
UserInput.model['InputParameterPriorValues'] = [200, 500] #prior expected values for a and b
UserInput.model['InputParametersPriorValuesUncertainties'] = [100, 200] #required. #If user wants to use a prior with covariance, then this must be a 2D array/ list. To assume no covariance, a 1D
#UserInput.model['InputParameterInitialGuess'] = [150,400] #Can optionally change the initial guess to be different from prior means.
UserInput.parameter_estimation_settings['mcmc_nwalkers'] = 10

UserInput.model['simulateByInputParametersOnlyFunction'] = simulation_model_00.simulation_function_wrapper #This must simulate with *only* the parameters listed above, and no other arguments.


UserInput.parameter_estimation_settings['mcmc_threshold_filter_samples'] = True

UserInput.parameter_estimation_settings['mcmc_random_seed'] = None

UserInput.parameter_estimation_settings['mcmc_continueSampling'] = False # this example does not truly continue sampling since the old points are not saved.
# inputting a string into Initial guess, a pickle file is assumed. It will check if the file is in the cwd or in the pickles folder.
UserInput.model['InputParameterInitialGuess'] = 'mcmc_last_point_sampled.pkl'
#After making the UserInput, now we make a 'parameter_estimation' object from it.
PE_object = PEUQSE.parameter_estimation(UserInput)

PE_object.doEnsembleSliceSampling()
PE_object.createAllPlots() #This function calls each of the below functions so that the user does not have to.
# PE_object.makeHistogramsForEachParameter()
# PE_object.makeSamplingScatterMatrixPlot()
# PE_object.createSimulatedResponsesPlots()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/Example07/graphs/Heat_Scatter_theta_1_theta_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/Example07/graphs/Heat_Scatter_theta_2_theta_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/Example07/graphs/Histogram_sampling_0_theta_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/Example07/graphs/Histogram_sampling_1_theta_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/Example07/graphs/PosteriorContourPlots__0_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/Example07/graphs/PosteriorContourPlots__combined.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/Example07/graphs/Posterior_Example_two_response_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/Example07/graphs/Posterior_Example_two_response_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/Example07/graphs/scatter_matrix_posterior.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/Example28/0-Example28Explanation.docx
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/Example28/graphs_EJS/AutoCorrelationPlot_a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/Example28/graphs_EJS/AutoCorrelationPlot_b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/Example28/graphs_EJS/AutoCorrelationPlot_c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/Example28/graphs_EJS/GewekeDiagnostic_a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/Example28/graphs_EJS/GewekeDiagnostic_b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/Example28/graphs_EJS/GewekeDiagnostic_c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/Example28/graphs_EJS/Heat_Scatter_a_b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/Example28/graphs_EJS/Heat_Scatter_a_c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/Example28/graphs_EJS/Heat_Scatter_b_a.png
Binary file modified Examples/Example28/graphs_EJS/Heat_Scatter_b_c.png
Binary file modified Examples/Example28/graphs_EJS/Heat_Scatter_c_a.png
Binary file modified Examples/Example28/graphs_EJS/Heat_Scatter_c_b.png
Binary file modified Examples/Example28/graphs_EJS/Histogram_sampling_0_a.png
Binary file modified Examples/Example28/graphs_EJS/Histogram_sampling_1_b.png
Binary file modified Examples/Example28/graphs_EJS/Histogram_sampling_2_c.png
Binary file modified Examples/Example28/graphs_EJS/PosteriorContourPlots__0_1.png
Binary file modified Examples/Example28/graphs_EJS/PosteriorContourPlots__0_2.png
Binary file modified Examples/Example28/graphs_EJS/PosteriorContourPlots__1_2.png
Binary file modified Examples/Example28/graphs_EJS/Posterior_Simulated.png
Binary file modified Examples/Example28/graphs_EJS/scatter_matrix_posterior.png
Loading

0 comments on commit c0779e0

Please sign in to comment.