Technical reference¶
- class elem_effects.permutations.PermutationsArray(num_dims, num_levels=4, lower=0.0, upper=1.0, index_array=True)¶
Create an array of possible input parameters, of dimensions (number of levels per parameter, number of parameters).
Can return either the percentages, from 0 to 1, which can be translated back into parameter space using the percentage point function; or the integer indices, from 0 to num_levels - 1, which are more easily used with a table of pre-calculated values which correspond to the percentages.
- Args:
- num_dims (integer): Number of input parmeters (number of parameters in model)
- num_levels (integer, optional, default 4): Number of possible levels per parameter
- lower (float, optional, default 0): Minimum parameter value
- upper (float, optional, default 1): Maximum parameter value
- index_array (boolean, optional, default True): Provide integer indices instead of percentages
- create()¶
Create the array of possible permutations.
- Returns:
- permutations array (NumPy array)
- class elem_effects.elem_effects.ElementaryEffects(model, trajectories)¶
Given an array of possible permutations and a model, compute the parameters that can be rejected using the method of elementary effects.
- class elem_effects.trajectories.Trajectory(start, end, order)¶
A trajectory of points where each point has a unique set of values for each parameter in the model.
The Method of Elementary Effects looks at the difference in model outputs from a change in one parameter at a time, and a trajectory is all parameter values needed so that each paramter changes once.
- Args:
- start (1-d numpy array): A numpy array of point coordinates at start of trajectory.
- end (1-d numpy array): A numpy array of point coordinates at end of trajectory.
- order (1-d integer numpy array): An array that lists the order that each parameter should be changed, e.g. [2, 0, 1] would mean the middle parameter changes first, then the last, and finally the first parameter is changed.
- get_at_index(i)¶
Get trajectory at index i, where is is step number, starting at zero (so when i=0, this is the first step in the trajectory, not the starting position).
Use self.reset() to revert to starting coordinates.
- Args:
- i (integer): Index to retrieve trajectory from.
- Returns:
- 1-d numpy array of coordinates.
- points()¶
Get a 2-d numpy array of all point coordinates for the entire trajectory.
- Returns:
- 2-d numpy array of coordinates of entire trajectory, where the first row is the starting coordinates, and the last row is the ending coordinates.
- reset()¶
Reset to starting coordinates.
- set_index(i)¶
Replace first i starting elements with final values. Useful in more expensive computations where the entire trajectory is not evaluated at once.
Does not return anything, but sets self.current to the correct values.
- Args:
- i (integer): Index to jump to (i.e. the number of trajectory steps already evaluated)
- class elem_effects.trajectories.TrajectoryPicker(permutations, num_trajs=500, pick=10, seed=None, verbose=True)¶
Pick a set of trajectories, maximizing distance from each other.
- calculate_distance(a, b)¶
Calculate the summed Manhattan distance from every point in the trajectory a to every point in the trajectory b.
- create_trajectory()¶
Create a randomized Trajectory object
- kennard_stone(distances, pick)¶
Pick n objects by maximizing the minimum distance from next candiadate.