mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-15 16:56:54 +08:00
Add docs for CSRankNorm (#1032)
This commit is contained in:
@@ -318,6 +318,20 @@ class CSRankNorm(Processor):
|
|||||||
The operations across different stocks are often called Cross Sectional Operation.
|
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.
|
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):
|
def __init__(self, fields_group=None):
|
||||||
|
|||||||
Reference in New Issue
Block a user