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

Plot enhancement #1390

Merged
merged 16 commits into from Dec 30, 2022
Merged

Plot enhancement #1390

merged 16 commits into from Dec 30, 2022

Conversation

qianyun210603
Copy link
Contributor

Description

  1. Use rangebreaks parameter in plotly to handle gaps in datetime axises. (Fix # FIXME: support HIGH-FREQ)
  2. Able to plot both IC and RankIC in model_performance_graph.
  3. Horizontally layout the bar plots in risk_analysis_graph for better looking.
    New style
    image
    v.s. Old style
    image
  4. Some improvement in plot style

Motivation and Context

Improve the report graphs.

How Has This Been Tested?

Create a simple fake pred_label df

from pandas.tseries.offsets import CustomBusinessHour
import pandas as pd
import numpy as np
from qlib.contrib.report import analysis_model, analysis_position

cbh = CustomBusinessHour(start=["09:30", "13:00"], end=["11:30", "15:00"])
dt_idx = pd.date_range("2022-12-01", "2022-12-10", freq=cbh)
fake_label_df = pd.DataFrame(np.random.randn(392, 2)*0.01, index=pd.MultiIndex.from_product([dt_idx.to_list(), list("abcdefghigklmn")], names=['datetime', 'instrument']), columns=['label', 'score'])
analysis_model.model_performance_graph(fake_label_df, show_nature_day=False)

see the result as expected
image

Screenshots of Test Results (if appropriate):

  1. Pipeline test:
  2. Your own tests:

Types of changes

  • Fix bugs Enhancement
  • Add new feature
  • Update documentation

@qianyun210603
Copy link
Contributor Author

@you-n-g do you mind review please?

Copy link
Collaborator

@you-n-g you-n-g left a comment

Choose a reason for hiding this comment

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

Thanks.
The new feature and graph look really nice :)

More detailed description

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>
@github-actions github-actions bot added the waiting for triage Cannot auto-triage, wait for triage. label Dec 20, 2022
@qianyun210603
Copy link
Contributor Author

@you-n-g
pytest fails in rl module which looks weird since my change should have nothing to do with it.

@you-n-g you-n-g merged commit 2f5ce3d into microsoft:main Dec 30, 2022
@you-n-g
Copy link
Collaborator

you-n-g commented Dec 30, 2022

Thanks!
It looks great!

@qianyun210603 qianyun210603 deleted the plot_enhancement branch January 2, 2023 07:46
@you-n-g you-n-g added enhancement New feature or request and removed waiting for triage Cannot auto-triage, wait for triage. labels Jan 29, 2023
qianyun210603 added a commit to qianyun210603/qlib that referenced this pull request Mar 23, 2023
* horizontally put the bar figures

* 1) use rangebreaks to handle gaps in datetime axis instead of make them string; 2) allow simultaneously plot rankic in ic_figure

* pylint improvement

* fix black lint

* better axis formatting

* default not show gaps

* resolve doc built error

* fix pylint

* Update qlib/contrib/report/analysis_model/analysis_model_performance.py

More detailed description

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>

* Update qlib/contrib/report/analysis_model/analysis_model_performance.py

for Python backward compatibility

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>

* add doc string

* fix black

* 1) limit numpy version as numba support for 1.24+ has not been released; 2) no need to use custom numba version for pytest.

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>
qianyun210603 added a commit to qianyun210603/qlib that referenced this pull request Mar 23, 2023
* horizontally put the bar figures

* 1) use rangebreaks to handle gaps in datetime axis instead of make them string; 2) allow simultaneously plot rankic in ic_figure

* pylint improvement

* fix black lint

* better axis formatting

* default not show gaps

* resolve doc built error

* fix pylint

* Update qlib/contrib/report/analysis_model/analysis_model_performance.py

More detailed description

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>

* Update qlib/contrib/report/analysis_model/analysis_model_performance.py

for Python backward compatibility

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>

* add doc string

* fix black

* 1) limit numpy version as numba support for 1.24+ has not been released; 2) no need to use custom numba version for pytest.

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>
qianyun210603 added a commit to qianyun210603/qlib that referenced this pull request Mar 23, 2023
* horizontally put the bar figures

* 1) use rangebreaks to handle gaps in datetime axis instead of make them string; 2) allow simultaneously plot rankic in ic_figure

* pylint improvement

* fix black lint

* better axis formatting

* default not show gaps

* resolve doc built error

* fix pylint

* Update qlib/contrib/report/analysis_model/analysis_model_performance.py

More detailed description

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>

* Update qlib/contrib/report/analysis_model/analysis_model_performance.py

for Python backward compatibility

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>

* add doc string

* fix black

* 1) limit numpy version as numba support for 1.24+ has not been released; 2) no need to use custom numba version for pytest.

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants