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

fix(wyh): plot function #59

Merged
merged 8 commits into from
Sep 22, 2021
Merged

fix(wyh): plot function #59

merged 8 commits into from
Sep 22, 2021

Conversation

Weiyuhong-1998
Copy link
Contributor

@Weiyuhong-1998 Weiyuhong-1998 commented Sep 17, 2021

Description

增加了plot绘图函数

企业微信截图_16319461385773

Related Issue

TODO

Check List

  • merge the latest version source branch/repo, and resolve all the conflicts
  • pass style check
  • pass all the tests

@PaParaZz1 PaParaZz1 added the enhancement New feature or request label Sep 17, 2021
@codecov
Copy link

codecov bot commented Sep 17, 2021

Codecov Report

Merging #59 (5deb88c) into main (332995e) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #59      +/-   ##
==========================================
+ Coverage   88.96%   88.98%   +0.02%     
==========================================
  Files         351      353       +2     
  Lines       26125    26168      +43     
==========================================
+ Hits        23242    23286      +44     
+ Misses       2883     2882       -1     
Flag Coverage Δ
unittests 88.98% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
ding/utils/plot_helper.py 100.00% <100.00%> (ø)
ding/utils/tests/test_plot.py 100.00% <100.00%> (ø)
ding/worker/learner/comm/flask_fs_learner.py 91.25% <0.00%> (+0.62%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 332995e...5deb88c. Read the comment docs.

Copy link
Member

@PaParaZz1 PaParaZz1 left a comment

Choose a reason for hiding this comment

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

This PR can be merged after solving these comments

plt.ylabel(ylabel)
plt.title(title)
plt.savefig(pth)
plt.show()
Copy link
Member

Choose a reason for hiding this comment

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

remove plt.show, it will lead to error in server.

def test_plot():
rewards1 = np.array([0, 0.1,0,0.2,0.4,0.5,0.6,0.9,0.9,0.9])
rewards2 = np.array([0, 0,0.1,0.4,0.5,0.5,0.55,0.8,0.9,1])
rewards=np.concatenate((rewards1,rewards2)) # 合并数组
Copy link
Member

Choose a reason for hiding this comment

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

Use English comment in code

data1['y']=rewards
data1['label']='line1'

rewards3 = np.array([random.random() for _ in range(10)])
Copy link
Member

Choose a reason for hiding this comment

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

You can use np.random.random here

"""
sns.set(style="darkgrid", font_scale=1.5)
for nowdata in data:
for k,v in nowdata.items():
Copy link
Member

Choose a reason for hiding this comment

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

replace this loop with step, value, label = nowdata['x'], nowdata['y'], nowdata['label']

@@ -0,0 +1,33 @@
import numpy as np
Copy link
Member

Choose a reason for hiding this comment

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

rename this file to plot_helper.py

import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
Copy link
Member

Choose a reason for hiding this comment

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

add seaborn in setup.py, and remember it whenever you import some new packages

@PaParaZz1 PaParaZz1 added this to the Utils and Tools milestone Sep 22, 2021
@PaParaZz1 PaParaZz1 merged commit 48d6c82 into opendilab:main Sep 22, 2021
puyuan1996 pushed a commit to puyuan1996/DI-engine that referenced this pull request Dec 14, 2021
* fix(wyh): plot function

* fix(wyh): plot function pytest

* fix(wyh):plot function modify comments

* feature(wyh):plot style
Co-authored-by: weiyuhong <weiyuhong@sensetime.com>
puyuan1996 pushed a commit to puyuan1996/DI-engine that referenced this pull request Apr 18, 2022
* fix(wyh): plot function

* fix(wyh): plot function pytest

* fix(wyh):plot function modify comments

* feature(wyh):plot style
Co-authored-by: weiyuhong <weiyuhong@sensetime.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.

2 participants