The post is directed to user's who have used the library deepxde. May you kindly help me in finding the solution to my problem.
I tried the DeepOnet operator learning example according to the dataset generated from grf from this tutorial website link . Now I want to apply the trained model on a known pair of function like cos(x) and sin(x) ; I'll generate my input data-field data as x = np.arange(0,4*np.pi,0.1) ; u(y) = y = np.cos(x) now I want to plot the anti-derivate of my u(y) and compare it with y = np.cos(x).
What additional code shall I implement in order to do so?
The following code runs well on my colab after installing the deepxde library with pip. Now I just want to extend this and check whether the trained model works okay on my custom fucntions or not? for example cosx , sinx etc. Thanks for the help!
import deepxde as dde
import matplotlib.pyplot as plt
import numpy as np
# Load dataset
d = np.load("antiderivative_aligned_train.npz", allow_pickle=True)
X_train = (d["X"][0].astype(np.float32), d["X"][1].astype(np.float32))
y_train = d["y"].astype(np.float32)
d = np.load("antiderivative_aligned_test.npz", allow_pickle=True)
X_test = (d["X"][0].astype(np.float32), d["X"][1].astype(np.float32))
y_test = d["y"].astype(np.float32)
data = dde.data.TripleCartesianProd(
X_train=X_train, y_train=y_train, X_test=X_test, y_test=y_test
)
# Choose a network
m = 100
dim_x = 1
net = dde.nn.DeepONetCartesianProd(
[m, 40, 40],
[dim_x, 40, 40],
"relu",
"Glorot normal",
)
# Define a Model
model = dde.Model(data, net)
# Compile and Train
model.compile("adam", lr=0.001, metrics=["mean l2 relative error"])
losshistory, train_state = model.train(iterations=10000)
# Plot the loss trajectory
dde.utils.plot_loss_history(losshistory)
plt.show()