Using ahmc_bayesian_pinn_pde with the BayesianPINN Discretizer for the Kuramoto–Sivashinsky equation

Consider the Kuramoto–Sivashinsky equation:

\[∂_t u(x, t) + u(x, t) ∂_x u(x, t) + \alpha ∂^2_x u(x, t) + \beta ∂^3_x u(x, t) + \gamma ∂^4_x u(x, t) = 0 \, ,\]

where $\alpha = \gamma = 1$ and $\beta = 4$. The exact solution is:

\[u_e(x, t) = 11 + 15 \tanh \theta - 15 \tanh^2 \theta - 15 \tanh^3 \theta \, ,\]

where $\theta = t - x/2$ and with initial and boundary conditions:

\[\begin{align*} u( x, 0) &= u_e( x, 0) \, ,\\ u( 10, t) &= u_e( 10, t) \, ,\\ u(-10, t) &= u_e(-10, t) \, ,\\ ∂_x u( 10, t) &= ∂_x u_e( 10, t) \, ,\\ ∂_x u(-10, t) &= ∂_x u_e(-10, t) \, . \end{align*}\]

With Bayesian Physics-Informed Neural Networks, here is an example of using BayesianPINN discretization with ahmc_bayesian_pinn_pde :

using NeuralPDE, Lux, ModelingToolkit, LinearAlgebra, AdvancedHMC
import ModelingToolkit: Interval, infimum, supremum, Distributions
using Plots, MonteCarloMeasurements

@parameters x, t, α
@variables u(..)
Dt = Differential(t)
Dx = Differential(x)
Dx2 = Differential(x)^2
Dx3 = Differential(x)^3
Dx4 = Differential(x)^4

# α = 1
β = 4
γ = 1
eq = Dt(u(x, t)) + u(x, t) * Dx(u(x, t)) + α * Dx2(u(x, t)) + β * Dx3(u(x, t)) + γ * Dx4(u(x, t)) ~ 0

u_analytic(x, t; z = -x / 2 + t) = 11 + 15 * tanh(z) - 15 * tanh(z)^2 - 15 * tanh(z)^3
du(x, t; z = -x / 2 + t) = 15 / 2 * (tanh(z) + 1) * (3 * tanh(z) - 1) * sech(z)^2

bcs = [u(x, 0) ~ u_analytic(x, 0),
    u(-10, t) ~ u_analytic(-10, t),
    u(10, t) ~ u_analytic(10, t),
    Dx(u(-10, t)) ~ du(-10, t),
    Dx(u(10, t)) ~ du(10, t)]

# Space and time domains
domains = [x ∈ Interval(-10.0, 10.0),
    t ∈ Interval(0.0, 1.0)]

# Discretization
dx = 0.4;
dt = 0.2;

# Function to compute analytical solution at a specific point (x, t)
function u_analytic_point(x, t)
    z = -x / 2 + t
    return 11 + 15 * tanh(z) - 15 * tanh(z)^2 - 15 * tanh(z)^3
end

