pytorch NaNLabelEncoder 用于编码和解码分类目标
我是 pytorch 的新手,但感觉这应该很简单。如何对这个张量进行逆变换?
classification_dataset = TimeSeriesDataSet(
df,
group_ids=['group'],
target="target_col", # categorical target
time_idx="time_idx",
min_encoder_length= 60 * 60, # how much history to use
max_encoder_length= 60 * 60,
min_prediction_length=5,
max_prediction_length=5, # how far to predict into future
time_varying_unknown_reals=[
#...list of columns here
],
#time_varying_unknown_reals=[time_varying_unknown_reals[0]],
target_normalizer=NaNLabelEncoder(), # Use the NaNLabelEncoder to encode categorical target
)
x, y = next(iter(classification_dataset.to_dataloader(batch_size=4)))
y[0] # target values are encoded categories
输出
tensor([[6, 6, 6, 6, 6],
[5, 5, 5, 5, 5],
[5, 5, 5, 5, 5],
[1, 1, 1, 1, 1]])
classification_dataset.target_normalizer返回NaNLabelEncoder()但它不适合。
I'm new to pytorch but it feels like this should be simple. How do I inverse transform this tensor?
classification_dataset = TimeSeriesDataSet(
df,
group_ids=['group'],
target="target_col", # categorical target
time_idx="time_idx",
min_encoder_length= 60 * 60, # how much history to use
max_encoder_length= 60 * 60,
min_prediction_length=5,
max_prediction_length=5, # how far to predict into future
time_varying_unknown_reals=[
#...list of columns here
],
#time_varying_unknown_reals=[time_varying_unknown_reals[0]],
target_normalizer=NaNLabelEncoder(), # Use the NaNLabelEncoder to encode categorical target
)
x, y = next(iter(classification_dataset.to_dataloader(batch_size=4)))
y[0] # target values are encoded categories
output
tensor([[6, 6, 6, 6, 6],
[5, 5, 5, 5, 5],
[5, 5, 5, 5, 5],
[1, 1, 1, 1, 1]])
classification_dataset.target_normalizer returns NaNLabelEncoder() but it's not fitted.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
啊,就这么简单
ah it's as simple as