Function#

class pinnx.problem.Function(geometry, function, num_train, num_test, train_distribution='uniform', online=False, approximator=None, loss_fn='MSE', loss_weights=None)[source]#

Approximate a function via a network.

Parameters:
  • geometry (AbstractGeometry) – The domain of the function. Instance of Geometry.

  • function (Callable) – The function to be approximated. A callable function takes a NumPy array as the input and returns the a NumPy array of corresponding function values.

  • num_train (int) – The number of training points sampled inside the domain.

  • num_test (int)

  • train_distribution (str) – The distribution to sample training points. One of the following: “uniform” (equispaced grid), “pseudo” (pseudorandom), “LHS” (Latin hypercube sampling), “Halton” (Halton sequence), “Hammersley” (Hammersley sequence), or “Sobol” (Sobol sequence).

  • online (bool) – If True, resample the pseudorandom training points every training step, otherwise, use the same training points.

losses(inputs, outputs, targets, **kwargs)[source]#

Return a list of losses, i.e., constraints.

test()[source]#

Return a test dataset.

train_next_batch(batch_size=None)[source]#

Return a training dataset of the size batch_size.