SVD¶
In [ ]:
SVD(name: str,
n_components: int = 0,
method: str = "lapack")
Creates a SVD (Singular Value Decomposition) object using the Vertica SVD function.
Parameters¶
| Name | Type | Optional | Description |
|---|---|---|---|
name | str | ❌ | Name of the model to be stored in the database. |
n_components | int | ✓ | The number of components to keep in the model. If this value is not provided, all components are kept. The maximum number of components is the number of non-zero singular values returned by the internal call to SVD. This number is less than or equal to SVD (number of columns, number of rows). |
method | str | ✓ | The method to use to calculate PCA.
|
Attributes¶
After the object is created, all parameters become attributes. Additional attributes will be created when fitting the model:
| Name | Type | Description |
|---|---|---|
singular_values_ | tablesample | The singular values. |
explained_variance_ | tablesample | The singular values explained variance. |
input_relation | str | Training relation. |
X | list | List of the predictors. |
Methods¶
| Name | Description |
|---|---|
| deploySQL | Returns the SQL code needed to deploy the model. |
| deployInverseSQL | Returns the SQL code needed to deploy the inverse model (SVD ** -1). |
| drop | Drops the model from the Vertica DB. |
| fit | Trains the model. |
| get_attr | Returns the model attribute. |
| get_params | Returns the model Parameters. |
| inverse_transform | Applies the inverse model on a vDataFrame. |
| plot | Draws a decomposition scatter plot. |
| plot_circle | Draws a decomposition circle. |
| plot_scree | Draws a decomposition scree plot. |
| score | Returns the decomposition Score on a dataset for each trasformed column. |
| 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 [37]:
from verticapy.learn.decomposition import SVD
model = SVD(name = "public.svd_iris")
display(model)
