verticapy.machine_learning.vertica.preprocessing.StandardScaler.inverse_transform#
- StandardScaler.inverse_transform(vdf: str | vDataFrame, X: str | list[str] | None = None) vDataFrame #
Applies the Inverse Model on a
vDataFrame
.Parameters#
- vdf: SQLRelation
Input vDataFrame. You can also specify a customized relation, but you must enclose it with an alias. For example:
(SELECT 1) x
is valid whereas(SELECT 1)
andSELECT 1
are invalid.- X: SQLColumns, optional
list
of the inputvDataColumn
.
Returns#
- vDataFrame
object result of the model transformation.
Examples#
We import
verticapy
:import verticapy as vp
For this example, we will use a dummy dataset.
data = vp.vDataFrame( { "values": [1, 1.01, 1.02, 1.05, 1.024], } )
Let’s import the model:
from verticapy.machine_learning.vertica import Scaler
Then we can create the model:
model = Scaler(method = "zscore")
We can now fit the model:
model.fit(data)
To get the scaled dataset, we can use the
transform
method. Let us transform the data:model.transform(data)
123valuesFloat(22)1 -1.10675880944634 2 -0.57466322798175 3 -0.0425676465171623 4 1.5537190978766 5 0.170270586068673 Rows: 1-5 | Column: values | Type: Float(22)Similarly, you can perform the inverse transform to get the original features using:
model.inverse_transform(data_transformed)
The variable
data_transformed
is the scaled dataset.Important
For this example, a specific model is utilized, and it may not correspond exactly to the model you are working with. To see a comprehensive example specific to your class of interest, please refer to that particular class.