ema workbench

Other Sub Sites

principal components prim

Code author: jhkwakkel <j.h.kwakkel (at) tudelft (dot) nl>

a more generic ‘user friendly’ implementation of the pca prim combi discussed in the envsoft manuscript D-12-00217: Dalal, S., Han, B., Lempert, R., Jayjocks, A., Hackbarth, A. Improving Scneario Discovery using Orhogonal Rotations.

this implementation can cope with subsets that are rotated jointly. This implementation is data type aware, so categorical variables are not rotated.

pca_prim.assert_dtypes(keys, dtypes)

helper fucntion that checks whether none of the provided keys has a dtype object as value.

pca_prim.determine_rotation(experiments)

Determine the rotation for the specified experiments

Parameters:experiments
pca_prim.perform_pca_prim(results, classify, exclude=['model', 'policy'], subsets={}, peel_alpha=0.05, paste_alpha=0.05, mass_min=0.05, threshold=None, pasting=True, threshold_type=1, obj_func=<function def_obj_func at 0x0E5797B0>)

Perform (un)constrained PCA-PRIM. The cases of interest are identified. Next, the experiments are rotated to the eigen space of the covariance matrix of the experiments of interest.

Parameters:
  • results – the return from perform_experiments
  • classify – the classify function to be used in PRIM
  • exclude – The uncertainties that should be excluded, optional argument
  • subsets – optional kwarg, expects a dictonary with group name as key and a list of uncertainty names as values. If this is used, a constrained PCA-PRIM is executed note: the list of uncertainties should not contain categorical uncertainties.
  • classify – either a string denoting the outcome of interest to use or a function. In case of a string and time series data, the end state is used.
  • peel_alpha – parameter controlling the peeling stage (default = 0.05).
  • paste_alpha – parameter controlling the pasting stage (default = 0.05).
  • mass_min – minimum mass of a box (default = 0.05).
  • threshold – the threshold of the output space that boxes should meet.
  • pasting – perform pasting stage (default=True)
  • threshold_type – If 1, the boxes should go above the threshold, if -1 the boxes should go below the threshold, if 0, the algorithm looks for both +1 and -1.
  • obj_func – The objective function to use. Default is def_obj_func()
Returns:

the rotation_matrix, the row_names, the column_names, the rotated_experiments, and the boxes found by prim

pca_prim.rotate_subset(value, orig_experiments, logical)

rotate a subset

Parameters:
  • value
  • orig_experiment
  • logical