microsoft / qlib

Qlib is an AI-oriented quantitative investment platform that aims to realize the potential, empower research, and create value using AI technologies in quantitative investment, from exploring ideas to implementing productions. Qlib supports diverse machine learning modeling paradigms. including supervised learning, market dynamics modeling, and RL.
https://qlib.readthedocs.io/en/latest/
MIT License
15.18k stars 2.6k forks source link

Plot not displayed correctly #1293

Closed louyuenan closed 1 year ago

louyuenan commented 2 years ago

I'm new to Qlib and sorry to bother you all。 I have read through the project documentation, and some of the other documents, And it solves many problems, but there is one final step。 After running the final part code, I was unable to successfully Plot

from qlib.contrib.report import analysis_model, analysis_position from qlib.data import D recorder = R.get_recorder(recorder_id=ba_rid, experiment_name="backtest_analysis") pred_df = recorder.load_object("pred.pkl") pred_df_dates = pred_df.index.get_level_values(level="datetime") report_normal_df = recorder.load_object("portfolio_analysis/report_normal_1day.pkl") report_normal_df = report_normal_df.dropna(axis=0) positions = recorder.load_object("portfolio_analysis/positions_normal_1day.pkl") analysis_df = recorder.load_object("portfolio_analysis/port_analysis_1day.pkl")

label_df = dataset.prepare("test", col_set="label") label_df.columns = ['label'] pred_label = pd.concat([label_df, pred_df], axis=1, sort=True).reindex(label_df.index) analysis_position.score_ic_graph(pred_label)

As you can see, after running the code, there are only a few blank lines and no diagrams。 I would be grateful if this issue could be resolved。 By the way, the Environment: python 3.7.13, win11 22621. Spyder 5.2.2 Sincerely, Anani

louyuenan commented 2 years ago

After I realised I can change the show_notebook = False, but it is still not work.

analysis_position.score_ic_graph(pred_label, show_notebook = False) Out[8]: (Figure({ 'data': [{'mode': 'lines+markers', 'name': 'ic', 'type': 'scatter', 'x': array(['2019-01-02', '2019-01-03', '2019-01-04', ..., '2019-12-27', '2019-12-30', '2019-12-31'], dtype=object), 'y': array([ 0.06304291, -0.00694488, 0.03106886, ..., 0.11225604, 0.00061477, 0.15374357])}, {'mode': 'lines+markers', 'name': 'rank_ic', 'type': 'scatter', 'x': array(['2019-01-02', '2019-01-03', '2019-01-04', ..., '2019-12-27', '2019-12-30', '2019-12-31'], dtype=object), 'y': array([ 0.11077022, 0.06731797, 0.06653515, ..., 0.04344722, -0.02958533, 0.09247219])}], 'layout': {'template': {}, 'title': {'text': 'Score IC'}, 'xaxis': {'tickangle': 45, 'type': 'category'}} }),)

SunsetWolf commented 1 year ago

We recommend that you run the program using jupyter notebook, to get Graphical Reports Analysis. It is also mentioned in the documentation: Quick Start/Auto Quant Research Workflow/Graphical Reports Analysis.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for three months with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days