bayesian_search_cv¶
In [ ]:
bayesian_search_cv(estimator,
input_relation: (str, vDataFrame),
X: list,
y: str,
metric: str = "auto",
cv: int = 3,
pos_label: (int, float, str) = None,
cutoff: float = -1,
param_grid: (dict, list) = {},
random_nbins: int = 16,
bayesian_nbins: int = None,
random_grid: bool = False,
lmax: int = 15,
nrows: int = 100000,
k_tops: int = 10,
RFmodel_params: dict = {},
print_info: bool = True,)
Computes the k-fold bayesian search of an estimator using a random forest model to estimate a probable optimal set of parameters.
Parameters¶
| Name | Type | Optional | Description |
|---|---|---|---|
estimator | object | ❌ | Vertica estimator having a fit method. |
input_relation | str / vDataFrame | ❌ | Input Relation. |
X | list | ❌ | List of the predictor columns. |
y | str | ❌ | Response Column. |
metric | str / list | ✓ | Metric used to do the model evaluation.
For Classification:
For Regression:
|
cv | int | ✓ | Number of folds. |
pos_label | int / float / str | ✓ | The main class to be considered as positive (classification only). |
cutoff | float | ✓ | The model cutoff (classification only). |
param_grid | dict / list | ✓ | Dictionary of the parameters to test. It can also be a list of the different combinations. If empty, a parameter grid will be generated. |
random_nbins | int | ✓ | Number of bins used to compute the different parameters categories in the random parameters generation. |
bayesian_nbins | int | ✓ | Number of bins used to compute the different parameters categories in the bayesian table generation. |
random_grid | bool | ✓ | If True, the rows used to find the optimal function will be used randomnly. Otherwise, they will be regularly spaced. |
lmax | int | ✓ | Maximum length of each parameter list. |
nrows | int | ✓ | Number of rows to use when performing the bayesian search. |
k_tops | int | ✓ | When performing the bayesian search, the final stage will be to retrain the top possible combinations. 'k_tops' represents the number of models to train at this stage to find the most efficient model. |
RFmodel_params | dict | ✓ | Dictionary of the random forest model parameters used to estimate a probable optimal set of parameters. |
print_info | bool | ✓ | If True, prints the model information at each step. |
Returns¶
tablesample : An object containing the result. For more information, see utilities.tablesample.
Example¶
In [62]:
from verticapy.learn.linear_model import LogisticRegression
model = LogisticRegression(name = "public.LR_titanic",
tol = 1e-4,
max_iter = 100,
solver = 'Newton')
from verticapy.learn.model_selection import bayesian_search_cv
bayesian_search_cv(model,
input_relation = "public.titanic",
X = ["age", "fare", "pclass"],
y = "survived",
cv = 3)
Out[62]:
