Loading...

verticapy.machine_learning.memmodel.linear_model.LinearModel.predict

LinearModel.predict(X: Annotated[list | ndarray, 'Array Like Structure']) ndarray

Predicts using the input Matrix.

Parameters

X: ArrayLike

The data on which to make the prediction.

Returns

numpy.array

Predicted values.

Examples

Import the required module.

from verticapy.machine_learning.memmodel.linear_model import LinearModel

We will use the following attributes:

coefficients = [0.5, 1.2]

intercept = 2.0

Let’s create a model.

model_lm = LinearModel(coefficients, intercept)

Create a dataset.

data = [[1.0, 0.3], [2.0, -0.6]]

Compute the predictions.

model_lm.predict(data)
Out[6]: array([2.86, 2.28])

Note

Refer to LinearModel for more information about the different methods and usages.