Loading...

vastorbit.machine_learning.vast.naive_bayes.NaiveBayes

class vastorbit.machine_learning.vast.naive_bayes.NaiveBayes(name: str = None, overwrite_model: bool = False, alpha: Annotated[int | float | Decimal, 'Python Numbers'] = 1.0, nbtype: Literal['auto', 'bernoulli', 'categorical', 'multinomial', 'gaussian'] = 'auto')

Creates an NaiveBayes 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)

  • prior_ (numpy.array) – The model’s classes probabilities.

  • attributes_ (list of dict) – list of the model’s attributes. Each feature is represented by a dictionary, which differs based on the distribution.

  • classes_ (numpy.array) – The classes labels.

  • 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.

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 iris dataset.

import vastorbit.datasets as vod

data = vod.load_iris()
123
sepallengthcm
Decimal(5, 2)
123
sepalwidthcm
Decimal(5, 2)
123
petallengthcm
Decimal(5, 2)
123
petalwidthcm
Decimal(5, 2)
Abc
species
Varchar(30)
15.13.51.40.2Iris-setosa
24.93.01.40.2Iris-setosa
34.73.21.30.2Iris-setosa
44.63.11.50.2Iris-setosa
55.03.61.40.2Iris-setosa
65.43.91.70.4Iris-setosa
74.63.41.40.3Iris-setosa
85.03.41.50.2Iris-setosa
94.42.91.40.2Iris-setosa
104.93.11.50.1Iris-setosa
115.43.71.50.2Iris-setosa
124.83.41.60.2Iris-setosa
134.83.01.40.1Iris-setosa
144.33.01.10.1Iris-setosa
155.84.01.20.2Iris-setosa
165.74.41.50.4Iris-setosa
175.43.91.30.4Iris-setosa
185.13.51.40.3Iris-setosa
195.73.81.70.3Iris-setosa
205.13.81.50.3Iris-setosa
215.43.41.70.2Iris-setosa
225.13.71.50.4Iris-setosa
234.63.61.00.2Iris-setosa
245.13.31.70.5Iris-setosa
254.83.41.90.2Iris-setosa
265.03.01.60.2Iris-setosa
275.03.41.60.4Iris-setosa
285.23.51.50.2Iris-setosa
295.23.41.40.2Iris-setosa
304.73.21.60.2Iris-setosa
314.83.11.60.2Iris-setosa
325.43.41.50.4Iris-setosa
335.24.11.50.1Iris-setosa
345.54.21.40.2Iris-setosa
354.93.11.50.1Iris-setosa
365.03.21.20.2Iris-setosa
375.53.51.30.2Iris-setosa
384.93.11.50.1Iris-setosa
394.43.01.30.2Iris-setosa
405.13.41.50.2Iris-setosa
415.03.51.30.3Iris-setosa
424.52.31.30.3Iris-setosa
434.43.21.30.2Iris-setosa
445.03.51.60.6Iris-setosa
455.13.81.90.4Iris-setosa
464.83.01.40.3Iris-setosa
475.13.81.60.2Iris-setosa
484.63.21.40.2Iris-setosa
495.33.71.50.2Iris-setosa
505.03.31.40.2Iris-setosa
517.03.24.71.4Iris-versicolor
526.43.24.51.5Iris-versicolor
536.93.14.91.5Iris-versicolor
545.52.34.01.3Iris-versicolor
556.52.84.61.5Iris-versicolor
565.72.84.51.3Iris-versicolor
576.33.34.71.6Iris-versicolor
584.92.43.31.0Iris-versicolor
596.62.94.61.3Iris-versicolor
605.22.73.91.4Iris-versicolor
615.02.03.51.0Iris-versicolor
625.93.04.21.5Iris-versicolor
636.02.24.01.0Iris-versicolor
646.12.94.71.4Iris-versicolor
655.62.93.61.3Iris-versicolor
666.73.14.41.4Iris-versicolor
675.63.04.51.5Iris-versicolor
685.82.74.11.0Iris-versicolor
696.22.24.51.5Iris-versicolor
705.62.53.91.1Iris-versicolor
715.93.24.81.8Iris-versicolor
726.12.84.01.3Iris-versicolor
736.32.54.91.5Iris-versicolor
746.12.84.71.2Iris-versicolor
756.42.94.31.3Iris-versicolor
766.63.04.41.4Iris-versicolor
776.82.84.81.4Iris-versicolor
786.73.05.01.7Iris-versicolor
796.02.94.51.5Iris-versicolor
805.72.63.51.0Iris-versicolor
815.52.43.81.1Iris-versicolor
825.52.43.71.0Iris-versicolor
835.82.73.91.2Iris-versicolor
846.02.75.11.6Iris-versicolor
855.43.04.51.5Iris-versicolor
866.03.44.51.6Iris-versicolor
876.73.14.71.5Iris-versicolor
886.32.34.41.3Iris-versicolor
895.63.04.11.3Iris-versicolor
905.52.54.01.3Iris-versicolor
915.52.64.41.2Iris-versicolor
926.13.04.61.4Iris-versicolor
935.82.64.01.2Iris-versicolor
945.02.33.31.0Iris-versicolor
955.62.74.21.3Iris-versicolor
965.73.04.21.2Iris-versicolor
975.72.94.21.3Iris-versicolor
986.22.94.31.3Iris-versicolor
995.12.53.01.1Iris-versicolor
1005.72.84.11.3Iris-versicolor
Rows: 1-100 | Columns: 5

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_iris()
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.

