Skip to content

Commit

Permalink
Hyperreduction working well for Advection2D
Browse files Browse the repository at this point in the history
  • Loading branch information
vpuri3 committed Jun 20, 2024
1 parent e4a54b7 commit fbbcf56
Show file tree
Hide file tree
Showing 296 changed files with 516 additions and 312 deletions.
1 change: 1 addition & 0 deletions experiments_SNFROM/advect_fourier1D/snf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ device = Lux.gpu_device()
# makedata_kws = (; Ix = :, _Ib = [1,], Ib_ = [1,], _It = :, It_ = :)
# train_SNF_compare(latent, datafile, modeldir, train_params; rng, device)

evolve_kw = (; hyper_reduction = true,)
postprocess_SNF(prob, datafile, modelfile; rng, device)
#======================================================#
nothing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions experiments_SNFROM/advect_fourier2D/dump/statistics_01.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Epoch [0 / 0] TRAIN LOSS: 0.07959339 || TEST LOSS: 0.07959339
#======================#
TRAIN STATS
R² score: 0.89782786
MSE (mean SQR error): 0.07950444
RMSE (Root MSE): 0.28196532
MAE (mean ABS error): 0.083624355
maxAE (max ABS error) 4.9364767
Lipschitz bound: 2.9390372e6

#======================#
#======================#
TEST STATS
R² score: 0.89782786
MSE (mean SQR error): 0.07950444
RMSE (Root MSE): 0.28196532
MAE (mean ABS error): 0.083624355
maxAE (max ABS error) 4.9364767
Lipschitz bound: 2.9390372e6

#======================#
21 changes: 21 additions & 0 deletions experiments_SNFROM/advect_fourier2D/dump/statistics_02.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Epoch [0 / 0] TRAIN LOSS: 9.108968e-5 || TEST LOSS: 9.108968e-5
#======================#
TRAIN STATS
R² score: 0.9999883
MSE (mean SQR error): 1.1684139e-5
RMSE (Root MSE): 0.0034182067
MAE (mean ABS error): 0.0013902619
maxAE (max ABS error) 0.17474842
Lipschitz bound: 1.4389324e7

#======================#
#======================#
TEST STATS
R² score: 0.9999883
MSE (mean SQR error): 1.1684139e-5
RMSE (Root MSE): 0.0034182067
MAE (mean ABS error): 0.0013902619
maxAE (max ABS error) 0.17474842
Lipschitz bound: 1.4389324e7

#======================#
21 changes: 21 additions & 0 deletions experiments_SNFROM/advect_fourier2D/dump/statistics_03.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Epoch [0 / 0] TRAIN LOSS: 6.393927e-5 || TEST LOSS: 6.393927e-5
#======================#
TRAIN STATS
R² score: 0.99999785
MSE (mean SQR error): 2.164636e-6
RMSE (Root MSE): 0.0014712702
MAE (mean ABS error): 0.00066710263
maxAE (max ABS error) 0.07369709
Lipschitz bound: 2.0018566e7

#======================#
#======================#
TEST STATS
R² score: 0.99999785
MSE (mean SQR error): 2.1646363e-6
RMSE (Root MSE): 0.0014712703
MAE (mean ABS error): 0.00066710263
maxAE (max ABS error) 0.07369709
Lipschitz bound: 2.0018566e7

#======================#
21 changes: 21 additions & 0 deletions experiments_SNFROM/advect_fourier2D/dump/statistics_04.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Epoch [0 / 0] TRAIN LOSS: 4.8295835e-5 || TEST LOSS: 4.8295835e-5
#======================#
TRAIN STATS
R² score: 0.9999996
MSE (mean SQR error): 4.428761e-7
RMSE (Root MSE): 0.00066548935
MAE (mean ABS error): 0.00040202946
maxAE (max ABS error) 0.030995367
Lipschitz bound: 2.5403956e7

