microsoft / microsoft/qlib

class TanhProcess(Processor) error

Open
#1,687 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
48.7k
Forks
7.7k
PR merge metrics
No merged PRs in 30d

Description

🐛 Bug Description

data.columns.get_level_values(1).str.contains("LABEL") is weird.
data.columns.get_level_values(1) will never contain LABEL, but data.columns.get_level_values(0) will.
if you want filter label, why do not use fields_group params?

class TanhProcess(Processor):
"""Use tanh to process noise data"""

def __call__(self, df):
    def tanh_denoise(data):
        mask = data.columns.get_level_values(1).str.contains("LABEL")
        col = df.columns[~mask]
        data[col] = data[col] - 1
        data[col] = np.tanh(data[col])

        return data

    return tanh_denoise(df)

To Reproduce

Steps to reproduce the behavior:

Expected Behavior

Screenshot

Environment

Note: User could run cd scripts && python collect_info.py all under project directory to get system information
and paste them here directly.

  • Qlib version:
  • Python version:
  • OS (Windows, Linux, MacOS):
  • Commit number (optional, please provide it if you are using the dev version):

Additional Notes

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the TanhProcess implementation and inspect how its pandas column levels and fields_group parameters are defined. Reproduce the reported LABEL filtering behavior with the provided class and a representative DataFrame, then confirm the intended label-column selection with a focused test or documented reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.