Balancing the Dataset

In vastorbit, balancing a dataset to address class imbalances is made straightforward through the balance() function within the preprocessing module. This function enables users to rectify skewed class distributions efficiently. By specifying the target variable and setting parameters like the method for balancing, users can effortlessly achieve a more equitable representation of classes in their dataset. Whether opting for over-sampling, under-sampling, or a combination of both, vastorbit’s balance() function streamlines the process, empowering users to enhance the performance and fairness of their machine learning models trained on imbalanced data.

To balance the dataset, use the following syntax.

from vastorbit.machine_learning.vast.preprocessing import balance

balanced_train = balance(
    name = "my_schema.train_balanced",
    input_relation = train,
    y = "good",
    method = "hybrid",
)

Note

With this code, a table named train_balanced is created in the my_schema schema. It can then be used to train the model. In the rest of the example, we will work with the full dataset.

Hint

Balancing the dataset is a crucial step in improving the accuracy of machine learning models, particularly when faced with imbalanced class distributions. By addressing disparities in the number of instances across different classes, the model becomes more adept at learning patterns from all classes rather than being biased towards the majority class. This, in turn, enhances the model’s ability to make accurate predictions for under-represented classes. The balanced dataset ensures that the model is not dominated by the majority class and, as a result, leads to more robust and unbiased model performance. Therefore, by employing techniques such as over-sampling, under-sampling, or a combination of both during dataset preparation, practitioners can significantly contribute to achieving higher accuracy and better generalization of their machine learning models.

Model Initialization

First we import the NaiveBayes model:

from vastorbit.machine_learning.vast import NaiveBayes

Then we can create the model:

model = NaiveBayes()

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,
    [
        "SepalLengthCm",
        "SepalWidthCm",
        "PetalLengthCm",
        "PetalWidthCm",
    ],
    "Species",
    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.

Metrics

We can get the entire report using:

model.report()
Iris-setosaIris-versicolorIris-virginicaavg_macroavg_weightedavg_micro
auc0.92521367521367540.96153846153846161.00.96225071225071230.9587813620071686[null]
prc_auc0.452781196727461870.176139272913466430.27609890109890110.301673123579943140.33654388076623154[null]
accuracy0.93548387096774190.9677419354838710.90322580645161290.9354838709677420.93028095733610820.9354838709677419
log_loss6.403479896870502e-150.198923655924169976.6964257917623242.29844981589552.4146524401590543[null]
precision1.00.85714285714285710.83333333333333340.89682539682539690.913210445468510.9032258064516129
recall0.85714285714285711.00.90909090909090910.92207792207792220.90322580645161290.9032258064516129
f1_score0.9230769230769230.9230769230769230.86956521739130430.90523968784838350.90408889847880030.9032258064516129
mcc0.8757381419311840.90711473522214540.79476958433561610.85920748716298190.85308025245358790.8548387096774194
informedness0.85714285714285720.960.80909090909090910.87541125541125540.85999999999999990.8548387096774195
markedness0.89473684210526330.85714285714285720.78070175438596490.84419381787802850.8469965235669820.8548387096774195
csi0.85714285714285710.85714285714285710.76923076923076930.82783882783882790.82594824530308410.8235294117647058
Rows: 1-11 | Columns: 7

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 = ["auc", "accuracy"]).

