def test_loo_error_singular_values(self):
     pod = POD()
     rbf = RBF()
     db = Database(param, snapshots.T)
     rom = ROM(db, pod, rbf).fit()
     valid_svalues = rom.reduction.singular_values
     rom.loo_error()
     np.testing.assert_allclose(valid_svalues, rom.reduction.singular_values)
Exemple #2
0
 def test_loo_error(self):
     pod = POD()
     rbf = RBF()
     db = Database(param, snapshots.T)
     rom = ROM(db, pod, rbf)
     err = rom.loo_error()
     np.testing.assert_allclose(
         err,
         np.array([421.299091, 344.571787, 48.711501, 300.490491]),
         rtol=1e-4)
 def test_loo_error_01(self):
     pod = POD()
     rbf = RBF()
     db = Database(param, snapshots.T)
     rom = ROM(db, pod, rbf)
     err = rom.loo_error()
     np.testing.assert_allclose(
         err,
         np.array([0.540029, 1.211744, 0.271776, 0.919509]),
         rtol=1e-4)
 def test_loo_error_02(self):
     pod = POD()
     gpr = GPR()
     db = Database(param, snapshots.T)
     rom = ROM(db, pod, gpr)
     err = rom.loo_error(normalizer=False)
     np.testing.assert_allclose(
         err[0],
         np.array(0.639247),
         rtol=1e-3)
Exemple #5
0
from ipywidgets import interact


def plot_solution(mu0, mu1):
    new_mu = [mu0, mu1]
    pred_sol = rom.predict(new_mu)
    plt.figure(figsize=(8, 7))
    plt.triplot(triang, 'b-', lw=0.1)
    plt.tripcolor(triang, pred_sol)
    plt.colorbar()


interact(plot_solution, mu0=8, mu1=1)

# ## Error Approximation & Improvement
#
# At the moment, we used a database which is composed by 8 files. we would have an idea of the approximation accuracy we are able to reach with these high-fidelity solutions. Using the *leave-one-out* strategy, an error is computed for each parametric point in our database and these values are returned as array.

# In[12]:

for pt, error in zip(rom.database.parameters, rom.loo_error()):
    print(pt, error)

# Moreover, we can use the information about the errors to locate the parametric points where we have to compute the new high-fidelity solutions and add these to the database in order to optimally improve the accuracy.

# In[13]:

rom.optimal_mu()

# These function can be used to achieve the wanted (estimated) accuracy.