PCE#
- class uqpce.pce.pce.PCE(**kwargs)#
The Polynomial Chaos Exapansion (PCE) model class. This class is intended to be an interface for programmers.
- Parameters:
kwargs –
key word arguments used by UQPCE
- input_file :
file containing variables
- matrix_file :
file containing matrix elements
- results_file :
file containing results
- verification_results_file :
file containing verification results
- verification_matrix_file :
file containing verification matrix elements
- output_directory :
directory that the outputs will be put in
- case :
case name of input data
- significance :
significance level of the confidence interval
- order :
order of polynomial chaos expansion
- over_samp_ratio :
over sampling ratio; factor for how many points to be used in calculations
- verify_over_samp_ratio :
over sampling ratio for verification; factor for how many points to be used in calculations
- aleat_sub_samp_size :
the number of samples to check the new high and low intervals at for each individual curve
- epist_sub_samp_size :
the number of curves to check the new high and low intervals at for a set of curves
- conv_threshold_percent :
the percent of the response mean to be used as a threshold for tracking convergence
- epist_samp_size :
the number of times to sample for each variable with epistemic uncertainty
- aleat_samp_size :
the number of times to sample for each variable with aleatory uncertainty
- version :
displays the version of the software
- verbose :
increase output verbosity
- verify :
allows verification of results
- plot :
generates factor vs response plots, pbox plot, and error plots
- plot_stand :
plots standardized variables
- track_convergence_off :
allows users to converge on confidence interval until the change between the two iters is less than the threshold
- model_conf_int :
includes uncertainties associated with the model itself
- stats :
perform additional statistics for a more-comprehensive profile of the model
- seed :
if UQPCE should use a seed for random values
- add_variable(**kwargs) None#
Adds a variable with kwargs to the PCE object.
- Parameters:
kwargs – The input arguments required for the variable being added and the name of the distribution being added.
- backward_elimination() None#
Peforms backward elemination on the existing model.
- build_basis(order: int) None#
Builds the variable basis and norm squared for the model. This sets up the variable- and order- based information for the model that is independent of the response samples.
- Parameters:
order – An int for the order of the model to build
- check_fit() str#
Provides statistics on the fit of the model.
- check_variables(X: ndarray) bool#
Saves figures for all of the variables with their values plotted on them, if the data is available, which serves as a check if the user’s run matrix does not match their distributions well.
- Parameters:
X – The array of samples to check against the variable distributions
- confidence_interval() tuple#
Calls the ProbabilityBoxes class, resamples the model, and outputs the confidence interval at the set significance level.
- fit(X: ndarray, y: ndarray) ndarray#
Fits the PCE model and returns the matrix coefficients of the model.
- Parameters:
X – An m-by-n matrix with the first dimension having the number of samples in the model (m) and the second having the number of variables in the model (n).
y – The 2D numpy array of responses from the user’s analytic tool.
- from_yaml(input_file: str) dict#
Update the PCE object from the UQPCE YAML file. Adds the variables to the object and updates the settings.
- Parameters:
input_file – A string for the file name of the input yaml file
- generate_responses(X, equation: str) ndarray#
For testing purposes; allows users to generate samples according to an input function.
- Parameters:
X – An m-by-n matrix with the first dimension having the number of samples in the model (m) and the second having the number of variables in the model (n).
equation – A string represenation of the desired equation, using x0 for the first variable, x1 for the second, and so on.
- load_matrix_file(filename: str) ndarray#
Loads and returns a matrix file.
- Parameters:
filename – A string for the file name of the run matrix file
- predict(X: ndarray, return_uncert: bool = False) ndarray#
Predicts the model responses of an input matrix of values.
- Parameters:
X – An m-by-n matrix with the first dimension having the number of samples in the model (m) and the second having the number of variables in the model (n).
return_uncert – Boolean for if the method should return the uncertainty associated with the predicted responses.
- Returns:
resp_pred – the predicted value
uncert_mean – the uncertainty on the predicted value
- print() None#
Print the outputs for the model.
- resample_surrogate() ndarray#
Resamples the surrogate model.
- sample(count: int = - 1, seed=None) ndarray#
This method returns a matrix of samples from the input variables.
- Parameters:
count – The number of samples to generate. A value of -1 creates a number of samples based on the attribute over_samp_ratio.
- save_model() bool#
Pickles the entire PCE object.
- set_samples(X: ndarray) None#
Sets the run matrix samples for the PCE model.
- update_settings(**kwargs) None#
A method to update the object attributes with the input kwargs.
- Parameters:
kwargs – The key-value pairs for the keyword arguments to update for the PCE model
- verification(X: ndarray, y: ndarray) ndarray#
Predicts the response for the verification samples and compares the predicted responses to the user-provided verification response file.
- Parameters:
X – An m-by-n matrix with the first dimension having the number of samples in the model (m) and the second having the number of variables in the model (n).
y – The 2D numpy array of responses from the user’s analytic tool.
- Returns:
The error between the truth and the predicted reponses.
- Return type:
ver_error
- verify_sample(count: int = - 1, seed=None) ndarray#
Sample the number of verification values according to the input count or the set attribute verify_over_samp_ratio.
- Parameters:
count – The number of verification samples to generate. A value of -1 creates a number of samples based on the attribute verify_over_samp_ratio.
- write_outputs() None#
Writes all of the output files for all of the models associated with the PCE object.