For classification models, we can easily modify the cutoff to observe the effect on different metrics:

model.report(cutoff = 0.2)
Iris-setosaIris-versicolorIris-virginicaavg_macroavg_weightedavg_micro
auc0.92521367521367540.970.78947368421052630.89489578647473390.8784667397660819[null]
prc_auc0.401985111662531040.28064516129032270.173310291858678860.28531352160384420.28633472542242705[null]
accuracy0.9677419354838710.419354838709677440.19354838709677420.52688172043010760.55040322580645160.5268817204301075
log_loss1.1531886556987614e-120.0115013282317860970.198923655924180460.070141661385706590.08296923426312669[null]
precision1.00.00.00.33333333333333330.406250.3333333333333333
recall0.92307692307692310.00.00.30769230769230770.3750.375
f1_score0.96000000000000010.00.00.320.390.35294117647058826
mcc0.935143800239036-0.3893314107138301-0.6753816335059704-0.043189747993588180.03252874072646478-0.017987628765650892
informedness0.9230769230769231-0.48-0.6666666666666667-0.074529914529914530.01416666666666666-0.018442622950819665
markedness0.9473684210526314-0.3157894736842105-0.6842105263157895-0.017543859649122860.047697368421052544-0.01754385964912286
csi0.92307692307692310.00.00.30769230769230770.3750.21428571428571427
Rows: 1-11 | Columns: 7

You can also use the NaiveBayes.score function to compute any classification metric. The default metric is the accuracy:

model.score(metric = "f1", average = "macro")

Note

For multi-class scoring, vastorbit allows the flexibility to use three averaging techniques: micro, macro and weighted. Please refer to this link for more details on how they are calculated.

Prediction

Prediction is straight-forward:

model.predict(
    test,
    [
        "SepalLengthCm",
        "SepalWidthCm",
        "PetalLengthCm",
        "PetalWidthCm",
    ],
    "prediction",
)
123
sepallengthcm
Decimal(5, 2)
123
sepalwidthcm
Decimal(5, 2)
123
petallengthcm
Decimal(5, 2)
123
petalwidthcm
Decimal(5, 2)
Abc
species
Varchar(30)
123
seedrand
Decimal(26, 6)
Abc
prediction
Varchar(15)
13.34.55.67.8Iris-setosa0.1Iris-virginica
25.13.51.40.2Iris-setosa0.01Iris-setosa
34.63.11.50.2Iris-setosa0.06Iris-setosa
44.83.01.40.1Iris-setosa0.07Iris-setosa
55.43.91.30.4Iris-setosa0.07Iris-setosa
65.73.81.70.3Iris-setosa0.11Iris-setosa
74.63.61.00.2Iris-setosa0.16Iris-setosa
84.73.21.60.2Iris-setosa0.04Iris-setosa
95.43.41.50.4Iris-setosa0.04Iris-setosa
104.93.11.50.1Iris-setosa0.12Iris-setosa
115.53.51.30.2Iris-setosa0.15Iris-setosa
124.93.11.50.1Iris-setosa0.16Iris-setosa
134.83.01.40.3Iris-setosa0.0Iris-setosa
147.03.24.71.4Iris-versicolor0.08Iris-versicolor
155.72.84.51.3Iris-versicolor0.06Iris-versicolor
166.12.94.71.4Iris-versicolor0.05Iris-versicolor
176.42.94.31.3Iris-versicolor0.07Iris-versicolor
185.52.43.81.1Iris-versicolor0.03Iris-versicolor
195.73.04.21.2Iris-versicolor0.16Iris-versicolor
205.82.75.11.9Iris-virginica0.05Iris-virginica
214.92.54.51.7Iris-virginica0.12Iris-versicolor
225.72.55.02.0Iris-virginica0.01Iris-virginica
237.73.86.72.2Iris-virginica0.01Iris-virginica
245.62.84.92.0Iris-virginica0.11Iris-virginica
256.73.35.72.1Iris-virginica0.04Iris-virginica
267.23.05.81.6Iris-virginica0.09Iris-virginica
277.42.86.11.9Iris-virginica0.1Iris-virginica
287.93.86.42.0Iris-virginica0.16Iris-virginica
296.03.04.81.8Iris-virginica0.03Iris-virginica
306.73.15.62.4Iris-virginica0.04Iris-virginica
316.83.25.92.3Iris-virginica0.15Iris-virginica
Rows: 1-31 | Columns: 7

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.

