Skip to content

fix: TanhProcess using wrong MultiIndex column level#2171

Open
EdenRochmanSharabi wants to merge 1 commit intomicrosoft:mainfrom
EdenRochmanSharabi:fix/tanh-process-level-index
Open

fix: TanhProcess using wrong MultiIndex column level#2171
EdenRochmanSharabi wants to merge 1 commit intomicrosoft:mainfrom
EdenRochmanSharabi:fix/tanh-process-level-index

Conversation

@EdenRochmanSharabi
Copy link
Copy Markdown

Summary

Fixes #1687

TanhProcess.__call__() uses get_level_values(1) to identify LABEL columns, but LABEL group names appear at level 0 of the MultiIndex, not level 1. This causes the tanh denoising to be incorrectly applied to label columns.

Changes

  • qlib/data/dataset/processor.py: Changed get_level_values(1) to get_level_values(0), and fixed variable reference from df to data for the column mask
  • tests/test_tanh_process.py: Test verifying LABEL columns are untouched while FEATURE columns are tanh-transformed

TanhProcess.tanh_denoise was using get_level_values(1) to find LABEL
columns, but level 0 holds the group names (LABEL0, FEATURE0, etc.).
Changed to get_level_values(0). Also fixed the inner function to
reference "data.columns" instead of the outer "df.columns" for the
non-label column mask.

Fixes microsoft#1687
@EdenRochmanSharabi
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@EdenRochmanSharabi EdenRochmanSharabi changed the title Fix TanhProcess using wrong MultiIndex column level fix: TanhProcess using wrong MultiIndex column level Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

class TanhProcess(Processor) error

1 participant