OneHotEncoder¶
In [ ]:
OneHotEncoder(name: str,
extra_levels: dict = {},
drop_first: bool = True,
ignore_null: bool = True,
separator: str = '_',
column_naming: str = "indices",
null_column_name: str = "null")
Creates a Vertica OneHotEncoder object.
Parameters¶
| Name | Type | Optional | Description |
|---|---|---|---|
name | str | ❌ | Name of the the model. |
extra_levels | dict | ✓ | Additional levels in each category that are not in the input relation. |
drop_first | bool | ✓ | If true, the first level of the categorical variable is treated as the reference level. Otherwise, every level of the categorical variable has a corresponding column in the output view. |
ignore_null | bool | ✓ | If true, NULL values set all corresponding one-hot binary columns to NULL. Otherwise, NULL values in the input columns are treated as a categorical level. |
separator | str | ✓ | The character that separates the input variable name and the indicator variable level in the output table. To avoid using any separator, set this parameter to null value. |
column_naming | str | ✓ | Appends categorical levels to column names according to the specified method:
|
null_column_name | str | ✓ | The string used to name the indicator column for NULL values, used only if ignore_null is false and column_naming is set to values or values_relaxed. |
Attributes¶
After the object is created, all parameters become attributes. Additional attributes will be created when fitting the model:
| Name | Type | Description |
|---|---|---|
param_ | tablesample | The OneHotEncoder parameters. |
input_relation | str | Training relation. |
X | list | List of the predictors. |
Methods¶
| Name | Description |
|---|---|
| deploySQL | Returns the SQL code needed to deploy the model. |
| drop | Drops the model from the Vertica DB. |
| fit | Trains the model. |
| get_attr | Returns the model attribute. |
| get_params | Returns the model Parameters. |
| set_params | Sets the parameters of the model. |
| to_memmodel | Converts a specified Vertica model to a memModel model. |
| to_python | Returns the Python code needed to deploy the model without using built-in Vertica functions. |
| to_sql | Returns the SQL code needed to deploy the model without using Vertica built-in functions. |
| transform | Applies the model on a vDataFrame. |
Example¶
In [30]:
from verticapy.learn.preprocessing import OneHotEncoder
model = OneHotEncoder(name = "public.OOE_Species")
display(model)
