diff --git a/.gitignore b/.gitignore index 876d74a0bf..770a1818c9 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ Manifest.toml */testlogs docs/build/* scratch -scratch/* \ No newline at end of file +scratch/* +.DS_store \ No newline at end of file diff --git a/Project.toml b/Project.toml index 8e8502f77b..35a5f07992 100644 --- a/Project.toml +++ b/Project.toml @@ -66,11 +66,12 @@ MonteCarloMeasurements = "1" Optim = ">= 1.7.8" Optimisers = "0.2, 0.3" Optimization = "3" -QuasiMonteCarlo = "0.2.1" +QuasiMonteCarlo = "0.3.2" RecursiveArrayTools = "2.31" Reexport = "1.0" RuntimeGeneratedFunctions = "0.5" SciMLBase = "1.91, 2" +Statistics = "1" StochasticDiffEq = "6.13" SymbolicUtils = "1" Symbolics = "5" @@ -80,7 +81,6 @@ julia = "1.6" [extras] CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" -IntegralsCuba = "1e5cbd8a-c439-4026-92c2-98742b2c817b" OptimizationOptimJL = "36348300-93cb-4f02-beb5-3c3902f8871e" OptimizationOptimisers = "42dfb2eb-d2b4-4451-abcd-913932933ac1" OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" @@ -89,4 +89,4 @@ SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["Test", "CUDA", "SafeTestsets", "OptimizationOptimisers", "OptimizationOptimJL", "Pkg", "OrdinaryDiffEq", "IntegralsCuba"] \ No newline at end of file +test = ["Test", "CUDA", "SafeTestsets", "OptimizationOptimisers", "OptimizationOptimJL", "Pkg", "OrdinaryDiffEq"] diff --git a/docs/src/index.md b/docs/src/index.md index 20f1b3b53d..08960823e8 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -3,7 +3,7 @@ [NeuralPDE.jl](https://github.com/SciML/NeuralPDE.jl) is a solver package which consists of neural network solvers for partial differential equations using physics-informed neural networks (PINNs) and the ability to generate neural -networks which both approximate physical laws and real data simultaniously. +networks which both approximate physical laws and real data simultaneously. ## Features diff --git a/docs/src/tutorials/ode.md b/docs/src/tutorials/ode.md index ad2285dc6a..5b1afdfd2a 100644 --- a/docs/src/tutorials/ode.md +++ b/docs/src/tutorials/ode.md @@ -3,7 +3,7 @@ !!! note It is highly recommended you first read the [solving ordinary differential - equations with DifferentialEquations.jl tutorial](https://docs.sciml.ai/DiffEqDocs/stable/tutorials/ode_example/) + equations with DifferentialEquations.jl tutorial](https://docs.sciml.ai/DiffEqDocs/stable/getting_started/) before reading this tutorial. This tutorial is an introduction to using physics-informed neural networks (PINNs) for solving ordinary differential equations (ODEs). In contrast to the later parts of this documentation which use the symbolic interface, here we will focus on the simplified [`NNODE`](@ref) which uses the `ODEProblem` specification for the ODE. diff --git a/src/BPINN_ode.jl b/src/BPINN_ode.jl index 8e9dc3283e..cbcb285aa1 100644 --- a/src/BPINN_ode.jl +++ b/src/BPINN_ode.jl @@ -83,7 +83,7 @@ Kevin Linka, Amelie Schäfer, Xuhui Meng, Zongren Zou, George Em Karniadakis, El struct BNNODE{C, K, IT <: NamedTuple, A <: NamedTuple, H <: NamedTuple, ST <: Union{Nothing, AbstractTrainingStrategy}, - I <: Union{Nothing, Vector{<:AbstractFloat}}, + I <: Union{Nothing, <:NamedTuple, Vector{<:AbstractFloat}}, P <: Union{Nothing, Vector{<:Distribution}}, D <: Union{Vector{Nothing}, Vector{<:Vector{<:AbstractFloat}}}} <: diff --git a/src/advancedHMC_MCMC.jl b/src/advancedHMC_MCMC.jl index 07240d4599..4b680ce44a 100644 --- a/src/advancedHMC_MCMC.jl +++ b/src/advancedHMC_MCMC.jl @@ -109,9 +109,8 @@ function L2LossData(Tar::LogTargetDensity, θ) for i in 1:length(Tar.prob.u0) # for u[i] ith vector must be added to dataset,nn[1,:] is the dx in lotka_volterra L2logprob += logpdf(MvNormal(nn[i, :], - LinearAlgebra.Diagonal(map(abs2, - Tar.l2std[i] .* - ones(length(Tar.dataset[i]))))), + LinearAlgebra.Diagonal(abs2.(Tar.l2std[i] .* + ones(length(Tar.dataset[i]))))), Tar.dataset[i]) end return L2logprob @@ -250,9 +249,8 @@ function innerdiff(Tar::LogTargetDensity, f, autodiff::Bool, t::AbstractVector, # N dimensional vector if N outputs for NN(each row has logpdf of i[i] where u is vector of dependant variables) return [logpdf(MvNormal(vals[i, :], - LinearAlgebra.Diagonal(map(abs2, - Tar.phystd[i] .* - ones(length(vals[i, :]))))), + LinearAlgebra.Diagonal(abs2.(Tar.phystd[i] .* + ones(length(vals[i, :]))))), zeros(length(vals[i, :]))) for i in 1:length(Tar.prob.u0)] end @@ -497,7 +495,7 @@ function ahmc_bayesian_pinn_ode(prob::DiffEqBase.ODEProblem, chain; strategy = strategy == GridTraining ? strategy(physdt) : strategy if dataset != [nothing] && - (length(dataset) < 2 || !(typeof(dataset) <: Vector{<:Vector{<:AbstractFloat}})) + (length(dataset) < 2 || !(dataset isa Vector{<:Vector{<:AbstractFloat}})) throw(error("Invalid dataset. dataset would be timeseries (x̂,t) where type: Vector{Vector{AbstractFloat}")) end @@ -534,7 +532,7 @@ function ahmc_bayesian_pinn_ode(prob::DiffEqBase.ODEProblem, chain; ninv = length(param) priors = [ MvNormal(priorsNNw[1] * ones(nparameters), - LinearAlgebra.Diagonal(map(abs2, priorsNNw[2] .* ones(nparameters)))), + LinearAlgebra.Diagonal(abs2.(priorsNNw[2] .* ones(nparameters)))), ] # append Ode params to all paramvector diff --git a/src/pinn_types.jl b/src/pinn_types.jl index 8a4766d122..428f03fc36 100644 --- a/src/pinn_types.jl +++ b/src/pinn_types.jl @@ -106,7 +106,7 @@ struct PhysicsInformedNN{T, P, PH, DER, PE, AL, ADA, LOG, K} <: AbstractPINN log_options = LogOptions(), iteration = nothing, kwargs...) - multioutput = typeof(chain) <: AbstractArray + multioutput = chain isa AbstractArray if phi === nothing if multioutput