quantopian / alphalens

Performance analysis of predictive (alpha) stock factors
http://quantopian.github.io/alphalens
Apache License 2.0
3.39k stars 1.15k forks source link

Dropped 45.5% entries from factor data: 45.5% in forward returns computation and 0.0% in binning phase (set max_loss=0 to see potentially suppressed Exceptions) #390

Closed syejing closed 4 years ago

syejing commented 4 years ago

Problem Description

Please provide a minimal, self-contained, and reproducible example:

factor_data_analysis = utils.get_clean_factor_and_forward_returns(series_facs_datas, df_price_new, max_loss=0)
factor_data_analysis.head()

Please provide the full traceback:

Dropped 45.5% entries from factor data: 45.5% in forward returns computation and 0.0% in binning phase (set max_loss=0 to see potentially suppressed Exceptions).
---------------------------------------------------------------------------
MaxLossExceededError                      Traceback (most recent call last)
<ipython-input-68-50caec2d0c49> in <module>
----> 1 factor_data_analysis = utils.get_clean_factor_and_forward_returns(series_facs_datas, df_price_new, max_loss=0)
      2 factor_data_analysis.head()

d:\Anaconda3\lib\site-packages\alphalens\utils.py in get_clean_factor_and_forward_returns(factor, prices, groupby, binning_by_group, quantiles, bins, periods, filter_zscore, groupby_labels, max_loss, zero_aware, cumulative_returns)
    833     )
    834 
--> 835     factor_data = get_clean_factor(factor, forward_returns, groupby=groupby,
    836                                    groupby_labels=groupby_labels,
    837                                    quantiles=quantiles, bins=bins,

d:\Anaconda3\lib\site-packages\alphalens\utils.py in get_clean_factor(factor, forward_returns, groupby, binning_by_group, quantiles, bins, groupby_labels, max_loss, zero_aware)
    657         message = ("max_loss (%.1f%%) exceeded %.1f%%, consider increasing it."
    658                    % (max_loss * 100, tot_loss * 100))
--> 659         raise MaxLossExceededError(message)
    660     else:
    661         print("max_loss is %.1f%%, not exceeded: OK!" % (max_loss * 100))

MaxLossExceededError: max_loss (0.0%) exceeded 45.5%, consider increasing it.

Please provide any additional information below:

Versions

qpl13 commented 1 month ago

my problem is there are too much na , works fine after I dropped NA