Loading...

vastorbit.machine_learning.memmodel.ensemble.GradientBoostingRegressor.predict_sql

GradientBoostingRegressor.predict_sql(X: Annotated[list | ndarray, 'Array Like Structure']) str

Returns the SQL code needed to deploy the model.

Parameters:

X (ArrayLike) – The names or values of the input predictors.

Returns:

SQL code.

Return type:

str

Examples

Import the required modules and create many BinaryTreeRegressor.

from vastorbit.machine_learning.memmodel.tree import BinaryTreeRegressor

model1 = BinaryTreeRegressor(
    children_left = [1, 3, None, None, None],
    children_right = [2, 4, None, None, None],
    feature = [0, 1, None, None, None],
    threshold = ["female", 30, None, None, None],
    value = [None, None, 3, 11, 23],
)
model2 = BinaryTreeRegressor(
    children_left = [1, 3, None, None, None],
    children_right = [2, 4, None, None, None],
    feature = [0, 1, None, None, None],
    threshold = ["female", 30, None, None, None],
    value = [None, None, -3, 12, 56],
)
model3 = BinaryTreeRegressor(
    children_left = [1, 3, None, None, None],
    children_right = [2, 4, None, None, None],
    feature = [0, 1, None, None, None],
    threshold = ["female", 30, None, None, None],
    value = [None, None, 1, 3, 6],
)

Let’s create a model.

from vastorbit.machine_learning.memmodel.ensemble import GradientBoostingRegressor

model_gbr = GradientBoostingRegressor(
    trees = [model1, model2, model3],
    mean = 2.5,
    eta = 0.9,
)

Let’s use the following column names:

cnames = ["sex", "fare"]

Get the SQL code needed to deploy the model.

model_gbr.predict_sql(cnames)

Note

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