#======================#
#======================#
TEST STATS
R² score: 0.9999996
MSE (mean SQR error): 4.42876e-7
RMSE (Root MSE): 0.0006654893
MAE (mean ABS error): 0.00040202946
maxAE (max ABS error) 0.030995367
Lipschitz bound: 2.5403956e7

#======================#
21 changes: 21 additions & 0 deletions experiments_SNFROM/advect_fourier2D/dump/statistics_05.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Epoch [0 / 0] TRAIN LOSS: 4.1022606e-5 || TEST LOSS: 4.1022606e-5
#======================#
TRAIN STATS
R² score: 0.9999997
MSE (mean SQR error): 3.0104553e-7
RMSE (Root MSE): 0.0005486762
MAE (mean ABS error): 0.00033684052
maxAE (max ABS error) 0.022165298
Lipschitz bound: 2.7718932e7

#======================#
#======================#
TEST STATS
R² score: 0.9999997
MSE (mean SQR error): 3.0104553e-7
RMSE (Root MSE): 0.0005486762
MAE (mean ABS error): 0.00033684052
maxAE (max ABS error) 0.022165298
Lipschitz bound: 2.7718932e7

#======================#
21 changes: 21 additions & 0 deletions experiments_SNFROM/advect_fourier2D/dump/statistics_06.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Epoch [0 / 0] TRAIN LOSS: 3.662684e-5 || TEST LOSS: 3.662684e-5
#======================#
TRAIN STATS
R² score: 0.99999976
MSE (mean SQR error): 2.568104e-7
RMSE (Root MSE): 0.0005067646
MAE (mean ABS error): 0.00032269835
maxAE (max ABS error) 0.020819664
Lipschitz bound: 2.8856308e7

#======================#
#======================#
TEST STATS
R² score: 0.99999976
MSE (mean SQR error): 2.568104e-7
RMSE (Root MSE): 0.0005067646
MAE (mean ABS error): 0.00032269835
maxAE (max ABS error) 0.020819664
Lipschitz bound: 2.8856308e7

#======================#
21 changes: 21 additions & 0 deletions experiments_SNFROM/advect_fourier2D/dump/statistics_07.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Epoch [0 / 0] TRAIN LOSS: 3.377672e-5 || TEST LOSS: 3.377672e-5
#======================#
TRAIN STATS
R² score: 0.99999976
MSE (mean SQR error): 2.4681898e-7
RMSE (Root MSE): 0.0004968088
MAE (mean ABS error): 0.00032304114
maxAE (max ABS error) 0.018532751
Lipschitz bound: 2.9604058e7

#======================#
#======================#
TEST STATS
R² score: 0.99999976
MSE (mean SQR error): 2.46819e-7
RMSE (Root MSE): 0.00049680885
MAE (mean ABS error): 0.00032304114
maxAE (max ABS error) 0.018532751
Lipschitz bound: 2.9604058e7

#======================#
21 changes: 21 additions & 0 deletions experiments_SNFROM/advect_fourier2D/dump/statistics_08.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Epoch [0 / 0] TRAIN LOSS: 3.1731557e-5 || TEST LOSS: 3.1731557e-5
#======================#
TRAIN STATS
R² score: 0.99999976
MSE (mean SQR error): 2.1531628e-7
RMSE (Root MSE): 0.00046402184
MAE (mean ABS error): 0.00030401754
maxAE (max ABS error) 0.018846512
Lipschitz bound: 3.0150234e7

#======================#
#======================#
TEST STATS
R² score: 0.99999976
MSE (mean SQR error): 2.1531628e-7
RMSE (Root MSE): 0.00046402184
MAE (mean ABS error): 0.00030401754
maxAE (max ABS error) 0.018846512
Lipschitz bound: 3.0150234e7

#======================#
24 changes: 24 additions & 0 deletions experiments_SNFROM/advect_fourier2D/snf.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
using NeuralROMs
joinpath(pkgdir(NeuralROMs), "experiments_SNFROM", "compare.jl") |> include
#======================================================#