Probabilities

It is also easy to get the model’s probabilities:

model.predict_proba(
    test,
    [
        "SepalLengthCm",
        "SepalWidthCm",
        "PetalLengthCm",
        "PetalWidthCm",
    ],
    "prediction",
)
123
sepallengthcm
Decimal(5, 2)
123
sepalwidthcm
Decimal(5, 2)
123
petallengthcm
Decimal(5, 2)
123
petalwidthcm
Decimal(5, 2)
Abc
species
Varchar(30)
123
seedrand
Decimal(26, 6)
Abc
prediction
Varchar(15)
123
prediction_irissetosa
Double
123
prediction_irisversicolor
Double
123
prediction_irisvirginica
Double
13.34.55.67.8Iris-setosa0.1Iris-virginica0.00.00.0
24.93.01.40.2Iris-setosa0.01Iris-setosa1.01.01.0
35.03.61.40.2Iris-setosa0.06Iris-setosa1.01.01.0
44.33.01.10.1Iris-setosa0.07Iris-setosa1.01.01.0
55.13.51.40.3Iris-setosa0.07Iris-setosa0.99999999999999970.99999999999999970.9999999999999997
65.13.81.50.3Iris-setosa0.11Iris-setosa0.99999999999999960.99999999999999960.9999999999999996
75.13.31.70.5Iris-setosa0.16Iris-setosa0.99999999996425230.99999999996425230.9999999999642523
84.83.11.60.2Iris-setosa0.04Iris-setosa0.99999999999999970.99999999999999970.9999999999999997
95.24.11.50.1Iris-setosa0.04Iris-setosa1.01.01.0
105.03.21.20.2Iris-setosa0.12Iris-setosa1.01.01.0
114.93.11.50.1Iris-setosa0.15Iris-setosa1.01.01.0
124.43.01.30.2Iris-setosa0.16Iris-setosa1.01.01.0
135.13.81.60.2Iris-setosa0.0Iris-setosa1.01.01.0
146.43.24.51.5Iris-versicolor0.08Iris-versicolor1.4024046089753773e-1021.4024046089753773e-1021.4024046089753773e-102
156.33.34.71.6Iris-versicolor0.06Iris-versicolor2.955498914528877e-1162.955498914528877e-1162.955498914528877e-116
165.62.93.61.3Iris-versicolor0.05Iris-versicolor1.9152980936586173e-571.9152980936586173e-571.9152980936586173e-57
176.63.04.41.4Iris-versicolor0.07Iris-versicolor1.8746957658747432e-941.8746957658747432e-941.8746957658747432e-94
185.52.43.71.0Iris-versicolor0.03Iris-versicolor6.792244965186134e-486.792244965186134e-486.792244965186134e-48
195.72.94.21.3Iris-versicolor0.16Iris-versicolor3.370177313986364e-783.370177313986364e-783.370177313986364e-78
207.13.05.92.1Iris-virginica0.05Iris-virginica6.944055988322943e-2226.944055988322943e-2226.944055988322943e-222
217.32.96.31.8Iris-virginica0.12Iris-virginica6.145624281196476e-2256.145624281196476e-2256.145624281196476e-225
225.82.85.12.4Iris-virginica0.01Iris-virginica2.4654726407268578e-1982.4654726407268578e-1982.4654726407268578e-198
237.72.66.92.3Iris-virginica0.01Iris-virginica1.50907293132e-3121.50907293132e-3121.50907293132e-312
247.72.86.72.0Iris-virginica0.11Iris-virginica1.974774735118236e-2711.974774735118236e-2711.974774735118236e-271
257.23.26.01.8Iris-virginica0.04Iris-virginica1.1100389392256957e-2041.1100389392256957e-2041.1100389392256957e-204
267.42.86.11.9Iris-virginica0.09Iris-virginica1.6854017652731458e-2201.6854017652731458e-2201.6854017652731458e-220
277.93.86.42.0Iris-virginica0.1Iris-virginica7.562531432181313e-2527.562531432181313e-2527.562531432181313e-252
286.42.85.62.2Iris-virginica0.16Iris-virginica6.96680243706805e-2096.96680243706805e-2096.96680243706805e-209
296.93.15.42.1Iris-virginica0.03Iris-virginica1.0247164094833497e-1911.0247164094833497e-1911.0247164094833497e-191
306.93.15.12.3Iris-virginica0.04Iris-virginica4.634820040037661e-1944.634820040037661e-1944.634820040037661e-194
316.73.35.72.5Iris-virginica0.15Iris-virginica1.3665154659861449e-2441.3665154659861449e-2441.3665154659861449e-244
Rows: 1-31 | Columns: 10

