Open lwq-star opened 1 day ago
Hey @lwq-star! I'm here to assist you with any bugs, questions, or contributions you have. Let's tackle this issue together!
To convert the predicted values obtained from a regression model in PyTorch Tabular back to the original scale, you can use the inverse_transform
method provided by the target_transforms
attribute of the datamodule
. This is similar to how scikit-learn uses power.inverse_transform
and scaler.inverse_transform
functions. Here is an example of how you can do it:
if self.datamodule.do_target_transform:
for i, target_col in enumerate(self.config.target):
pred_df[f"{target_col}_prediction"] = self.datamodule.target_transforms[i].inverse_transform(
point_predictions[:, i].reshape(-1, 1)
)
This code snippet shows how the inverse transformation is applied to the predicted values to convert them back to the original scale. The target_transforms
is a list of transformers applied to each target column, and inverse_transform
is used to revert the transformation [1].
To continue talking to Dosu, mention @dosu.
Hey @lwq-star! I'm here to assist you with any bugs, questions, or contributions you have. Let's tackle this issue together!嘿 !我随时为您提供帮助,解决您遇到的任何错误、问题或贡献。让我们一起来解决这个问题吧!
To convert the predicted values obtained from a regression model in PyTorch Tabular back to the original scale, you can use the
inverse_transform
method provided by thetarget_transforms
attribute of thedatamodule
. This is similar to how scikit-learn usespower.inverse_transform
andscaler.inverse_transform
functions. Here is an example of how you can do it:要将 PyTorch Tabular 中的回归模型获得的预测值转换回原始比例,可以使用datamodule
的target_transforms
属性提供的inverse_transform
方法。这类似于 scikit-learn 使用power.inverse_transform
和scaler.inverse_transform
函数的方式。以下是如何执行此操作的示例:if self.datamodule.do_target_transform: for i, target_col in enumerate(self.config.target): pred_df[f"{target_col}_prediction"] = self.datamodule.target_transforms[i].inverse_transform( point_predictions[:, i].reshape(-1, 1) )
This code snippet shows how the inverse transformation is applied to the predicted values to convert them back to the original scale. The
target_transforms
is a list of transformers applied to each target column, andinverse_transform
is used to revert the transformation [1].此代码片段显示了如何将逆变换应用于预测值以将其转换回原始比例。target_transforms
是应用于每个目标列的转换器列表,inverse_transform
用于恢复转换[1] 。
Wrong demonstration !
PyTorch Tabular has the following functions : Continuous features are scaled automatically using StandardScaler and target transformation can be enabled with a parameter. This will also handle the inverse tranformation automatically.
But how can I to convert the predicted values obtained after the original data is input into the model for regression model into the original scale?
scikit-learn have power.inverse_transform and scaler.inverse_transform functions to get original scale but PyTorch Tabular?
This is my code for data preprocessing: