sktime / sktime/pytorch-forecasting
variable_groups doesn't combine real values for scalers
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5k
- Forks
- 912
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 12
Description
- PyTorch-Forecasting version: 0.9.1
Expected behavior
According to the documentation:
variable_groups (Dict[str, List[str]]) – dictionary mapping a name to a list of columns in the data. The name should be present in a categorical or real class argument, to be able to encode or scale the columns by group. This will effectively combine categorical variables is particularly useful if a categorical variable can have multiple values at the same time. An example are holidays which can be overlapping.
I expect to get equal scalers for multiple columns from the same variable_groups. Or maybe a single scaler?
Actual behavior
Actually, they have different parameters.
Code to reproduce the problem
from pytorch_forecasting import TimeSeriesDataSet
import pandas as pd
import numpy as np
data = pd.DataFrame(
{
"group": np.zeros(5),
"time_idx": np.arange(5),
"a": np.random.rand(5),
"b": np.random.rand(5),
"target": np.random.rand(5)
}
)
ds = TimeSeriesDataSet(
data,
time_idx="time_idx",
group_ids=["group"],
target="target",
min_encoder_length=4,
max_encoder_length=4,
min_prediction_length=1,
max_prediction_length=1,
time_varying_known_reals=["a", "b"],
variable_groups={
"var_group": ["a", "b"]
}
)
assert ds.scalers["a"].mean_.item() != ds.scalers["b"].mean_.item()
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at TimeSeriesDataSet and trace how variable_groups is handled for time_varying_known_reals and how ds.scalers is populated. Run the provided reproduction to confirm the differing parameters, then clarify whether grouped real columns should share scaling parameters or use one scaler; done means the behavior matches the documented grouping semantics and is covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, pandas, python, pytorch
- Domain
- data, machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100