rng = Random.default_rng()
Random.seed!(rng, 199)

prob = Advection2D(0.25f0, 0.25f0)
datafile = joinpath(@__DIR__, "data_advect/", "data.jld2")
modeldir = joinpath(@__DIR__, "dump")
modelfile = joinpath(modeldir, "model_08.jld2")
device = Lux.gpu_device()

# latent = 2
# batchsize_ = (128 * 128) * 500 ÷ 4
# makedata_kws = (; Ix = :, _Ib = [1,], Ib_ = [1,], _It = :, It_ = :)
# train_params = (; E = 1400, wd = 128, α = 0f-0, γ = 1f-2, makedata_kws, batchsize_)
# train_SNF_compare(latent, datafile, modeldir, train_params; rng, device)

evolve_kw = (; hyper_reduction = true)
postprocess_SNF(prob, datafile, modelfile; rng, evolve_kw, device)
#======================================================#
nothing
36 changes: 18 additions & 18 deletions experiments_SNFROM/burgers_fourier1D/burgers1d_compare.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ modeldir_CAE = joinpath(@__DIR__, "model_CAE$(l0)") # Lee, Carlberg
modeldir_SNW = joinpath(@__DIR__, "model_SNW$(l0)") # us (Weight decay)
modeldir_SNL = joinpath(@__DIR__, "model_SNL$(l0)") # us (Lipschitz)

# train PCA
train_PCA(datafile, modeldir_PCA, l_pca; rng, makedata_kws, device)

# train_CAE
train_params_CAE = (; E = 1400, w = 64, makedata_kws,)
train_CAE_compare(prob, latent, datafile, modeldir_CAE, train_params_CAE; rng, device)

# train_SNW
train_params_SNW = (; E = 1400, wd = 128, α = 0f-0, γ = 1f-2, makedata_kws)#, batchsize_)
train_SNF_compare(latent, datafile, modeldir_SNW, train_params_SNW; rng, device)

# train_SNL
train_params_SNL = (; E = 1400, wd = 128, α = 1f-4, γ = 0f-0, makedata_kws)#, batchsize_)
train_SNF_compare(latent, datafile, modeldir_SNL, train_params_SNL; rng, device)
# # train PCA
# train_PCA(datafile, modeldir_PCA, l_pca; rng, makedata_kws, device)
#
# # train_CAE
# train_params_CAE = (; E = 1400, w = 64, makedata_kws,)
# train_CAE_compare(prob, latent, datafile, modeldir_CAE, train_params_CAE; rng, device)
#
# # train_SNW
# train_params_SNW = (; E = 1400, wd = 128, α = 0f-0, γ = 1f-2, makedata_kws)#, batchsize_)
# train_SNF_compare(latent, datafile, modeldir_SNW, train_params_SNW; rng, device)
#
# # train_SNL
# train_params_SNL = (; E = 1400, wd = 128, α = 1f-4, γ = 0f-0, makedata_kws)#, batchsize_)
# train_SNF_compare(latent, datafile, modeldir_SNL, train_params_SNL; rng, device)

#==================#
# postprocess
Expand All @@ -60,10 +60,10 @@ modelfile_SNL = joinpath(modeldir_SNL, "model_08.jld2")
evolve_kw = (;)
# evolve_kw = (; adaptive = true)

postprocess_PCA(prob, datafile, modelfile_PCA; rng, device)
postprocess_CAE(prob, datafile, modelfile_CAE; rng, evolve_kw)
postprocess_SNF(prob, datafile, modelfile_SNW; rng, evolve_kw, device)
postprocess_SNF(prob, datafile, modelfile_SNL; rng, evolve_kw, device)
# postprocess_PCA(prob, datafile, modelfile_PCA; rng, device)
# postprocess_CAE(prob, datafile, modelfile_CAE; rng, evolve_kw)
# postprocess_SNF(prob, datafile, modelfile_SNW; rng, evolve_kw, device)
# postprocess_SNF(prob, datafile, modelfile_SNL; rng, evolve_kw, device)

