Loading...

verticapy.machine_learning.memmodel.linear_model.LinearModelClassifier.predict_sql

LinearModelClassifier.predict_sql(X: Annotated[list | ndarray, 'Array Like Structure']) 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 LinearModelClassifier

We will use the following attributes:

coefficients = [0.5, 1.2]

intercept = 2.0

Let’s create a model.

model_lmc = LinearModelClassifier(coefficients, intercept)

Let’s use the following column names:

cnames = ['col1', 'col2']

Get the SQL code needed to deploy the model.

model_lmc.predict_sql(cnames)
Out[6]: '((1 / (1 + EXP(- (2.0 + 0.5 * col1 + 1.2 * col2)))) > 0.5)::int'

Note

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