Loading...

verticapy.machine_learning.memmodel.linear_model.LinearModel.predict_sql#

LinearModel.predict_sql(X: list | ndarray) str#

Returns the SQL code needed to deploy the model using its attributes.

Parameters#

X: ArrayLike

The names or values of the input predictors.

Returns#

str

SQL code.

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)

Let’s use the following column names:

cnames = ['col1', 'col2']

Get the SQL code needed to deploy the model.

model_lm.predict_sql(cnames)
Out[6]: '2.0 + 0.5 * col1 + 1.2 * col2'

Note

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