# PhysicsInformedNN: sampling strategy for pde\_loss evaluation on pre-defined could points

**URL:** https://discourse.julialang.org/t/physicsinformednn-sampling-strategy-for-pde-loss-evaluation-on-pre-defined-could-points/88238
**Category:** Machine Learning
**Created:** [October 4, 2022, 3:09pm UTC](https://discourse.julialang.org/t/physicsinformednn-sampling-strategy-for-pde-loss-evaluation-on-pre-defined-could-points/88238 "2022-10-04T15:09:33Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![LeoCott](https://avatars.discourse-cdn.com/v4/letter/l/94ad74/32.png) [@LeoCott](https://discourse.julialang.org/u/LeoCott)
#### Post date: [October 4, 2022, 3:09pm UTC](https://discourse.julialang.org/t/physicsinformednn-sampling-strategy-for-pde-loss-evaluation-on-pre-defined-could-points/88238/1 "2022-10-04T15:09:33Z")

</div>

Hello all,

I am trying to solve an inverse problem with NeuralPDE as presented in the documentation [here](https://neuralpde.sciml.ai/stable/tutorials/param_estim/).

I am wondering if it was possible to define a sampling strategy to evaluate the pde\_loss of the NeuralPDE.PhysicsInformedNN interface at the same points as the one used in the additional\_loss?

```julia
(u_ , t_) = ground_truth_data

depvars = [:x,:y,:z]
function additional_loss(phi, θ , p)
    return sum(sum(abs2, phi[i](t_ , θ[depvars[i]]) .- u_[[i], :])/len for i in 1:1:3)
end

discretization = NeuralPDE.PhysicsInformedNN([chain1 , chain2, chain3],stratedy=NeuralPDE.GridTraining(dt), param_estim=true, additional_loss=additional_loss)

```

In other words, is it possible to evaluate the pde\_loss only on the points where we have ground truth data?

Thanks in advance!

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [October 4, 2022, 10:01pm UTC](https://discourse.julialang.org/t/physicsinformednn-sampling-strategy-for-pde-loss-evaluation-on-pre-defined-could-points/88238/2 "2022-10-04T22:01:27Z")

</div>

You cannot. But I’m curious why you would see that as necessary. For the PINN training process, you have one term for satisfying the PDE and one term for matching the trajectories. Since those terms are independent, they do not need to be done at the same points. In fact, you may generally want a denser sample of the PDE part than the data part “most” of the time since the first is about solving the PDE to sufficient accuracy and the second is about finding its parameters. Also, you generally want to sample the PDE term stochastically so that there are no “in-between” points that are missed due to overfitting a finite set.
