PowerSeries#

class pinnx.fnspace.PowerSeries(N=100, M=1)[source]#

Power series.

p(x) = sum_{i=0}^{N-1} a_i x^i

Parameters:
  • N (int) – The number of terms in the power series.

  • M (float) – M > 0. The coefficients a_i are randomly sampled from [-M, M].

eval_batch(features, xs)[source]#

Evaluate a list of functions at a list of points.

Parameters:
  • features – A NumPy array of shape (n_functions, n_features). A list of the feature vectors of the functions to be evaluated.

  • xs – A NumPy array of shape (n_points, dim). A list of points to be evaluated.

Returns:

A NumPy array of shape (n_functions, n_points). The values of different functions at different points.

eval_one(feature, x)[source]#

Evaluate the function at one point.

Parameters:
  • feature – The feature vector of the function to be evaluated.

  • x – The point to be evaluated.

Returns:

The function value at x.

Return type:

float

random(size)[source]#

Generate feature vectors of random functions.

Parameters:

size (int) – The number of random functions to generate.

Returns:

A NumPy array of shape (size, n_features).