src.variants.metrics.area_metrics module
This module includes area validation metrics.
It includes several types of area validation metrics. See details in their own documentations. The functions are mainly based on numpy arrays for fast vectorized operations.
The general theory can be found, e.g., in [1, Ch. 12.8.2].
Literature: [1] W. L. Oberkampf and C. J. Roy, Verification and Validation in Scientific Computing, Cambridge, Cambridge University Press, 2010, ISBN: 9780511760396.
Contact person: Stefan Riedmaier Creation date: 03.06.2020 Python version: 3.8
- src.variants.metrics.area_metrics.avm(pbox_y_model, pbox_y_system, pbox_x_model_list, pbox_x_system_list, axis=-1)
This function calculates the area validation metric (AVM).
The theory can be found, e.g., in [1, Ch. 12.8.2].
Literature: [1] W. L. Oberkampf and C. J. Roy, Verification and Validation in Scientific Computing, Cambridge, Cambridge University Press, 2010, ISBN: 9780511760396.
- Parameters:
pbox_y_model (np.ndarray) – y vector of the model
pbox_y_system (np.ndarray) – y vector of the system
pbox_x_model_list (list[np.ndarray, np.ndarray]) – 2-element list with left and right x vector of the model
pbox_x_system_list (list[np.ndarray, np.ndarray]) – 2-element list with left and right x vector of the system
axis (int) – (optional) along this axis the operation is performed
- Returns:
area validation metric
- Rtpye:
np.ndarray
- src.variants.metrics.area_metrics.calc_areas(pbox_y_model, pbox_y_system, pbox_x_model_list, pbox_x_system_list, axis=-1)
This function determines the different areas.
It calls the calc_left_area and calc_right_area functions to determine the areas.
- Parameters:
pbox_y_model (np.ndarray) – y vector of the model
pbox_y_system (np.ndarray) – y vector of the system
pbox_x_model_list (list[np.ndarray, np.ndarray]) – 2-element list with left and right x vector of the model
pbox_x_system_list (list[np.ndarray, np.ndarray]) – 2-element list with left and right x vector of the system
axis (int) – (optional) along this axis the operation is performed
- Returns:
arrays of left, right, worst case left and worst case right areas
- Return type:
tuple(np.ndarray, np.ndarray, np.ndarray, np.ndarray)
- src.variants.metrics.area_metrics.calc_left_area(y, x1, x2, axis=-1)
This function calculates the areas where x2 is on the left side of x1.
The areas can be interpreted as rectangles.
- Parameters:
y (np.ndarray) – joint y vector
x1 (np.ndarray) – first x vector
x2 (np.ndarray) – second x vector
axis (int) – (optional) along this axis the operation is performed
- Returns:
calculated areas
- Return type:
np.ndarray
- src.variants.metrics.area_metrics.calc_right_area(y, x1, x2, axis=-1)
This function calculates the area where x2 is on the right side of x1.
The areas can be interpreted as rectangles.
- Parameters:
y (np.ndarray) – joint y vector
x1 (np.ndarray) – first x vector
x2 (np.ndarray) – second x vector
axis (int) – (optional) along this axis the operation is performed
- Returns:
calculated areas
- Return type:
np.ndarray
- src.variants.metrics.area_metrics.iavm(pbox_y_model, pbox_y_system, pbox_x_model_list, pbox_x_system_list, axis=-1)
This function calculates the interval area validation metric (IAVM).
d_upper_plus / area_right: system upper limit function / left pbox edge > model ECDF / right pbox edge d_upper_minus / area_left_wc: system upper limit function / left pbox edge < model ECDF / left pbox edge d_lower_plus / area_right_wc: system lower limit function / right pbox edge > model ECDF / right pbox edge d_lower_minus / area_left: system lower limit function / right pbox edge < model ECDF / left pbox edge
Literature: N. Wang, W. Yao, Y. Zhao, X. Chen, X. Zhang and L. Li, „A New Interval Area Metric for Model Validation With Limited Experimental Data,“ Journal of Mechanical Design, vol. 140, no. 6, 2018.
- Parameters:
pbox_y_model (np.ndarray) – y vector of the model
pbox_y_system (np.ndarray) – y vector of the system
pbox_x_model_list (list[np.ndarray, np.ndarray]) – 2-element list with left and right x vector of the model
pbox_x_system_list (list[np.ndarray, np.ndarray]) – 2-element list with left and right x vector of the system
axis (int) – (optional) along this axis the operation is performed
- Returns:
interval area validation metric
- Rtpye:
np.ndarray
- src.variants.metrics.area_metrics.mavm(pbox_y_model, pbox_y_system, pbox_x_model_list, pbox_x_system_list, axis=-1, f0=4.0, f1=1.25)
This function calculates the modified area validation metric (MAVM).
Literature: I. T. Voyles and C. J. Roy, „Evaluation of Model Validation Techniques in the Presence of Aleatory and Epistemic Input Uncertainties,“ in 17th AIAA Non-Deterministic Approaches Conference, 2015, ISBN: 978-1-62410-347-6.
- Parameters:
pbox_y_model (np.ndarray) – y vector of the model
pbox_y_system (np.ndarray) – y vector of the system
pbox_x_model_list (list[np.ndarray, np.ndarray]) – 2-element list with left and right x vector of the model
pbox_x_system_list (list[np.ndarray, np.ndarray]) – 2-element list with left and right x vector of the system
axis (int) – (optional) along this axis the operation is performed
f0 (float) – (optional) f0 value of the safety factor fs
f1 (float) – (optional) f1 value of the safety factor fs
- Returns:
modified area validation metric
- Rtpye:
np.ndarray
- src.variants.metrics.area_metrics.merge_ecdf_functions(ay, by, ax_list=None, bx_list=None, axis=-1)
This function merges ecdf functions to get a joint y vector and the corresponding x vectors.
This is important for the rectangular area calculations, since both ecdfs need to have the same number of steps.
If the ax_list resp. the bx_list is provided, the resulting x vectors are returned. Otherwise, the index vectors are returned to index x vectors.
- Parameters:
ay (np.ndarray) – first y vector
by (np.ndarray) – second y vector
ax_list (list[np.ndarray, np.ndarray]) – (optional) list of first x vectors
bx_list (list[np.ndarray, np.ndarray]) – (optional) list of second x vectors
axis (int) – (optional) along this axis the operation is performed
- Returns:
joint y vector and the corresponding x vectors resp. the indices to index them
- Return type:
tuple(np.ndarray, list[np.ndarray], list[np.ndarray])
- src.variants.metrics.area_metrics.polygon_area(x, y)
This function calculates the area of a simple polygon with Shoelace formula.
https://stackoverflow.com/questions/24467972/calculate-area-of-polygon-given-x-y-coordinates
- Parameters:
x – input vector
y – output vector
- Returns:
area