From 73438807f986ed13bb81c4e081f9aed923c1167e Mon Sep 17 00:00:00 2001 From: you-n-g Date: Wed, 6 Apr 2022 19:57:27 +0800 Subject: [PATCH] Add docs for CSRankNorm (#1032) --- qlib/data/dataset/processor.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/qlib/data/dataset/processor.py b/qlib/data/dataset/processor.py index 6381937d3..ff05e11d6 100644 --- a/qlib/data/dataset/processor.py +++ b/qlib/data/dataset/processor.py @@ -318,6 +318,20 @@ class CSRankNorm(Processor): The operations across different stocks are often called Cross Sectional Operation. For example, CSRankNorm is an operation that grouping the data by each day and rank `across` all the stocks in each day. + + Explanation about 3.46 & 0.5 + + .. code-block:: python + + import numpy as np + import pandas as pd + x = np.random.random(10000) # for any variable + x_rank = pd.Series(x).rank(pct=True) # if it is converted to rank, it will be a uniform distributed + x_rank_norm = (x_rank - x_rank.mean()) / x_rank.std() # Normally, we will normalize it to make it like normal distribution + + x_rank.mean() # accounts for 0.5 + 1 / x_rank.std() # accounts for 3.46 + """ def __init__(self, fields_group=None):