Model.to_sql¶
In [ ]:
Model.to_sql(X: list = [],
return_proba: bool = False,)
Returns the SQL code needed to deploy the model without using Vertica built-in functions.
Parameters¶
Name | Type | Optional | Description |
---|---|---|---|
X | list | ✓ | input predictors name. |
return_proba | bool | ✓ | If set to True and the model is a classifier, the function will return the class probabilities. |
Returns¶
str / list : SQL code
Example¶
In [18]:
from verticapy.learn.ensemble import XGBoostClassifier
model = XGBoostClassifier("xgb_titanic", max_ntree = 2, max_depth = 2)
model.fit("public.titanic",
["age", "fare", "pclass",],
"survived")
# Returns the string needed to deploy the model's prediction in Standard SQL
print(model.to_sql())
In [19]:
# Returns the list of strings needed to deploy the model's probability in Standard SQL
print(model.to_sql(return_proba = True))
In [15]:
from verticapy.learn.ensemble import XGBoostRegressor
model = XGBoostRegressor("xgb_titanic", max_ntree = 2, max_depth = 2)
model.fit("public.titanic",
["age", "fare", "pclass",],
"survived")
# Returns the string needed to deploy the model's prediction in Standard SQL
print(model.to_sql())
In [16]:
from verticapy.learn.cluster import KMeans
model = KMeans("kmeans_iris", n_cluster = 2)
model.fit("public.iris",)
# Returns the string needed to deploy the model's estimated centers in Standard SQL
print(model.to_sql())
In [17]:
from verticapy.learn.preprocessing import Normalizer
model = Normalizer("norm_titanic",)
model.fit("public.titanic",)
# Returns the list of strings needed to deploy the model's transformation in Standard SQL
print(model.to_sql())