Note

Probabilities are added to the VastFrame, and vastorbit uses the corresponding probability function in SQL behind the scenes. You can use the pos_label parameter to add only the probability of the selected category.

Confusion Matrix

You can obtain the confusion matrix.

model.confusion_matrix()

Hint

In the context of multi-class classification, you typically work with an overall confusion matrix that summarizes the classification efficiency across all classes. However, you have the flexibility to specify a pos_label and adjust the cutoff threshold. In this case, a binary confusion matrix is computed, where the chosen class is treated as the positive class, allowing you to evaluate its efficiency as if it were a binary classification problem.

model.confusion_matrix(pos_label = "Iris-setosa", cutoff = 0.6)

Note

In classification, the cutoff is a threshold value used to determine class assignment based on predicted probabilities or scores from a classification model. In binary classification, if the predicted probability for a specific class is greater than or equal to the cutoff, the instance is assigned to the positive class; otherwise, it is assigned to the negative class. Adjusting the cutoff allows for trade-offs between true positives and false positives, enabling the model to be optimized for specific objectives or to consider the relative costs of different classification errors. The choice of cutoff is critical for tailoring the model’s performance to meet specific needs.

Main Plots (Classification Curves)

Classification models allow for the creation of various plots that are very helpful in understanding the model, such as the ROC Curve, PRC Curve, Cutoff Curve, Gain Curve, and more.

Most of the classification curves can be found in the Machine Learning - Classification Curve.

For example, let’s draw the model’s ROC curve.

model.roc_curve(pos_label = "Iris-setosa")

Important

Most of the curves have a parameter called nbins, which is essential for estimating metrics. The larger the nbins, the more precise the estimation, but it can significantly impact performance. Exercise caution when increasing this parameter excessively.

Hint

In binary classification, various curves can be easily plotted. However, in multi-class classification, it’s important to select the pos_label, representing the class to be treated as positive when drawing the curve.

Other Plots

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

model.contour(pos_label = "Iris-setosa")

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.

Parameter Modification

In order to see the parameters:

model.get_params()

And to manually change some of the parameters:

model.set_params({'alpha': 0.9})

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 following methods for exporting the model use MemModel, and it is recommended to use MemModel directly.

To SQL

You can get the SQL code by:

model.to_sql()

To Python

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

X = [[5, 2, 3, 1]]
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, alpha: Annotated[int | float | Decimal, 'Python Numbers'] = 1.0, nbtype: Literal['auto', 'bernoulli', 'categorical', 'multinomial', 'gaussian'] = 'auto') None

Methods

__init__([name, overwrite_model, alpha, nbtype])

classification_report([metrics, cutoff, ...])

Computes a classification report using multiple model evaluation metrics (auc, accuracy, f1...).

confusion_matrix([pos_label, cutoff])

Computes the model confusion matrix.

contour([pos_label, nbins, chart])

Draws the model's contour plot.

cutoff_curve([pos_label, nbins, show, chart])

Draws the model Cutoff curve.

deploySQL([X, pos_label, cutoff, allSQL])

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.

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.

import_models(path[, schema, kind])

Imports machine learning models.

lift_chart([pos_label, nbins, show, chart])

Draws the model Lift Chart.

prc_curve([pos_label, nbins, show, chart])

Draws the model PRC curve.

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

Predicts using the input relation.

predict_proba(vdf[, X, name, pos_label, inplace])

Returns the model's probabilities using the input relation.

report([metrics, cutoff, labels, nbins])

Computes a classification report using multiple model evaluation metrics (auc, accuracy, f1...).

roc_curve([pos_label, nbins, show, chart])

Draws the model ROC curve.

score([metric, average, pos_label, cutoff, ...])

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_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