<jupyter_start><jupyter_text>Results of the estimator study (Section 4.3.1)<jupyter_code># ~~~
# This file is part of the paper:
#
#  "A NON-CONFORMING DUAL APPROACH FOR ADAPTIVE TRUST-REGION REDUCED BASIS
#           APPROXIMATION OF PDE-CONSTRAINED OPTIMIZATION"
#
#   https://github.com/TiKeil/NCD-corrected-TR-RB-approach-for-pde-opt
#
# Copyright 2019-2020 all developers. All rights reserved.
# License: Licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
# ~~~
from matplotlib import pyplot as plt
import matplotlib as mpl
mpl.rcParams['figure.figsize'] = (12.0, 8.0)
mpl.rcParams['font.size'] = 12
mpl.rcParams['savefig.dpi'] = 300<jupyter_output><empty_output><jupyter_text>Define data points from experiments We gather all results from the notebooks EXC10-estimator_study_with_basis_size_16  EXC10-estimator_study_with_basis_size_24  EXC10-estimator_study_with_basis_size_32  EXC10-estimator_study_with_basis_size_40  EXC10-estimator_study_with_basis_size_48  EXC10-estimator_study_with_basis_size_56<jupyter_code>data_points = [16, 24, 32, 40, 48, 56]

## functional 
max_J_error = [
    1.5602058, 0.0913711, 0.0766135, 0.0203013, 0.0069036, 0.0049428
]
max_J_estimator = [
    5.9913766, 0.1355419, 0.1245623, 0.0218672, 0.0070929, 0.0050998
] 

max_NCD_J_error = [
    0.0960233, 0.0078391, 0.0060158, 0.0000622, 0.0000290, 0.0000253 
]

max_NCD_J_estimator = [
    5.1036908, 0.1120268, 0.0782738, 0.0024091, 0.0001877, 0.0001684
] 

## gradient of the functional
max_DJ_error = [
    60.3425755, 11.1470314, 6.4303011, 0.4347226, 0.3154153, 0.3015742
]

max_DJ_estimator = [
    24291.8313696, 5358.8100309, 4503.6642106, 756.5755578, 321.9380287, 297.4647676 
] 

max_NCD_DJ_error = [
    6.3335463, 0.7063809, 0.3138649, 0.0082424, 0.0067837, 0.0063186
]

max_NCD_DJ_estimator = [
    636.4101662, 15.3648749, 10.5050809, 0.4986274, 0.0712033, 0.0608080
]

max_approx_DJ_error = [
    1.2382556, 0.0897214, 0.0900121, 0.0006126, 0.0002131, 0.0002262
]

max_approx_DJ_estimator = [
    513.9431314, 12.7039995, 8.8771813, 0.2603803, 0.0277693, 0.0249135
] 

## u sensitivities
max_d_u_error = [
    2.5355797, 0.9132762, 0.8533939, 0.1498923, 0.0852684, 0.0790111
]

max_d_u_estimator = [
    8.4667177, 1.3766618, 1.2687267, 0.3461900, 0.1496438, 0.1305220
] 

max_d_u_approx_error = [
    1.3156686, 0.1176869, 0.1127435, 0.0245833, 0.0091088, 0.0087819
]

max_d_u_approx_estimator = [
    6.9827936, 0.8449806, 0.7053271, 0.1680877, 0.0418925, 0.0395744
]

## p sensitivities
max_d_p_error = [
    496.3981420, 479.5000612, 398.5507306, 41.8563170, 38.5226734, 37.0718470
]

max_d_p_estimator = [
    5114.7334754, 1286.4496500, 1032.0519773, 198.5964992, 119.5864251, 109.1262473
] 

max_d_p_approx_error = [
    103.0201017, 89.1512782, 74.6967860, 6.1232911, 4.0908619, 3.0154769
]

max_d_p_approx_estimator = [
    4379.3465189, 930.7437716, 783.3274162, 112.6418339, 44.4683584, 42.1310719
] 

color0 = (0.65,0,0.15)
color1 = (0.84,0.19,0.15)
color2 = (0.96,0.43,0.26)
color4 = (1,0.88,0.56)
color3 = (0.99,0.68,0.38)
color6 = (0.27,0.46,0.71)

color5 = (0.67,0.85,0.91)<jupyter_output><empty_output><jupyter_text>Result for J (Figure 4A)<jupyter_code>plt.semilogy(data_points, max_J_error, 'o-', color=color4, label='error J')
plt.semilogy(data_points, max_NCD_J_error, 'v-', color=color1, label='error NCD-J')
plt.semilogy(data_points, max_J_estimator, 'o--', color=color4, label='estimate J')
plt.semilogy(data_points, max_NCD_J_estimator, 'v--', color=color1, label='estimate NCD-J')

plt.xlabel('greedy extension step')
plt.grid()
plt.legend()<jupyter_output><empty_output><jupyter_text>Result for gradient of J (Figure 4B)<jupyter_code>plt.semilogy(data_points, max_DJ_error, 'o-', color=color0, label='error DJ')
plt.semilogy(data_points, max_NCD_DJ_error, 'v-', color=color3, label='error NCD-DJ')
plt.semilogy(data_points, max_approx_DJ_error, 'd-', color=color6, label='error approx.DJ')
plt.semilogy(data_points, max_DJ_estimator, 'o--', color=color0, label='estimate DJ')
plt.semilogy(data_points, max_NCD_DJ_estimator, 'v--', color=color3, label='estimate NCD-DJ')
plt.semilogy(data_points, max_approx_DJ_estimator, 'd--', color=color6, label='estimate approx.DJ')

plt.xlabel('greedy extension step')
plt.grid()
plt.legend()<jupyter_output><empty_output><jupyter_text>Result for u sensitivities<jupyter_code>plt.semilogy(data_points, max_d_u_error, 'o-', color=color0, label='error u_dmu')
plt.semilogy(data_points, max_d_u_approx_error, 'v-', color=color3, label='error u_dmu-approx')
plt.semilogy(data_points, max_d_u_estimator, 'o--', color=color0, label='estimate u_dmu')
plt.semilogy(data_points, max_d_u_approx_estimator, 'v--', color=color3, label='estimate u_dmu-approx')


plt.xlabel('greedy extension step')
plt.grid()
plt.legend()<jupyter_output><empty_output><jupyter_text>Result for p sensitivities<jupyter_code>plt.semilogy(data_points, max_d_p_error, 'o-', color=color0, label='error p_dmu')
plt.semilogy(data_points, max_d_p_approx_error, 'v-', color=color3, label='error p_dmu-approx')
plt.semilogy(data_points, max_d_p_estimator, 'o--', color=color0, label='estimate p_dmu')
plt.semilogy(data_points, max_d_p_approx_estimator, 'v--', color=color3, label='estimate p_dmu-approx')

plt.xlabel('greedy extension step')
plt.grid()
plt.legend()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1453390622081076, 'fraction_numerical': 0.2004483467214646, 'mean_word_length': 5.593596059113301, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '491673', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 3114, 'n_tokens_neox': 2357, 'n_words': 371, 'path': 'notebooks/Paper1_simulations/Model_Problem_2_Estimator_study/Extended_results_of_the_estimator_study(Figure_4).ipynb', 'repo_name': 'TiKeil/NCD-corrected-TR-RB-approach-for-pde-opt', 'size': '5353'}