Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix concat then filter #397

Closed
wants to merge 2 commits into from
Closed

fix concat then filter #397

wants to merge 2 commits into from

Conversation

binlins
Copy link
Contributor

@binlins binlins commented Apr 21, 2021

Description

Motivation and Context

How Has This Been Tested?

  • Pass the test by running: pytest qlib/tests/test_all_pipeline.py under upper directory of qlib.
  • If you are adding a new feature, test on your own test scripts.

Screenshots of Test Results (if appropriate):

  1. Pipeline test:
  2. Your own tests:

Types of changes

  • Fix bugs
  • Add new feature
  • Update documentation

@ghost
Copy link

ghost commented Apr 21, 2021

CLA assistant check
All CLA requirements met.

kwargs['col_set'] = ['filter']
data_filter = super()._prepare_seg(slc=slc, **kwargs)
if kwargs.get('data_key') == DataHandlerLP.DK_L:
col_filter = data_filter['filter']['keep_train']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't hardcode them

if kwargs.get('data_key') == DataHandlerLP.DK_L:
col_filter = data_filter['filter']['keep_train']
elif kwargs.get('data_key') == DataHandlerLP.DK_I:
col_filter = data_filter['filter']['keep_test']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussion....

@@ -470,6 +489,7 @@ def _prepare_seg(self, slc: slice, **kwargs) -> TSDataSampler:

# TSDatasetH will retrieve more data for complete
data = super()._prepare_seg(slice(pad_start, end), **kwargs)
col_filter = _prepare_col_filter(slice(pad_start, end), **kwargs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussion

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

if col_filter[idx2]:
idx_map[idx] = (i, j)
idx += 1
idx2 += 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@@ -279,8 +279,12 @@ def __init__(self, data: pd.DataFrame, start, end, step_len: int, fillna_type: s

# the data type will be changed
# The index of usable data is between start_idx and end_idx
self.start_idx, self.end_idx = self.data.index.slice_locs(start=pd.Timestamp(start), end=pd.Timestamp(end))
self.idx_df, self.idx_map = self.build_index(self.data)
if col_filter is None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

notice padding

@@ -470,6 +489,7 @@ def _prepare_seg(self, slc: slice, **kwargs) -> TSDataSampler:

# TSDatasetH will retrieve more data for complete
data = super()._prepare_seg(slice(pad_start, end), **kwargs)
col_filter = _prepare_col_filter(slice(pad_start, end), **kwargs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@you-n-g
Copy link
Collaborator

you-n-g commented May 23, 2021

Closed due to the same feature merged in #290

@you-n-g you-n-g closed this May 23, 2021
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.

2 participants