Repository navigation
Preserve forecasting target names for validation Series - #1656
student-shivamm wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the forecasting target-name normalization change.
No open issues 🎉
What changed in this PR
Fixes forecasting validation-label normalization so pandas Series use the requested target name, preventing missing targets, spurious features, and subsequent prediction failures.
Changes:
- Assigns target names to Series-derived frames, matching the existing array behavior.
- Adds regression tests for Series names, feature indexes, positional alignment, input preservation, and fit/predict equivalence with NumPy targets.
| File | Description |
|---|---|
test/automl/test_ts_series_targets.py |
Adds normalization and end-to-end forecasting regression tests. |
flaml/automl/time_series/ts_data.py |
Applies requested target names when converting Series to a DataFrame. |
Review effort: Balanced
Li Jiang (thinkall)
left a comment
There was a problem hiding this comment.
Review cycle 20261106-0310; exact source 278ebc7bf5b4c7d80fe00f33e88a20b42167595e.
Bounded validation completed; independent review remains incomplete and approval is withheld. Inspected the complete two-file change and its normalization callers. The Series-derived frame is given the requested target names before positional index alignment, matching the existing NumPy path.
Executed on both native Windows/Python3.10.19 (NumPy1.26.4/pandas2.3.3) and Python3.13.5 (NumPy2.3.3/pandas3.0.5):
python -m pytest -q --import-mode=importlib -p no:cacheprovider --color=no test\automl\test_ts_series_targets.py
Result: 12 passed per stack, 24 total, with no skipped cases. The exact-main counterfactual ran the same new test file externally and produced 8 expected failures / 4 passing controls per stack. Actual imported public source/normalization paths were verified, tested input-preservation assertions passed, and no baseline source was edited. This covers Series names, positional indices/input preservation and the real naive public fit/predict path. max_iter=1 is not actual HPO/sampled-season feasibility coverage and does not clear unrelated existing main-branch forecasting findings.
The required independent review-code execution was not dispatched while the authenticated CLI prerequisite remains unresolved after prior selected-credential-authority/model-catalog failures. No reviewer model or clean skill signoff is claimed, and no credential/model/permission override was used. Native test success or peer feedback is not a substitute for that review.
Fresh exact-head gates: 0 unresolved review thread(s); Balanced Copilot recommends approval. Non-success applicable check contexts: build (ubuntu-latest, 3.12):in_progress/None. Actual workflow holds: Build:in_progress/None. An intentionally skipped PR release job is not passed deployment evidence. No full optional/forecast/Spark/TFT/GPU/performance matrix was run locally.
Posted by thinkall-agent-auto-reviewer
Li Jiang (thinkall)
left a comment
There was a problem hiding this comment.
Review cycle 20261106-1600; exact source 672e61070290ae13a91e8a5adcb1f56b4c676266.
The branch was updated with a fresh permission/conflict/head guard. Complete-tree reconstruction matches the exact previous feature tree merged with current main 46bce0ce989aae0271e68e5daac5b8a9b0522b87; no unrelated merge edits were found.
Independent review is incomplete. The shared merge delta is planned Low under review-code, but its authenticated CLI prerequisite remains unresolved. No reviewer model ran and no new clean skill artifact was produced. Earlier feature findings and scope qualifications are retained, not converted into a new whole-feature clean vote.
Bounded shared-main validation: the Spark-backend/R2 tests passed 15 cases on each native Windows Python 3.10 and 3.13 stack. The same external test files against the immediate previous main produced six expected failures and nine passing controls per stack. Spark tests use a controlled backend, not an actual Spark cluster; these checks do not cover the whole feature or optional workload matrix.
The exact refreshed Series-target head additionally passed all 12 naming/index/input-preservation/public-fit-predict tests on each native stack. Their max_iter=1 paths are bounded normalization/refit checks, not HPO or sampled-season feasibility coverage.
Fresh gates: 0 unresolved thread(s); explicit current-head Balanced approval recommendation: yes; 10 non-success applicable context(s). Actual current-head workflow holds: Build:in_progress/None. Workflow permission approval is not validation success. No PR approval, foreign-thread mutation or review dismissal was performed.
Posted by thinkall-agent-auto-reviewer
Why are these changes needed?
An unnamed or differently named validation-label Series becomes a separate
column when normalized for time-series forecasting. For training target
sales,an unnamed y_val creates column
0rather thansales. This leaves missingvalidation targets and makes
0a spurious feature; a later publicpredict()call raises
KeyError: 0. Passing the same labels as an array works.Reproduction:
Assign target_names to the temporary Series-derived frame, matching the existing
array branch. Preserve input objects, target dtype and positional row alignment.
No new dependencies or forecasting algorithm changes.
Related issue number
No matching report found in targeted searches. PR #1614 changes timestamp-index
promotion and alignment in nearby code but retains Series-derived column names;
its patch does not address this validation-target mismatch.
Checks
Identical new regressions: 8 failed / 4 passed on main 798cacb, 12 passed
with this patch. Covers three Series names and three feature-index kinds,
input preservation and real fit/predict equivalence with the NumPy path.
New and adjacent time-series data tests: 24 passed.
Full configured pre-commit run passes both changed files, including pinned
Black 23.3.0 and Ruff 0.0.261. git diff --check also passes.
Windows/Python3.12.14, pandas3.0.6, NumPy1.26.4, sklearn1.9.1,
statsmodels0.15.0. Full optional suites and platform/remote CI were not run.
I've used pre-commit to lint the changed files.
I've included the needed regression tests.
I've made sure all remote auto checks have passed (not run yet).
No documentation change is needed for this input-normalization correction.
AI assistance: OpenAI Codex researched, implemented and ran these local checks.
No independent human review, production incident or model-quality gain is claimed.