#==================#
# make figures
Expand Down
Binary file modified experiments_SNFROM/burgers_fourier1D/compare_er_case1.png
Binary file modified experiments_SNFROM/burgers_fourier1D/compare_er_case2.png
Binary file modified experiments_SNFROM/burgers_fourier1D/compare_er_case3.png
Binary file modified experiments_SNFROM/burgers_fourier1D/compare_er_case4.png
Binary file modified experiments_SNFROM/burgers_fourier1D/compare_er_case5.png
Binary file modified experiments_SNFROM/burgers_fourier1D/compare_er_case6.png
Binary file modified experiments_SNFROM/burgers_fourier1D/compare_t0_case1.png
Binary file modified experiments_SNFROM/burgers_fourier1D/compare_t0_case2.png
Binary file modified experiments_SNFROM/burgers_fourier1D/compare_t0_case3.png
Binary file modified experiments_SNFROM/burgers_fourier1D/compare_t0_case4.png
Binary file modified experiments_SNFROM/burgers_fourier1D/compare_t0_case5.png
Binary file modified experiments_SNFROM/burgers_fourier1D/compare_t0_case6.png
Binary file modified experiments_SNFROM/burgers_fourier1D/compare_t1_case1.png
Binary file modified experiments_SNFROM/burgers_fourier1D/compare_t1_case2.png
Binary file modified experiments_SNFROM/burgers_fourier1D/compare_t1_case3.png
Binary file modified experiments_SNFROM/burgers_fourier1D/compare_t1_case4.png
Binary file modified experiments_SNFROM/burgers_fourier1D/compare_t1_case5.png
Binary file modified experiments_SNFROM/burgers_fourier1D/compare_t1_case6.png
26 changes: 13 additions & 13 deletions experiments_SNFROM/burgers_fourier1D/model_CAE02/statistics_01.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
Epoch [0 / 0] TRAIN LOSS: 3.29769e-5 || TEST LOSS: 3.29769e-5
Epoch [0 / 0] TRAIN LOSS: 3.4859244e-5 || TEST LOSS: 3.4859244e-5
#======================#
TRAIN STATS
R² score: 0.9999656
MSE (mean SQR error): 3.29769e-5
RMSE (Root MSE): 0.0057425518
MAE (mean ABS error): 0.0039906665
maxAE (max ABS error) 0.33689684
Lipschitz bound: 9.251425
R² score: 0.9999637
MSE (mean SQR error): 3.4859244e-5
RMSE (Root MSE): 0.0059041716
MAE (mean ABS error): 0.00399306
maxAE (max ABS error) 0.32053757
Lipschitz bound: 8.303828

#======================#
#======================#
TEST STATS
R² score: 0.9999656
MSE (mean SQR error): 3.2976903e-5
RMSE (Root MSE): 0.0057425518
MAE (mean ABS error): 0.003990666
maxAE (max ABS error) 0.33689684
Lipschitz bound: 9.251425
R² score: 0.9999637
MSE (mean SQR error): 3.485924e-5
RMSE (Root MSE): 0.0059041716
MAE (mean ABS error): 0.00399306
maxAE (max ABS error) 0.32053757
Lipschitz bound: 8.303828

#======================#
26 changes: 13 additions & 13 deletions experiments_SNFROM/burgers_fourier1D/model_CAE02/statistics_02.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
Epoch [0 / 0] TRAIN LOSS: 1.14264185e-5 || TEST LOSS: 1.14264185e-5
Epoch [0 / 0] TRAIN LOSS: 1.4201271e-5 || TEST LOSS: 1.4201271e-5
#======================#
TRAIN STATS
R² score: 0.999988
MSE (mean SQR error): 1.14264185e-5
RMSE (Root MSE): 0.0033802984
MAE (mean ABS error): 0.0022574454
maxAE (max ABS error) 0.2184813
Lipschitz bound: 10.982954
R² score: 0.9999851
MSE (mean SQR error): 1.4201271e-5
RMSE (Root MSE): 0.003768457
MAE (mean ABS error): 0.002523462
maxAE (max ABS error) 0.28752708
Lipschitz bound: 9.592586

