Skip to content

base

py3dinterpolations.modelling.models.base

Abstract base class for all interpolation models.

BaseModel

Bases: ABC

Interface for interpolation models.

All models must implement fit() and predict() with consistent signatures.

name abstractmethod property

Human-readable model name.

fit(x, y, z, v) abstractmethod

Fit the model to training data.

Parameters:

Name Type Description Default
x ndarray

X coordinates of training points.

required
y ndarray

Y coordinates of training points.

required
z ndarray

Z coordinates of training points.

required
v ndarray

Values at training points.

required
Source code in py3dinterpolations/modelling/models/base.py
16
17
18
19
20
21
22
23
24
25
26
@abstractmethod
def fit(self, x: np.ndarray, y: np.ndarray, z: np.ndarray, v: np.ndarray) -> None:
    """Fit the model to training data.

    Args:
        x: X coordinates of training points.
        y: Y coordinates of training points.
        z: Z coordinates of training points.
        v: Values at training points.
    """
    ...

predict(grid_x, grid_y, grid_z, **kwargs) abstractmethod

Predict on 1D grid arrays.

Parameters:

Name Type Description Default
grid_x ndarray

1D array of X grid coordinates.

required
grid_y ndarray

1D array of Y grid coordinates.

required
grid_z ndarray

1D array of Z grid coordinates.

required

Returns:

Type Description
InterpolationResult

Interpolation result with at least the interpolated field.

Source code in py3dinterpolations/modelling/models/base.py
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
@abstractmethod
def predict(
    self,
    grid_x: np.ndarray,
    grid_y: np.ndarray,
    grid_z: np.ndarray,
    **kwargs: object,
) -> InterpolationResult:
    """Predict on 1D grid arrays.

    Args:
        grid_x: 1D array of X grid coordinates.
        grid_y: 1D array of Y grid coordinates.
        grid_z: 1D array of Z grid coordinates.

    Returns:
        Interpolation result with at least the interpolated field.
    """
    ...