mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-10 22:36:55 +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:
@@ -25,6 +25,7 @@ except:
|
||||
from tqdm import tqdm
|
||||
|
||||
from qlib.utils import get_or_create_path
|
||||
from qlib.constant import EPS
|
||||
from qlib.log import get_module_logger
|
||||
from qlib.model.base import Model
|
||||
from qlib.contrib.data.dataset import MTSDatasetH
|
||||
@@ -791,7 +792,7 @@ def minmax_norm(x):
|
||||
xmin = x.min(dim=-1, keepdim=True).values
|
||||
xmax = x.max(dim=-1, keepdim=True).values
|
||||
mask = (xmin == xmax).squeeze()
|
||||
x = (x - xmin) / (xmax - xmin + 1e-12)
|
||||
x = (x - xmin) / (xmax - xmin + EPS)
|
||||
x[mask] = 1
|
||||
return x
|
||||
|
||||
|
||||
Reference in New Issue
Block a user