#======================#
#======================#
TEST STATS
R² score: 0.999988
MSE (mean SQR error): 1.1426417e-5
RMSE (Root MSE): 0.0033802984
MAE (mean ABS error): 0.0022574456
maxAE (max ABS error) 0.2184813
Lipschitz bound: 10.982954
R² score: 0.9999851
MSE (mean SQR error): 1.4201269e-5
RMSE (Root MSE): 0.003768457
MAE (mean ABS error): 0.002523462
maxAE (max ABS error) 0.28752708
Lipschitz bound: 9.592586

#======================#
26 changes: 13 additions & 13 deletions experiments_SNFROM/burgers_fourier1D/model_CAE02/statistics_03.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
Epoch [0 / 0] TRAIN LOSS: 4.1313647e-6 || TEST LOSS: 4.1313647e-6
Epoch [0 / 0] TRAIN LOSS: 8.287154e-6 || TEST LOSS: 8.287154e-6
#======================#
TRAIN STATS
R² score: 0.9999957
MSE (mean SQR error): 4.1313647e-6
RMSE (Root MSE): 0.002032576
MAE (mean ABS error): 0.0013552677
maxAE (max ABS error) 0.13068151
Lipschitz bound: 11.582279
R² score: 0.9999913
MSE (mean SQR error): 8.287154e-6
RMSE (Root MSE): 0.0028787416
MAE (mean ABS error): 0.0018920312
maxAE (max ABS error) 0.21459033
Lipschitz bound: 9.758869

#======================#
#======================#
TEST STATS
R² score: 0.9999957
MSE (mean SQR error): 4.1313647e-6
RMSE (Root MSE): 0.002032576
MAE (mean ABS error): 0.0013552677
maxAE (max ABS error) 0.13068151
Lipschitz bound: 11.582279
R² score: 0.9999913
MSE (mean SQR error): 8.287154e-6
RMSE (Root MSE): 0.0028787416
MAE (mean ABS error): 0.0018920312
maxAE (max ABS error) 0.21459033
Lipschitz bound: 9.758869

#======================#
26 changes: 13 additions & 13 deletions experiments_SNFROM/burgers_fourier1D/model_CAE02/statistics_04.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
Epoch [0 / 0] TRAIN LOSS: 3.7262396e-6 || TEST LOSS: 3.7262396e-6
Epoch [0 / 0] TRAIN LOSS: 3.9551287e-6 || TEST LOSS: 3.9551287e-6
#======================#
TRAIN STATS
R² score: 0.9999962
MSE (mean SQR error): 3.7262396e-6
RMSE (Root MSE): 0.001930347
MAE (mean ABS error): 0.0012878623
maxAE (max ABS error) 0.12932086
Lipschitz bound: 11.640823
R² score: 0.99999595
MSE (mean SQR error): 3.9551287e-6
RMSE (Root MSE): 0.0019887506
MAE (mean ABS error): 0.0013053538
maxAE (max ABS error) 0.14382899
Lipschitz bound: 10.559205

#======================#
#======================#
TEST STATS
R² score: 0.9999962
MSE (mean SQR error): 3.7262394e-6
RMSE (Root MSE): 0.001930347
MAE (mean ABS error): 0.0012878622
maxAE (max ABS error) 0.12932086
Lipschitz bound: 11.640823
R² score: 0.99999595
MSE (mean SQR error): 3.9551287e-6
RMSE (Root MSE): 0.0019887506
MAE (mean ABS error): 0.0013053537
maxAE (max ABS error) 0.14382899
Lipschitz bound: 10.559205

#======================#
Loading

0 comments on commit fbbcf56

Please sign in to comment.