User-Input Variable

User-Input Variable#

class uqpce.pce.variables.discrete.DiscreteVariable(pdf, interval_low, interval_high, order=2, name='', number=0)#

Class represents a discrete variable. When using a variable of only this type, the x_values must be standardized for the desired distribution and the probabilities must add up to 1.

Parameters:
  • pdf – the equation that defines the pdf of the variable values

  • interval_low – the low interval of the variable

  • interval_high – the high interval of the variable

  • order – the order of the model to calculate the orthogonal polynomials and norm squared values

  • name – the name of the variable

  • number – the number of the variable from the file

check_distribution(X)#

Checks all values in an array to ensure that they are standardized.

Parameters:

X – The array of samples to check against the variable distribution

check_num_string()#

Searches to replace sring ‘pi’ with its numpy equivalent in any of the values that might contain it.

create_norm_sq(x_values, probabilities)#

Calculates the norm squared values up to the order of polynomial expansion based on the probability density function and its corresponding orthogonal polynomials.

x_values :

the x-values associated with the variable

probabilities:

the probabilities associated with the x-values

generate_samples(samp_size, **kwargs)#

Overrides the Variable class generate_samples to align with a discrete uniform distribution.

Parameters:

samp_size – the number of points needed to be generated

get_mean()#

Returns the mean of a DiscreteVariable.

get_probability_density_func()#

Ensures that the probabilities sum to be 1.

recursive_var_basis(x_values, probabilities, order)#

Recursively calculates the variable basis up to the input ‘order’.

Parameters:
  • x_values – the x-values associated with the variable

  • probabilities – the probabilities associated with the x-values

  • order – the order of polynomial expansion

resample(samp_size)#

Overrides the Variable class resample to align with a discrete uniform distribution.

Parameters:

samp_size – the number of samples to generate according to the distribution

standardize(orig, std_vals)#

Overrides the Variable class standardize to align with a discrete uniform distribution.

Parameters:
  • orig – the un-standardized values

  • std_vals – the attribue name for the standardized vals

standardize_points(values)#

Standardizes and returns the inputs points.

Parameters:

values – unstandardized points corresponding to the variable’s distribution

unstandardize_points(value)#

Calculates and returns the unscaled variable value from the standardized value.

Parameters:

values – unstandardized points corresponding to the variable’s distribution