Skip to content

Commit

Permalink
fix readonly reverse bug
Browse files Browse the repository at this point in the history
  • Loading branch information
you-n-g committed Sep 13, 2021
1 parent aea1cae commit 5b62fda
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions qlib/data/dataset/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,15 +442,15 @@ def process_data(self, with_fit: bool = False):
# shared data processors
# 1) assign
_shared_df = self._data
if self._is_proc_readonly(self.shared_processors): # avoid modifying the original data
if not self._is_proc_readonly(self.shared_processors): # avoid modifying the original data
_shared_df = _shared_df.copy()
# 2) process
_shared_df = self._run_proc_l(_shared_df, self.shared_processors, with_fit=with_fit, check_for_infer=True)

# data for inference
# 1) assign
_infer_df = _shared_df
if self._is_proc_readonly(self.infer_processors): # avoid modifying the original data
if not self._is_proc_readonly(self.infer_processors): # avoid modifying the original data
_infer_df = _infer_df.copy()
# 2) process
_infer_df = self._run_proc_l(_infer_df, self.infer_processors, with_fit=with_fit, check_for_infer=True)
Expand All @@ -466,10 +466,10 @@ def process_data(self, with_fit: bool = False):
_learn_df = _infer_df
else:
raise NotImplementedError(f"This type of input is not supported")
if self._is_proc_readonly(self.learn_processors): # avoid modifying the original data
if not self._is_proc_readonly(self.learn_processors): # avoid modifying the original data
_learn_df = _learn_df.copy()
# 2) process
_learn_df = self._is_proc_readonly(self.learn_processors, with_fit=True, check_for_infer=False)
_learn_df = self._run_proc_l(self.learn_processors, with_fit=True, check_for_infer=False)

self._learn = _learn_df

Expand Down

0 comments on commit 5b62fda

Please sign in to comment.