1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-07 13:00:58 +08:00

[807] Move the REG_CONSTANT/EPS to constant.py. (#811)

* [807] Move the REG_CONSTANT to constant.py.

* import REG_US.

* Move EPS to constant.py.
This commit is contained in:
Chia-hung Tai
2022-01-09 21:39:46 +08:00
committed by GitHub
parent 382ababc01
commit 184ce34a34
26 changed files with 42 additions and 35 deletions

View File

@@ -1,5 +1,6 @@
import numpy as np
import pandas as pd
from qlib.constant import EPS
from qlib.data.dataset.processor import Processor
from qlib.data.dataset.utils import fetch_df_by_index
@@ -27,7 +28,7 @@ class HighFreqNorm(Processor):
part_values = np.log1p(part_values)
self.feature_med[name] = np.nanmedian(part_values)
part_values = part_values - self.feature_med[name]
self.feature_std[name] = np.nanmedian(np.absolute(part_values)) * 1.4826 + 1e-12
self.feature_std[name] = np.nanmedian(np.absolute(part_values)) * 1.4826 + EPS
part_values = part_values / self.feature_std[name]
self.feature_vmax[name] = np.nanmax(part_values)
self.feature_vmin[name] = np.nanmin(part_values)