Loading...

vastorbit.machine_learning.vast.ensemble.GradientBoostingRegressor

class vastorbit.machine_learning.vast.ensemble.GradientBoostingRegressor(name: str = None, overwrite_model: bool = False, **kwargs)

Creates an GradientBoostingRegressor object using scikit-learn for training and the scalability of VAST DataBase for the inferences.

Parameters:
  • name (str, optional) – Name of the model. The model is stored in the database.

  • overwrite_model (bool, optional) – If set to True, training a model with the same name as an existing model overwrites the existing model.

  • **kwargs (scikit-learn model parameters.)

Variables:
  • created (Many attributes are)

  • phase. (during the fitting)

  • trees_ (list of BinaryTreeRegressor) – Tree models are instances of ` BinaryTreeRegressor, each possessing various attributes. For more detailed information, refer to the documentation for BinaryTreeRegressor.

  • feature_importances_ (numpy.array) – The importance of features. It is calculated using the average gain of each tree. To determine the final score, vastorbit sums the scores of each tree, normalizes them and applies an activation function to scale them. It is necessary to use the features_importance() method to compute it initially, and the computed values will be subsequently utilized for subsequent calls.

  • feature_importances_trees_ (dict of numpy.array) – Each element of the array represents the feature importance of tree i. The importance of features is calculated using the average gain of each tree. It is necessary to use the features_importance() method to compute it initially, and the computed values will be subsequently utilized for subsequent calls.

  • mean_ (float) – The mean of the response column.

  • eta_ (float) – The learning rate, is a crucial hyperparameter in machine learning algorithms. It determines the step size at each iteration during the model training process. A well-chosen learning rate is essential for achieving optimal convergence and preventing overshooting or slow convergence in the training phase. Adjusting the learning rate is often necessary to strike a balance between model accuracy and computational efficiency.

  • n_estimators_ (int) – The number of model estimators.

  • note:: (..) – All attributes can be accessed using the get_attributes() method.

Examples

The following examples provide a basic understanding of usage. For more detailed examples, please refer to the Machine Learning or the Examples section on the website.

Important

Many tree-based models inherit from the GradientBoosting base class, and it’s recommended to use it directly for access to a wider range of options.

Load data for machine learning

We import vastorbit:

import vastorbit as vo

Hint

By assigning an alias to vastorbit, we mitigate the risk of code collisions with other libraries. This precaution is necessary because vastorbit uses commonly known function names like “average” and “median”, which can potentially lead to naming conflicts. The use of an alias ensures that the functions from vastorbit are used as intended without interfering with functions from other libraries.

For this example, we will use the winequality dataset.

import vastorbit.datasets as vod

data = vod.load_winequality()
123
fixed_acidity
Decimal(6, 3)
123
volatile_acidity
Decimal(7, 4)
123
citric_acid
Decimal(6, 3)
123
residual_sugar
Decimal(7, 3)
123
chlorides
Double
123
free_sulfur_dioxide
Decimal(7, 2)
123
total_sulfur_dioxide
Decimal(7, 2)
123
density
Double
123
ph
Decimal(6, 3)
123
sulphates
Decimal(6, 3)
123
alcohol
Double
123
quality
Integer
123
good
Integer
Abc
color
Varchar(20)
16.30.670.4812.60.05257.0222.00.99793.170.529.360white
27.40.40.295.40.04431.0122.00.9943.30.511.181white
37.10.260.312.20.04429.0128.00.99373.340.6410.981white
49.00.310.486.60.04311.073.00.99382.90.3811.650white
56.30.390.246.90.0699.0117.00.99423.150.3510.240white
68.20.220.366.80.03412.090.00.99443.010.3810.581white
77.10.190.283.60.03316.078.00.9932.910.7811.460white
87.30.250.3613.10.0535.0200.00.99863.040.468.971white
97.90.20.341.20.0429.0118.00.99323.140.4110.660white
107.10.260.325.90.03739.097.00.99343.310.411.660white
117.00.20.345.70.03532.083.00.99283.190.4611.560white
126.90.30.334.10.03526.0155.00.99253.250.7912.381white
138.10.290.497.10.04222.0124.00.99443.140.4110.860white
145.80.170.31.40.03755.0130.00.99093.290.3811.360white
155.90.4150.020.80.03822.063.00.99323.360.369.350white
166.60.230.261.30.04516.0128.00.99343.360.610.060white
178.60.550.3515.550.05735.5366.51.00013.040.6311.030white
186.90.350.741.00.04418.0132.00.9923.130.5510.250white
197.60.140.741.60.0427.0103.00.99163.070.410.871white
209.20.280.4911.80.04229.0137.00.9983.10.3410.140white
216.20.180.494.50.04717.090.00.99193.270.3711.660white
225.30.1650.241.10.05125.0105.00.99253.320.479.150white
239.80.250.7410.00.05636.0225.00.99773.060.4310.040white
248.10.290.497.10.04222.0124.00.99443.140.4110.860white
256.80.220.490.90.05226.0128.00.9913.250.3511.460white
267.20.220.491.00.04534.0140.00.993.050.3412.760white
277.40.250.491.10.04235.0156.00.99173.130.5511.350white
288.20.180.491.10.03328.081.00.99233.00.6810.471white
296.10.220.491.50.05118.087.00.99283.30.469.650white
307.00.390.241.00.0488.0119.00.99233.00.3110.140white
316.10.220.491.50.05118.087.00.99283.30.469.650white
326.50.360.492.90.0316.094.00.99023.10.4912.171white
337.10.290.491.20.03132.099.00.98933.070.3312.260white
347.40.250.491.10.04235.0156.00.99173.130.5511.350white
356.90.230.2414.20.05319.094.00.99823.170.59.650white
368.50.560.7417.850.05151.0243.01.00052.990.79.250white
378.20.180.491.10.03328.081.00.99233.00.6810.471white
386.30.230.497.10.0567.0210.00.99513.230.349.550white
396.10.250.497.60.05267.0226.00.99563.160.478.950white
407.20.260.7413.60.0556.0162.00.9983.030.448.850white
417.20.310.241.40.05717.0117.00.99283.160.3510.550white
428.00.250.491.20.06127.0117.00.99383.080.349.450white
437.00.180.495.30.0434.0125.00.99143.240.412.260white
447.80.430.4913.00.03337.0158.00.99553.140.3511.360white
458.30.20.744.450.04433.0130.00.99243.250.4212.260white
466.30.270.491.20.06335.092.00.99113.380.4212.260white
477.40.160.491.20.05518.0150.00.99173.230.4711.260white
487.40.160.491.20.05518.0150.00.99173.230.4711.260white
496.90.190.496.60.03649.0172.00.99323.20.2711.560white
507.80.430.4913.00.03337.0158.00.99553.140.3511.360white
517.20.40.491.10.04811.0138.00.99293.010.429.350white
527.80.430.4913.00.03337.0158.00.99553.140.3511.360white
537.60.520.4914.00.03437.0156.00.99583.140.3811.871white
548.30.210.4919.80.05450.0231.01.00122.990.549.250white
556.90.340.7411.20.06944.0150.00.99683.00.819.250white
566.30.270.491.20.06335.092.00.99113.380.4212.260white
578.30.20.744.450.04433.0130.00.99243.250.4212.260white
587.10.220.742.70.04442.0144.00.9913.310.4112.260white
597.90.110.494.50.04827.0133.00.99463.240.4210.660white
608.50.170.743.60.0529.0128.00.99283.280.412.460white
616.40.1450.495.40.04854.0164.00.99463.560.4410.860white
627.40.160.491.20.05518.0150.00.99173.230.4711.260white
638.30.190.491.20.05111.0137.00.99183.060.4611.060white
648.00.440.499.10.03146.0151.00.99263.160.2712.781white
657.00.20.740.80.04419.0163.00.99313.460.5310.250white
666.90.190.496.60.03649.0172.00.99323.20.2711.560white
677.10.250.493.00.0330.096.00.99033.130.3912.371white
686.50.240.241.60.04615.060.00.99283.190.399.850white
697.20.40.491.10.04811.0138.00.99293.010.429.350white
707.60.520.4914.00.03437.0156.00.99583.140.3811.871white
717.80.430.4913.00.03337.0158.00.99553.140.3511.360white
727.80.210.491.350.0526.048.00.99113.150.2811.450white
737.00.20.495.90.03839.0128.00.99383.210.4810.860white
746.90.250.243.60.05713.085.00.99422.990.489.540white
757.20.080.491.30.0518.0148.00.99453.460.4410.260white
767.10.850.498.70.02840.0184.00.99623.220.3610.750white
777.60.510.241.20.0410.0104.00.9923.050.2910.860white
787.90.220.244.60.04439.0159.00.99272.990.2811.560white
797.70.160.492.00.05620.0124.00.99483.320.4910.760white
807.20.080.491.30.0518.0148.00.99453.460.4410.260white
816.60.250.241.70.04826.0124.00.99423.370.610.160white
826.70.160.492.40.04657.0187.00.99523.620.8110.460white
836.90.250.243.60.05713.085.00.99422.990.489.540white
847.50.320.244.60.0538.0134.00.99583.140.59.130white
857.40.280.491.50.03420.0126.00.99182.980.3910.660white
866.20.150.490.90.03317.051.00.99323.30.79.460white
876.70.250.7419.40.05444.0169.01.00043.510.459.860white
886.50.260.7413.30.04468.0224.00.99723.180.549.560white
897.90.160.7417.850.03752.0187.00.99982.990.419.350white
905.60.1850.491.10.0328.0117.00.99183.550.4510.360white
917.50.20.491.30.0318.097.00.99183.060.6211.150white
928.00.30.499.40.04647.0188.00.99643.140.4810.050white
938.00.340.499.00.03339.0180.00.99363.130.3812.381white
947.70.350.498.650.03342.0186.00.99313.140.3812.481white
957.60.290.499.60.0345.0197.00.99383.130.3812.371white
966.70.620.241.10.0396.062.00.99343.410.3210.450white
976.80.270.491.20.04435.0126.00.993.130.4812.171white
987.70.270.491.80.04123.086.00.99143.160.4212.560white
996.70.510.242.10.04314.0155.00.99043.220.613.060white
1007.40.190.499.30.0326.0132.00.9942.990.3211.071white
Rows: 1-100 | Columns: 14

Note

vastorbit offers a wide range of sample datasets that are ideal for training and testing purposes. You can explore the full list of available datasets in the Datasets, which provides detailed information on each dataset and how to use them effectively. These datasets are invaluable resources for honing your data analysis and machine learning skills within the vastorbit environment.

You can easily divide your dataset into training and testing subsets using the VastFrame.train_test_split() method. This is a crucial step when preparing your data for machine learning, as it allows you to evaluate the performance of your models accurately.

data = vod.load_winequality()
train, test = data.train_test_split(test_size = 0.2)

Warning

In this case, vastorbit utilizes seeded randomization to guarantee the reproducibility of your data split. However, please be aware that this approach may lead to reduced performance. For a more efficient data split, you can use the VastFrame.to_db() method to save your results into tables or temporary tables. This will help enhance the overall performance of the process.

Model Initialization

First we import the GradientBoostingRegressor model:

from vastorbit.machine_learning.vast import GradientBoostingRegressor

Then we can create the model:

model = GradientBoostingRegressor(
    n_estimators = 3,
)

Important

The model name is crucial for the model management system and versioning. It’s highly recommended to provide a name if you plan to reuse the model later.

Model Training

We can now fit the model:

model.fit(
    train,
    [
        "fixed_acidity",
        "volatile_acidity",
        "citric_acid",
        "residual_sugar",
        "chlorides",
        "density",
    ],
    "quality",
    test,
)

Important

To train a model, you can directly use the VastFrame or the name of the relation stored in the database. The test set is optional and is only used to compute the test metrics. In vastorbit, we don’t work using X matrices and y vectors. Instead, we work directly with lists of predictors and the response name.

Features Importance

We can conveniently get the features importance:

result = model.features_importance()

Note

In models such as GradientBoosting, feature importance is calculated using the average gain of each tree. To determine the final score, vastorbit sums the scores of each tree, normalizes them and applies an activation function to scale them.

Metrics

We can get the entire report using:

model.report()
value
explained_variance0.08998262083796227
max_error2.9889684397098217
median_absolute_error0.6649092
mean_absolute_error0.6419761432493359
mean_squared_error136.67330482845054
root_mean_squared_error0.8254058781499691
r20.08651843162232586
r2_adj0.08236624267515458
aic6539.805708747574
bic6575.981229464017
Rows: 1-10 | Columns: 2

Important

Most metrics are computed using a single SQL query, but some of them might require multiple SQL queries. Selecting only the necessary metrics in the report can help optimize performance. E.g. model.report(metrics = ["mse", "r2"]).

You can utilize the score() function to calculate various regression metrics, with the R-squared being the default.

model.score()

Prediction

Prediction is straight-forward:

model.predict(
    test,
    [
        "fixed_acidity",
        "volatile_acidity",
        "citric_acid",
        "residual_sugar",
        "chlorides",
        "density",
    ],
    "prediction",
)
123
fixed_acidity
Decimal(6, 3)
123
volatile_acidity
Decimal(7, 4)
123
citric_acid
Decimal(6, 3)
123
residual_sugar
Decimal(7, 3)
123
chlorides
Double
123
free_sulfur_dioxide
Decimal(7, 2)
123
total_sulfur_dioxide
Decimal(7, 2)
123
density
Double
123
ph
Decimal(6, 3)
123
sulphates
Decimal(6, 3)
123
alcohol
Double
123
quality
Integer
123
good
Integer
Abc
color
Varchar(20)
123
seedrand
Decimal(26, 6)
123
prediction
Decimal(23, 19)
16.90.350.741.00.04418.0132.00.9923.130.5510.250white0.115.769569829480156
29.20.280.4911.80.04229.0137.00.9983.10.3410.140white0.115.775263510117812
37.40.250.491.10.04235.0156.00.99173.130.5511.350white0.25.769569829480156
47.40.250.491.10.04235.0156.00.99173.130.5511.350white0.045.769569829480156
56.30.230.497.10.0567.0210.00.99513.230.349.550white0.25.775263510117812
67.20.310.241.40.05717.0117.00.99283.160.3510.550white0.185.714769509872761
77.20.40.491.10.04811.0138.00.99293.010.429.350white0.015.775263510117812
86.90.250.243.60.05713.085.00.99422.990.489.540white0.065.714769509872761
97.60.510.241.20.0410.0104.00.9923.050.2910.860white0.05.769569829480156
106.70.160.492.40.04657.0187.00.99523.620.8110.460white0.055.843183970655404
117.50.320.244.60.0538.0134.00.99583.140.59.130white0.125.714769509872761
126.70.510.242.10.04314.0155.00.99043.220.613.060white0.016.018284255588411
136.60.30.241.20.03417.0121.00.99333.130.369.250white0.165.714769509872761
146.80.360.244.60.03924.0124.00.99093.270.3412.671white0.156.018284255588411
157.90.20.491.60.05315.0144.00.9933.160.4710.550white0.15.843183970655404
167.30.220.499.90.03148.0161.00.99373.010.2811.260white0.035.905257700971672
177.40.190.499.30.0326.0132.00.9942.990.3211.071white0.065.905257700971672
187.30.1550.491.30.03934.0136.00.99263.140.7710.560white0.095.807378451805887
196.90.210.491.40.04115.0164.00.99273.250.6311.050white0.175.843183970655404
208.00.250.499.00.04431.0185.00.9983.340.4910.060white0.025.775263510117812
217.20.270.7412.50.03747.0156.00.99813.040.448.750white0.185.775263510117812
228.10.30.498.10.03726.0174.00.99433.10.311.271white0.095.775263510117812
237.30.260.495.00.02832.0107.00.99363.240.5410.860white0.075.775263510117812
246.00.170.491.00.03426.0106.00.9923.210.429.860white0.045.769569829480156
257.30.260.495.00.02832.0107.00.99363.240.5410.860white0.095.775263510117812
267.10.530.240.80.02929.086.00.9933.160.329.140white0.185.714769509872761
277.30.140.491.10.03828.099.00.99283.20.7210.660white0.125.843183970655404
288.90.130.491.00.0286.024.00.99262.910.329.950white0.15.807378451805887
297.10.360.241.80.02532.0102.00.99033.340.5912.860white0.196.018284255588411
307.90.180.495.20.05136.0157.00.99533.180.4810.660white0.115.843183970655404
317.30.210.491.80.03844.0152.00.99123.320.4412.671white0.26.018284255588411
326.90.30.497.60.05725.0156.00.99623.430.6311.071white0.175.775263510117812
337.90.420.498.20.05632.0164.00.99653.290.611.271white0.125.775263510117812
346.90.240.491.30.03235.0148.00.99323.450.5710.771white0.075.775263510117812
359.10.280.492.00.05910.0112.00.99583.150.4610.150white0.095.775263510117812
366.40.250.747.80.04552.0209.00.99563.210.429.260white0.045.775263510117812
377.30.30.7413.50.03946.0165.00.99823.020.48.750white0.045.775263510117812
387.90.140.741.20.02830.0165.00.9913.080.8212.360white0.25.9195304418985275
396.60.550.012.70.03456.0122.00.99063.150.311.950white0.16.018284255588411
406.20.20.491.60.06517.0143.00.99373.220.529.260white0.055.843183970655404
418.90.320.491.60.0517.0131.00.99563.130.349.450white0.165.775263510117812
428.20.20.493.50.05714.0108.00.99283.190.3511.560white0.155.843183970655404
437.40.190.496.70.03715.0110.00.99383.20.3811.071white0.185.843183970655404
447.30.190.4915.550.05850.0134.00.99983.420.369.171white0.095.905257700971672
457.50.240.499.40.04850.0149.00.99623.170.5910.571white0.155.775263510117812
466.40.220.497.50.05442.0151.00.99483.270.5210.160white0.075.905257700971672
478.20.290.491.00.04429.0118.00.99283.240.3610.940white0.125.775263510117812
487.80.40.497.80.0634.0162.00.99663.260.5811.360white0.175.775263510117812
498.10.280.4615.40.05932.0177.01.00043.270.589.040white0.095.775263510117812
507.90.180.331.20.03320.072.00.99223.120.3810.571white0.135.769569829480156
517.60.320.3418.350.05444.0197.01.00083.220.559.050white0.095.775263510117812
527.20.250.2814.40.05555.0205.00.99863.120.389.071white0.05.775263510117812
539.00.430.31.50.057.0175.00.99513.110.459.740white0.195.775263510117812
546.80.260.2916.950.05648.0179.00.99983.450.49.650white0.125.775263510117812
556.60.340.276.20.05923.0136.00.99573.30.4910.160white0.15.775263510117812
568.20.150.482.70.05224.0190.00.9953.50.4510.971white0.15.843183970655404
577.00.30.326.40.03428.097.00.99243.230.4411.860white0.135.925315160055462
587.50.220.336.70.03645.0138.00.99393.20.6811.460white0.25.843183970655404
596.60.5450.042.50.03148.0111.00.99063.140.3211.950white0.066.018284255588411
608.00.320.364.60.04256.0178.00.99283.290.4712.060white0.065.775263510117812
616.10.220.233.10.05215.0104.00.99483.140.428.750white0.155.843183970655404
628.30.30.3610.00.04233.0169.00.99823.230.519.360white0.095.775263510117812
636.10.340.3112.00.05346.0238.00.99773.160.488.650white0.135.775263510117812
646.60.620.28.70.04681.0224.00.996053.170.449.350white0.115.678837363927019
658.70.450.41.50.06717.0100.00.99573.270.5710.160white0.135.775263510117812
666.70.240.296.80.03854.0127.00.99323.330.4611.671white0.195.775263510117812
676.40.330.241.60.05425.0117.00.99433.360.59.350white0.175.714769509872761
686.90.250.279.050.03937.0128.00.99363.270.3411.381white0.15.775263510117812
697.50.330.3912.40.06529.0119.00.99743.160.399.450white0.085.775263510117812
706.60.360.211.50.04939.0184.00.99283.180.419.960white0.065.714769509872761
717.10.320.41.50.03413.084.00.99443.420.610.450white0.065.775263510117812
726.50.320.1211.50.03335.0165.00.99743.220.329.050white0.135.714769509872761
737.70.440.2411.20.03141.0167.00.99483.120.4311.371white0.025.714769509872761
747.40.490.2415.10.0334.0153.00.99533.130.5112.071white0.25.714769509872761
756.40.210.35.60.04443.0160.00.99493.60.4110.660white0.125.843183970655404
768.00.550.4212.60.21137.0213.00.99882.990.569.350white0.185.775263510117812
776.50.340.3611.00.05253.0247.00.99843.440.559.360white0.195.775263510117812
788.20.180.3111.80.03996.0249.00.99763.070.529.560white0.025.905257700971672
798.30.280.457.80.05932.0139.00.99723.330.7711.260white0.065.775263510117812
806.10.340.464.70.02921.094.00.9913.290.6212.360white0.026.018284255588411
817.40.440.211.50.04944.0157.00.9983.270.449.050white0.075.714769509872761
827.00.240.251.70.04248.0189.00.9923.250.4211.460white0.15.988968439709822
836.10.340.464.70.02921.094.00.9913.290.6212.360white0.156.018284255588411
848.30.270.392.40.05816.0107.00.99553.280.5910.350white0.075.775263510117812
858.90.330.341.40.05614.0171.00.99463.130.479.750white0.145.775263510117812
866.70.180.194.70.04657.0161.00.99463.320.6610.560white0.05.843183970655404
877.80.20.2810.20.05478.0186.00.9973.140.4610.060white0.125.905257700971672
887.30.130.312.30.05422.0104.00.99243.240.9211.571white0.065.842852264917723
897.10.250.32.40.04225.0122.00.9943.430.6110.560white0.065.775263510117812
906.30.190.211.80.04935.0163.00.99243.310.510.360white0.185.898880325509904
917.00.210.225.10.04838.0168.00.99453.340.4910.460white0.165.843183970655404
928.00.20.361.20.03221.078.00.99213.080.3710.460white0.015.769569829480156
938.00.250.2614.00.04341.0248.00.99863.030.578.760white0.125.714769509872761
947.30.240.4113.60.0541.0178.00.99883.370.439.750white0.155.775263510117812
956.80.240.3118.30.04640.0142.01.03.30.418.750white0.055.775263510117812
967.90.260.3310.30.03973.0212.00.99692.930.499.560white0.135.775263510117812
977.20.310.418.60.05315.089.00.99763.290.649.960white0.185.775263510117812
986.70.440.311.90.0341.0104.00.993.290.6212.671white0.066.018284255588411
998.80.230.3510.70.0426.0183.00.99842.930.499.160white0.075.775263510117812
1007.20.360.365.70.03826.098.00.99142.930.5912.571white0.185.988968439709822
Rows: 1-100 | Columns: 16

Note

Predictions can be made automatically using the test set, in which case you don’t need to specify the predictors. Alternatively, you can pass only the VastFrame to the predict() function, but in this case, it’s essential that the column names of the VastFrame match the predictors and response name in the model.

Plots

Tree models can be visualized by drawing their tree plots. For more examples, check out Machine Learning - Tree Plots.

model.plot_tree()
../_images/machine_learning_VAST_gbreg.png

Note

The above example may not render properly in the doc because of the huge size of the tree. But it should render nicely in jupyter environment.

In order to plot graph using graphviz separately, you can extract the graphviz DOT file code as follows:

model.to_graphviz()

This string can then be copied into a DOT file which can beparsed by graphviz.

Contour plot is another useful plot that can be produced for models with two predictors.

model.contour()

Important

Machine learning models with two predictors can usually benefit from their own contour plot. This visual representation aids in exploring predictions and gaining a deeper understanding of how these models perform in different scenarios. Please refer to Contour Plot for more examples.Model Exporting


To Memmodel

model.to_memmodel()

Note

MemModel objects serve as in-memory representations of machine learning models. They can be used for both in-database and in-memory prediction tasks. These objects can be pickled in the same way that you would pickle a scikit-learn model.

The preceding methods for exporting the model use MemModel, and it is recommended to use MemModel directly.

To SQL

You can get the SQL query equivalent of the GradientBoosting model by:

model.to_sql()

Note

This SQL query can be directly used in any database.

Deploy SQL

To get the SQL query which uses VAST functions use below:

model.deploySQL()

To Python

To obtain the prediction function in Python syntax, use the following code:

X = [[4.2, 0.17, 0.36, 1.8, 0.029, 0.9899]]
model.to_python()(X)

Hint

The to_python() method is used to retrieve predictions, probabilities, or cluster distances. For specific details on how to use this method for different model types, refer to the relevant documentation for each model.

__init__(name: str = None, overwrite_model: bool = False, **kwargs) None

Methods

__init__([name, overwrite_model])

contour([nbins, chart])

Draws the model's contour plot.

deploySQL([X])

Returns the SQL code needed to deploy the model.

drop()

Drops the model from the VAST DataBase.

export_models(name, path[, kind])

Exports machine learning models.

features_importance([tree_id, show, chart])

Computes the model's features importance.

fit(input_relation, X, y[, test_relation, ...])

Trains the model.

get_attributes([attr_name])

Returns the model attributes.

get_match_index(x, col_list[, str_check])

Returns the matching index.

get_params()

Returns the parameters of the model.

get_plotting_lib([class_name, chart, ...])

Returns the first available library (Plotly, Matplotlib) to draw a specific graphic.

get_tree([tree_id])

Returns a table with all the input tree information.

import_models(path[, schema, kind])

Imports machine learning models.

plot([max_nb_points, chart])

Draws the model.

plot_tree([tree_id, pic_path])

Draws the input tree.

predict(vdf[, X, name, inplace])

Predicts using the input relation.

regression_report([metrics])

Computes a regression report using multiple metrics to evaluate the model (r2, mse, max error...).

report([metrics])

Computes a regression report using multiple metrics to evaluate the model (r2, mse, max error...).

score([metric])

Computes the model score.

set_params([parameters])

Sets the parameters of the model.

summarize()

Summarizes the model.

to_binary(path)

Exports the model to the VAST Binary format.

to_graphviz([tree_id, classes_color, ...])

Returns the code for a Graphviz tree.

to_json([path])

Creates a Python GradientBoosting JSON file that can be imported into the Python GradientBoosting API.

to_memmodel()

Converts the model to an InMemory object that can be used for different types of predictions.

to_python([return_proba, ...])

Returns the Python function needed for in-memory scoring without using built-in VAST functions.

to_sql([X, return_proba, ...])

Returns the SQL code needed to deploy the model without using built-in VAST functions.

Attributes