# Function to generate the dataset matrix
function generate_dataset_matrix(domains, dx, dt)
    x_values = -10:dx:10
    t_values = 0.0:dt:1.0

    dataset = []

    for t in t_values
        for x in x_values
            u_value = u_analytic_point(x, t)
            push!(dataset, [u_value, x, t])
        end
    end

    return vcat([data' for data in dataset]...)
end

datasetpde = [generate_dataset_matrix(domains, dx, dt)]

# noise to dataset
noisydataset = deepcopy(datasetpde)
noisydataset[1][:, 1] = noisydataset[1][:, 1] .+
                        randn(size(noisydataset[1][:, 1])) .* 5 / 100 .*
                        noisydataset[1][:, 1]
306-element Vector{Float64}:
 -4.164488807724146
 -4.058252729222625
 -4.102303894269816
 -4.071539721515942
 -3.9511191683223523
 -3.747904766063965
 -3.7970664972808565
 -3.948575362374804
 -4.1747657023059395
 -3.8768511225337035
  ⋮
 -3.8643147377992872
 -4.091524617581786
 -3.987498952383746
 -3.8201427247684725
 -4.306657072399818
 -3.887118777999757
 -4.109897012621093
 -3.836763209622676
 -3.841608517941399

Plotting dataset, added noise is set at 5%.

plot(datasetpde[1][:, 2], datasetpde[1][:, 1], title = "Dataset from Analytical Solution")
plot!(noisydataset[1][:, 2], noisydataset[1][:, 1])
Example block output
# Neural network
chain = Chain(Dense(2, 8, tanh), Dense(8, 8, tanh), Dense(8, 1))

discretization = NeuralPDE.BayesianPINN([chain],
    GridTraining([dx, dt]), param_estim = true, dataset = [noisydataset, nothing])

@named pde_system = PDESystem(eq,
    bcs,
    domains,
    [x, t],
    [u(x, t)],
    [α],
    defaults = Dict([α => 0.5]))

sol1 = ahmc_bayesian_pinn_pde(pde_system,
    discretization;
    draw_samples = 100, Kernel = AdvancedHMC.NUTS(0.8),
    bcstd = [0.2, 0.2, 0.2, 0.2, 0.2],
    phystd = [1.0], l2std = [0.05], param = [Distributions.LogNormal(0.5, 2)],
    priorsNNw = (0.0, 10.0),
    saveats = [1 / 100.0, 1 / 100.0], progress = true)
BPINNsolution{NeuralPDE.BPINNstats{MCMCChains.Chains{Float64, AxisArrays.AxisArray{Float64, 3, Base.ReshapedArray{Float64, 3, LinearAlgebra.Adjoint{Float64, Matrix{Float64}}, Tuple{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64}}}, Tuple{AxisArrays.Axis{:iter, StepRange{Int64, Int64}}, AxisArrays.Axis{:var, Vector{Symbol}}, AxisArrays.Axis{:chain, UnitRange{Int64}}}}, Missing, @NamedTuple{parameters::Vector{Symbol}}, @NamedTuple{}}, Vector{Vector{Float64}}, Vector{NamedTuple}}, Vector{Vector{MonteCarloMeasurements.Particles{Float64, 33}}}, Vector{ComponentArrays.ComponentVector{MonteCarloMeasurements.Particles{Float64, 34}, Vector{MonteCarloMeasurements.Particles{Float64, 34}}, Tuple{ComponentArrays.Axis{(layer_1 = ViewAxis(1:24, Axis(weight = ViewAxis(1:16, ShapedAxis((8, 2))), bias = ViewAxis(17:24, Shaped1DAxis((8,))))), layer_2 = ViewAxis(25:96, Axis(weight = ViewAxis(1:64, ShapedAxis((8, 8))), bias = ViewAxis(65:72, Shaped1DAxis((8,))))), layer_3 = ViewAxis(97:105, Axis(weight = ViewAxis(1:8, ShapedAxis((1, 8))), bias = ViewAxis(9:9, Shaped1DAxis((1,))))))}}}}, Vector{MonteCarloMeasurements.Particles{Float64, 34}}, Vector{Matrix{Float64}}}(NeuralPDE.BPINNstats{MCMCChains.Chains{Float64, AxisArrays.AxisArray{Float64, 3, Base.ReshapedArray{Float64, 3, LinearAlgebra.Adjoint{Float64, Matrix{Float64}}, Tuple{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64}}}, Tuple{AxisArrays.Axis{:iter, StepRange{Int64, Int64}}, AxisArrays.Axis{:var, Vector{Symbol}}, AxisArrays.Axis{:chain, UnitRange{Int64}}}}, Missing, @NamedTuple{parameters::Vector{Symbol}}, @NamedTuple{}}, Vector{Vector{Float64}}, Vector{NamedTuple}}(MCMC chain (100×106×1 reshape(adjoint(::Matrix{Float64}), 100, 106, 1) with eltype Float64), [[1.9403231793988236, -0.5948417168006539, 0.5340126399983366, -0.8176372061964313, 0.8043541294058277, 0.30306906022254554, 1.9379652919731856, 0.7492118464900746, 0.6320069034067141, -0.4018621833173777  …  0.5000798671720741, -0.5258930270665945, -0.3617716074506167, -0.48137202212610114, -0.3922111524191753, -0.25401244223902286, 0.12941425260316583, 0.18609768938860874, -0.11816098080062276, 0.5008078074262257], [1.9403231793988236, -0.5948417168006539, 0.5340126399983366, -0.8176372061964313, 0.8043541294058277, 0.30306906022254554, 1.9379652919731856, 0.7492118464900746, 0.6320069034067141, -0.4018621833173777  …  0.5000798671720741, -0.5258930270665945, -0.3617716074506167, -0.48137202212610114, -0.3922111524191753, -0.25401244223902286, 0.12941425260316583, 0.18609768938860874, -0.11816098080062276, 0.5008078074262257], [1.9403231793988236, -0.5948417168006539, 0.5340126399983366, -0.8176372061964313, 0.8043541294058277, 0.30306906022254554, 1.9379652919731856, 0.7492118464900746, 0.6320069034067141, -0.4018621833173777  …  0.5000798671720741, -0.5258930270665945, -0.3617716074506167, -0.48137202212610114, -0.3922111524191753, -0.25401244223902286, 0.12941425260316583, 0.18609768938860874, -0.11816098080062276, 0.5008078074262257], [1.9409854585845456, -0.5951461482846109, 0.534152424566878, -0.8166496205840463, 0.8046255222297136, 0.30300319007627596, 1.9370562833000726, 0.7494588303038001, 0.6324507014281303, -0.40164995835407563  …  0.49622240630273823, -0.5225243045557745, -0.3647293177848694, -0.4771272640063458, -0.3898966187194223, -0.25595507956877767, 0.1258234082961449, 0.18227746226276678, -0.12036465261886332, 0.500865780917691], [1.928329934530616, -0.6360596348826325, 0.5424953172758629, -0.7927682827813907, 0.7925943379597712, 0.2545317772046454, 1.9054633351968429, 0.7476073640313793, 0.652897543279659, -0.3982844121311121  …  0.26070159132324716, -0.3842893989658401, -0.5339822368300364, -0.2723501766467467, -0.2565827569374818, -0.3555149518013209, -0.04974188735352107, -0.014467435480725304, -0.26433931985904907, 0.5003091869828481], [1.9249766510905788, -0.6377622327625856, 0.5417328734686508, -0.793747777662465, 0.7910851456856454, 0.25224382044955146, 1.9035622632156204, 0.7473836480318606, 0.6542404117539784, -0.39836896736694316  …  0.2574579233098589, -0.38822704853079537, -0.5321233082951686, -0.27215851208589215, -0.2550465548019284, -0.354739520221634, -0.05212448255846448, -0.018423229372920655, -0.27292699104468604, 0.5006104856592256], [1.9095817322971018, -0.6486556170963363, 0.5395538808787135, -0.7952654932036165, 0.7856217647256833, 0.2464052488760218, 1.8921042252311429, 0.746210119440817, 0.6641194185398653, -0.4018078655622157  …  0.2423537343923743, -0.41451097112960994, -0.529365957275702, -0.26536343198755874, -0.24147083825716292, -0.34915126386739004, -0.0688801207019256, -0.03694670872081472, -0.3294830730574145, 0.5016766145367562], [1.9062075217025545, -0.664112295922811, 0.537075724279695, -0.7867141037629027, 0.7784265517133048, 0.2520851483429972, 1.8851316878962885, 0.7470906083185965, 0.6674015788293649, -0.4110181817024734  …  0.22922960927394434, -0.44863073191545383, -0.5311950525583059, -0.24536598265816137, -0.22666344953980838, -0.3526051709689202, -0.08938511452977406, -0.059076541287207615, -0.40172495742135816, 0.5013873188372574], [1.9063032602472325, -0.6643166817869262, 0.5371434648133827, -0.7866742054880728, 0.7776326655483837, 0.25215251563737645, 1.8845511771537382, 0.7475196746974794, 0.6677861197161986, -0.4110884889068626  …  0.229103743012778, -0.4503693362384172, -0.5310823113663938, -0.245501969210036, -0.22636107824046803, -0.35294722475084056, -0.08986717868106604, -0.0596388987591473, -0.4039171930531988, 0.5011853118913665], [1.905970167237545, -0.6646853510317233, 0.5372081532539185, -0.7866097143546779, 0.77755462529557, 0.25260104293176205, 1.8848150285588794, 0.7473634295240771, 0.6679993386084812, -0.41106665006435816  …  0.2290855692334938, -0.45145273961017834, -0.5305720878188188, -0.2455493741317165, -0.22576623277476313, -0.35342110001494187, -0.09052474165768651, -0.060362408398370364, -0.405884454507704, 0.5013432637202455]  …  [1.192494521373898, -0.4248603292639559, 0.567574352321904, -0.4267687051076324, 0.9602951314520977, 0.7049204769731025, 1.5854698571034083, 0.46899145447456075, -0.16259645301899742, 0.5357082338098703  …  0.9473133178189541, -3.0072963388901086, -0.9362137098908211, 0.6096829982069215, 1.5867463649647502, -1.462936820702809, -2.5760878351354255, -2.6795477787778195, -0.9776818220096277, 0.5703586757937466], [1.185745741753002, -0.4273581629830392, 0.5644309589154127, -0.4255746894527137, 0.9556051984078416, 0.7022460170478685, 1.5805288962517552, 0.4735826755332082, -0.17037137219099746, 0.5453513811992539  …  0.9530737511399495, -3.013499215205791, -0.9388718393381672, 0.6141272421381373, 1.5892105553531142, -1.4682216780624382, -2.5811491536992532, -2.68565162510326, -0.9728233312078476, 0.5701672577921401], [1.1856159497936487, -0.42779994752853756, 0.5641694186975132, -0.4254693449881192, 0.9544226843002016, 0.7020986305441362, 1.579908161249217, 0.4743590581377171, -0.1712214539514517, 0.5460544940894784  …  0.9541391126828318, -3.0147713944555377, -0.9392365690252414, 0.6150000347872051, 1.5897845705105778, -1.4689075394292364, -2.582227909962855, -2.686328898007446, -0.9720313765072376, 0.5698159660117967], [1.1828432287266926, -0.42842006008321626, 0.5630130511012092, -0.4262583522607111, 0.9544929888116612, 0.7018769609604204, 1.5775899839052172, 0.47706412220067357, -0.1756915540423408, 0.5509749855322704  …  0.9566296627205555, -3.017700212803967, -0.9414607630852775, 0.6167916086371367, 1.5924680022613802, -1.4714811207128233, -2.5844662880013924, -2.6899474573378637, -0.9713987313164245, 0.5702821312484253], [1.1823090476238083, -0.4278958196196047, 0.5622367126105734, -0.4257299937548198, 0.9537942746195481, 0.7019071396721078, 1.57680282557333, 0.47785353400217484, -0.1765106353718221, 0.552056750259845  …  0.9576871271224494, -3.018168045854169, -0.9418676110375022, 0.6170884787983798, 1.5930707098175545, -1.4726394029351104, -2.584839596150522, -2.6900201142085916, -0.9712722106626683, 0.5708849922819564], [1.1807085105678468, -0.42781022224259846, 0.5621670996740109, -0.42462183528489267, 0.9539051875192563, 0.7005945843272291, 1.5746920997841238, 0.4782902484551006, -0.17892927623897936, 0.5532704691515713  …  0.9596428620510463, -3.0199903073033694, -0.942461683046642, 0.617587357179175, 1.5943179051987573, -1.4742529569468044, -2.5853253051361533, -2.6916796505365506, -0.9705701626508982, 0.5705784327667732], [1.1798031253470416, -0.4293487612480928, 0.5609157023396231, -0.42392284652038165, 0.9531110608831062, 0.7002144340501331, 1.5727408173109498, 0.47994985070852847, -0.18072465980310212, 0.5557672756889419  …  0.9609058442035019, -3.0211923268068235, -0.9426065939490117, 0.6186319311067086, 1.5947606089535407, -1.4761678954698627, -2.5869763015064087, -2.692635179625747, -0.9707412210132819, 0.57085908427032], [1.1774065140546657, -0.4298927363238793, 0.5599973219590272, -0.4236389454004424, 0.9523174536511592, 0.6991852724025925, 1.5707569933238603, 0.48170223839903215, -0.18178054411731806, 0.5581013318050573  …  0.9621117374532682, -3.022543355055004, -0.942958476286311, 0.6192004739548246, 1.5953301717019959, -1.478338291841575, -2.5874674504715336, -2.6944187477815107, -0.96951282916797, 0.5708364942577359], [1.1772278937446856, -0.4299865566695579, 0.5599080835886414, -0.42398448915216735, 0.9521954592545567, 0.6990637919916133, 1.5707055339014055, 0.4814952371217455, -0.18207915593809548, 0.5582725036886359  …  0.9624496482455236, -3.022805301672933, -0.9429253195528859, 0.6191114702565852, 1.5952860707298342, -1.4782659617460172, -2.5876130791951413, -2.6946552090038245, -0.9696100973322842, 0.5709248311229826], [1.1759220004557305, -0.4306303681487513, 0.5597180851220758, -0.4238849736507916, 0.951522630687417, 0.6996030000136024, 1.5696603961820512, 0.48173116978083313, -0.18292743670100586, 0.5603579234926029  …  0.9646427380693088, -3.023395321734391, -0.9437462995942612, 0.6193531786754186, 1.5964315219887935, -1.4799552325960117, -2.588673961843238, -2.6957083447363446, -0.9693844990595457, 0.5705453086105728]], NamedTuple[(n_steps = 15, is_accept = true, acceptance_rate = 1.0, log_density = -1.9978832806203584e6, hamiltonian_energy = 2.16218232748697e6, hamiltonian_energy_error = -77616.55887129903, max_hamiltonian_energy_error = -77616.55887129903, tree_depth = 4, numerical_error = false, step_size = 0.000390625, nom_step_size = 0.000390625, is_adapt = true), (n_steps = 1, is_accept = true, acceptance_rate = 0.0, log_density = -1.9978832806203584e6, hamiltonian_energy = 1.9979363574711068e6, hamiltonian_energy_error = 0.0, max_hamiltonian_energy_error = 1.308632385274798e15, tree_depth = 0, numerical_error = true, step_size = 0.005619339881162803, nom_step_size = 0.005619339881162803, is_adapt = true), (n_steps = 1, is_accept = true, acceptance_rate = 0.0, log_density = -1.9978832806203584e6, hamiltonian_energy = 1.9979502582045754e6, hamiltonian_energy_error = 0.0, max_hamiltonian_energy_error = 697987.8068355813, tree_depth = 0, numerical_error = true, step_size = 0.0009496747438836495, nom_step_size = 0.0009496747438836495, is_adapt = true), (n_steps = 3, is_accept = true, acceptance_rate = 1.0, log_density = -1.9896011697827172e6, hamiltonian_energy = 1.9978389122498399e6, hamiltonian_energy_error = -94.43279592879117, max_hamiltonian_energy_error = -94.43279592879117, tree_depth = 2, numerical_error = false, step_size = 9.366851778844944e-5, nom_step_size = 9.366851778844944e-5, is_adapt = true), (n_steps = 63, is_accept = true, acceptance_rate = 1.0, log_density = -1.7931131357071633e6, hamiltonian_energy = 1.9889411698430409e6, hamiltonian_energy_error = -707.6029826465528, max_hamiltonian_energy_error = -707.6029826465528, tree_depth = 6, numerical_error = false, step_size = 0.0001266923472452951, nom_step_size = 0.0001266923472452951, is_adapt = true), (n_steps = 3, is_accept = true, acceptance_rate = 1.0, log_density = -1.7895170674905463e6, hamiltonian_energy = 1.7931196953848929e6, hamiltonian_energy_error = -35.78486455651, max_hamiltonian_energy_error = -35.78486455651, tree_depth = 2, numerical_error = false, step_size = 0.00019812717915982324, nom_step_size = 0.00019812717915982324, is_adapt = true), (n_steps = 7, is_accept = true, acceptance_rate = 1.0, log_density = -1.7722494121075924e6, hamiltonian_energy = 1.7893873523105888e6, hamiltonian_energy_error = -182.44629843346775, max_hamiltonian_energy_error = -182.44629843346775, tree_depth = 3, numerical_error = false, step_size = 0.000337256365860789, nom_step_size = 0.000337256365860789, is_adapt = true), (n_steps = 15, is_accept = true, acceptance_rate = 0.2666666666667671, log_density = -1.7533861465783776e6, hamiltonian_energy = 1.7722689317752516e6, hamiltonian_energy_error = -41.96618891577236, max_hamiltonian_energy_error = 902.7966565662064, tree_depth = 4, numerical_error = false, step_size = 0.0006034987400113894, nom_step_size = 0.0006034987400113894, is_adapt = true), (n_steps = 3, is_accept = true, acceptance_rate = 0.9866015834110513, log_density = -1.7527557607586514e6, hamiltonian_energy = 1.753441413452521e6, hamiltonian_energy_error = 0.012541590724140406, max_hamiltonian_energy_error = 0.02812376874499023, tree_depth = 2, numerical_error = false, step_size = 0.00011089791212221331, nom_step_size = 0.00011089791212221331, is_adapt = true), (n_steps = 15, is_accept = true, acceptance_rate = 0.19439340588493134, log_density = -1.7522155494164834e6, hamiltonian_energy = 1.752801856186644e6, hamiltonian_energy_error = 0.06761197024025023, max_hamiltonian_energy_error = 19.31187403621152, tree_depth = 4, numerical_error = false, step_size = 0.0001964983242344779, nom_step_size = 0.0001964983242344779, is_adapt = true)  …  (n_steps = 7, is_accept = true, acceptance_rate = 0.9655623781145761, log_density = -96078.55897845583, hamiltonian_energy = 97386.58413968825, hamiltonian_energy_error = -0.4470475109119434, max_hamiltonian_energy_error = -0.5274948124133516, tree_depth = 3, numerical_error = false, step_size = 0.0001726504126443218, nom_step_size = 0.0001726504126443218, is_adapt = false), (n_steps = 7, is_accept = true, acceptance_rate = 0.9953888337693381, log_density = -94359.3809186258, hamiltonian_energy = 96118.1564361635, hamiltonian_energy_error = -0.48502117620955687, max_hamiltonian_energy_error = -0.48502117620955687, tree_depth = 3, numerical_error = false, step_size = 0.0001726504126443218, nom_step_size = 0.0001726504126443218, is_adapt = false), (n_steps = 7, is_accept = true, acceptance_rate = 0.9993840414112827, log_density = -94140.51962846254, hamiltonian_energy = 94396.4140571791, hamiltonian_energy_error = 0.004321032349253073, max_hamiltonian_energy_error = -0.22544785620993935, tree_depth = 3, numerical_error = false, step_size = 0.0001726504126443218, nom_step_size = 0.0001726504126443218, is_adapt = false), (n_steps = 7, is_accept = true, acceptance_rate = 0.9837984107391231, log_density = -93396.7666107464, hamiltonian_energy = 94198.56017670948, hamiltonian_energy_error = -0.1598184081085492, max_hamiltonian_energy_error = -0.1598184081085492, tree_depth = 3, numerical_error = false, step_size = 0.0001726504126443218, nom_step_size = 0.0001726504126443218, is_adapt = false), (n_steps = 7, is_accept = true, acceptance_rate = 0.9724368794119115, log_density = -93206.02010937544, hamiltonian_energy = 93463.08580524818, hamiltonian_energy_error = 0.09517859540937934, max_hamiltonian_energy_error = -0.2607149635441601, tree_depth = 3, numerical_error = false, step_size = 0.0001726504126443218, nom_step_size = 0.0001726504126443218, is_adapt = false), (n_steps = 7, is_accept = true, acceptance_rate = 1.0, log_density = -92828.6649400181, hamiltonian_energy = 93262.74423278957, hamiltonian_energy_error = -0.28856344205269124, max_hamiltonian_energy_error = -0.3377485068922397, tree_depth = 3, numerical_error = false, step_size = 0.0001726504126443218, nom_step_size = 0.0001726504126443218, is_adapt = false), (n_steps = 7, is_accept = true, acceptance_rate = 0.9780025470136113, log_density = -92408.05806203591, hamiltonian_energy = 92885.82729422461, hamiltonian_energy_error = -0.05262217058043461, max_hamiltonian_energy_error = -0.21924410323845223, tree_depth = 3, numerical_error = false, step_size = 0.0001726504126443218, nom_step_size = 0.0001726504126443218, is_adapt = false), (n_steps = 7, is_accept = true, acceptance_rate = 0.9573018576323818, log_density = -92019.1465226966, hamiltonian_energy = 92461.97405641493, hamiltonian_energy_error = -0.007900913231424056, max_hamiltonian_energy_error = -0.16936649284616578, tree_depth = 3, numerical_error = false, step_size = 0.0001726504126443218, nom_step_size = 0.0001726504126443218, is_adapt = false), (n_steps = 7, is_accept = true, acceptance_rate = 0.9839954137994338, log_density = -91980.59029632367, hamiltonian_energy = 92070.2183530268, hamiltonian_energy_error = -0.12112577933294233, max_hamiltonian_energy_error = -0.12112577933294233, tree_depth = 3, numerical_error = false, step_size = 0.0001726504126443218, nom_step_size = 0.0001726504126443218, is_adapt = false), (n_steps = 7, is_accept = true, acceptance_rate = 0.962067258253944, log_density = -91588.9873521193, hamiltonian_energy = 92048.94034913184, hamiltonian_energy_error = 0.042772187138325535, max_hamiltonian_energy_error = 0.13791228426271118, tree_depth = 3, numerical_error = false, step_size = 0.0001726504126443218, nom_step_size = 0.0001726504126443218, is_adapt = false)]), Vector{MonteCarloMeasurements.Particles{Float64, 33}}[[-4.03 ± 0.043, -4.03 ± 0.043, -4.03 ± 0.043, -4.03 ± 0.043, -4.03 ± 0.043, -4.03 ± 0.043, -4.03 ± 0.043, -4.03 ± 0.043, -4.03 ± 0.043, -4.03 ± 0.043  …  -4.14 ± 0.035, -4.14 ± 0.035, -4.14 ± 0.035, -4.14 ± 0.035, -4.14 ± 0.035, -4.14 ± 0.035, -4.14 ± 0.035, -4.14 ± 0.035, -4.14 ± 0.035, -4.14 ± 0.035]], ComponentArrays.ComponentVector{MonteCarloMeasurements.Particles{Float64, 34}, Vector{MonteCarloMeasurements.Particles{Float64, 34}}, Tuple{ComponentArrays.Axis{(layer_1 = ViewAxis(1:24, Axis(weight = ViewAxis(1:16, ShapedAxis((8, 2))), bias = ViewAxis(17:24, Shaped1DAxis((8,))))), layer_2 = ViewAxis(25:96, Axis(weight = ViewAxis(1:64, ShapedAxis((8, 8))), bias = ViewAxis(65:72, Shaped1DAxis((8,))))), layer_3 = ViewAxis(97:105, Axis(weight = ViewAxis(1:8, ShapedAxis((1, 8))), bias = ViewAxis(9:9, Shaped1DAxis((1,))))))}}}[(layer_1 = (weight = MonteCarloMeasurements.Particles{Float64, 34}[1.27 ± 0.066 0.00393 ± 0.14; -0.432 ± 0.015 0.31 ± 0.21; … ; 1.62 ± 0.032 -0.719 ± 0.06; 0.458 ± 0.021 2.04 ± 0.045], bias = MonteCarloMeasurements.Particles{Float64, 34}[0.756 ± 0.02, -1.04 ± 0.025, 0.636 ± 0.0054, 0.105 ± 0.018, -0.628 ± 0.05, -0.759 ± 0.026, -0.163 ± 0.043, -0.563 ± 0.11]), layer_2 = (weight = MonteCarloMeasurements.Particles{Float64, 34}[-0.632 ± 0.006 -1.1 ± 0.011 … -0.47 ± 0.0082 -0.524 ± 0.0031; 0.272 ± 0.0039 0.617 ± 0.014 … 0.401 ± 0.037 -0.107 ± 0.0042; … ; -0.552 ± 0.0081 0.762 ± 0.023 … -0.373 ± 0.06 0.333 ± 0.068; -0.983 ± 0.05 0.347 ± 0.028 … 0.455 ± 0.022 0.808 ± 0.01], bias = MonteCarloMeasurements.Particles{Float64, 34}[0.0686 ± 0.013, -0.241 ± 0.018, -0.167 ± 0.011, -0.0257 ± 0.0054, 0.199 ± 0.011, -0.491 ± 0.096, 0.82 ± 0.051, 0.791 ± 0.036]), layer_3 = (weight = MonteCarloMeasurements.Particles{Float64, 34}[0.888 ± 0.057 -2.95 ± 0.052 … -2.5 ± 0.071 -2.62 ± 0.06], bias = MonteCarloMeasurements.Particles{Float64, 34}[-1.03 ± 0.052]))], MonteCarloMeasurements.Particles{Float64, 34}[0.567 ± 0.0043], [[-10.0 -9.99 … 9.99 10.0; 0.0 0.0 … 1.0 1.0]])

And some analysis:

phi = discretization.phi[1]
xs, ts = [infimum(d.domain):dx:supremum(d.domain)
          for (d, dx) in zip(domains, [dx / 10, dt])]
u_predict = [[first(pmean(phi([x, t], sol1.estimated_nn_params[1]))) for x in xs]
             for t in ts]
u_real = [[u_analytic(x, t) for x in xs] for t in ts]
diff_u = [[abs(u_analytic(x, t) - first(pmean(phi([x, t], sol1.estimated_nn_params[1]))))
           for x in xs]
          for t in ts]

p1 = plot(xs, u_predict, title = "predict")
p2 = plot(xs, u_real, title = "analytic")
p3 = plot(xs, diff_u, title = "error")
plot(p1, p2, p3)
Example block output