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

Add docs for CSRankNorm (#1032)

This commit is contained in:
you-n-g
2022-04-06 19:57:27 +08:00
committed by GitHub
parent 962751c72d
commit 73438807f9

View File

@@ -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):