Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement and bugfix in report plots #1413

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

qianyun210603
Copy link
Contributor

@qianyun210603 qianyun210603 commented Jan 9, 2023

Description

  1. allow input custom benchmark return series to compare with group1.
  2. fix stratifying bug: simply using len(x) // N * i : len(x) // N * (i + 1) misses len(x) % N names at end.
  3. force colorbar in monthly ic heat map centers at 0.

Motivation and Context

  1. more convenient to group returns with index.
  2. bug fix.
  3. consider monthly ic series [0.1, -0.1, 0.1, -0.1, 0, 0.1] and [0.3, 0.1, 0.3, 0.1, 0.2, 0.3]. Apparently the former is bad strategy with unstable ic and the latter is good strategy, but if not forcing symmetric color bar, the two gives same heatmap look (except numbers in colour axis), which is not good visualisation.

How Has This Been Tested?

Generated plot locally.

Screenshots of Test Results (if appropriate):

  1. Pipeline test:
  2. Your own tests:
    image
    image

Types of changes

  • Fix bugs and enhancements
  • Add new feature
  • Update documentation

@github-actions github-actions bot added the waiting for triage Cannot auto-triage, wait for triage. label Jan 9, 2023
@qianyun210603
Copy link
Contributor Author

@you-n-g would you review please?

# Long-Average
t_df["long-average"] = t_df["Group1"] - pred_label.groupby(level="datetime")["label"].mean()
# Long-benchmark
benchmark = kwargs.get("benchmark", "average")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to have the benchmark as an explicit input parameter, and we can also add type hints.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed as suggested.

benchmark = pred_label.groupby(level="datetime")["label"].mean()
elif isinstance(benchmark, pd.Series):
benchmark_name = benchmark.name if bool(benchmark.name) else "benchmark"
benchmark = benchmark.reindex(t_df.index)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a high possibility that the user-provided benchmark may not align with t_df.index. Perhaps we can add some common warnings in this case if the DataFrame doesn't have warning messages.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might not be necessary as it should be a common case especially for a global portfolio. Think about using CSI300 to benchmarking a portfolio which invests both A and H shares, for those mainland holidays which are not HK holidays.

@qianyun210603
Copy link
Contributor Author

qianyun210603 commented Sep 7, 2023

any further comments? @Fivele-Li

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for triage Cannot auto-triage, wait for triage.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants