Loading...

verticapy.machine_learning.memmodel.linear_model.LinearModel.predict_proba_sql#

LinearModel.predict_proba_sql(X: list | ndarray) list[str]#

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

Parameters#

X: ArrayLike

The names or values of the input predictors.

Returns#

list

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_proba_sql(cnames)
Out[6]: 
['1 - (1 / (1 + EXP(- (2.0 + 0.5 * col1 + 1.2 * col2))))',
 '1 / (1 + EXP(- (2.0 + 0.5 * col1 + 1.2 * col2)))']

Note

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