Skip to content

Commit

Permalink
Add docs for CSRankNorm (microsoft#1032)
Browse files Browse the repository at this point in the history
  • Loading branch information
you-n-g authored Apr 6, 2022
1 parent 55f6e6e commit b6a5bd8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions qlib/data/dataset/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit b6a5bd8

Please sign in to comment.