網站首頁 編程語言 正文
基礎代碼
pred_y = test_output.data.numpy() pred_y = pred_y.flatten() print(pred_y, 'prediction number') print(test_y[:355].numpy(), 'real number') ? import matplotlib.pyplot as plt plt.rc("font", family='KaiTi') plt.figure() f, axes = plt.subplots(1, 1) x = np.arange(1, 356) # axes.plot(x , pred_y) axes.scatter(x,pred_y, c='r', marker = 'o') plt.axhline(36.7, c ='g') axes.set_xlabel("位置點位") axes.set_ylabel("預測值") axes.set_title("矯正網絡結果") plt.savefig("result.png") plt.show()
離散圖畫法如上所示。
改進
import matplotlib.pyplot as plt plt.rc("font", family='KaiTi') plt.figure() f, axes = plt.subplots(1, 1) x = np.arange(1, 356) # axes.plot(x , pred_y) axes.scatter(x, pred_y, c='r', marker = 'o') plt.axhline(36.7, c ='g') axes.set_xlabel("位置點位") axes.set_ylabel("預測值") axes.set_title("矯正網絡預測結果") axes.set_ylim((36, 37)) plt.savefig("result.png") plt.show()
再次改進:
import matplotlib.pyplot as plt plt.rc("font", family='KaiTi') plt.figure() f, axes = plt.subplots(1, 1) x = np.arange(1, 356) # axes.plot(x , pred_y) axes.scatter(x, pred_y, c='r', marker = 'o') plt.axhline(36.7, c ='g') axes.set_xlabel("位置點位") axes.set_ylabel("預測值") axes.set_title("矯正網絡預測結果") axes.set_ylim((36, 37)) plt.savefig("result.png") plt.legend(['real', 'predict'], loc='upper left') plt.show()
又次改進:
import matplotlib.pyplot as plt plt.rc("font", family='KaiTi') plt.figure() f, axes = plt.subplots(1, 1) x = np.arange(1, 356) # axes.plot(x , pred_y) axes.scatter(x, pred_y, c='r', s=3, marker = 'o') plt.axhline(36.7, c ='g') axes.set_xlabel("位置點位") axes.set_ylabel("預測值") axes.set_title("矯正網絡預測結果") axes.set_ylim((36, 37)) plt.savefig("result.png") plt.legend(['真實值36.7℃', '預測值'], loc='upper left') plt.show()
改進:----加準確率
import matplotlib.pyplot as plt plt.rc("font", family='KaiTi') plt.figure() f, axes = plt.subplots(1, 1) x = np.arange(1, 356) # axes.plot(x , pred_y) axes.scatter(x, pred_y, c='r', s=3, marker = 'o') plt.axhline(36.7, c ='g') axes.set_xlabel("位置點位") axes.set_ylabel("預測值") axes.set_title("矯正網絡預測結果") axes.set_ylim((36, 37)) plt.savefig("result.png") plt.legend(['真實值36.7℃', '預測值'], loc='upper left') ? row_labels = ['準確率:'] col_labels = ['數值'] table_vals = [['{:.2f}%'.format(v*100)]] row_colors = ['gold'] my_table = plt.table(cellText=table_vals, colWidths=[0.1] * 5, rowLabels=row_labels, rowColours=row_colors, loc='best') plt.show()
原文鏈接:https://blog.csdn.net/weixin_45564943/article/details/123880105
相關推薦
- 2022-02-27 springboot引入依賴lombok但是@Data(lombok的一個注解)仍然爆紅
- 2022-04-10 Python語言實現科學計算器_python
- 2022-05-20 ASP.NET?MVC模式中應用程序結構詳解_基礎應用
- 2023-07-14 react 中redux的使用步驟
- 2022-10-05 python中內置庫os與sys模塊的詳細介紹_python
- 2022-10-06 SQL語句中的ON?DUPLICATE?KEY?UPDATE使用_MsSql
- 2022-08-15 linux交叉編譯依賴包
- 2024-02-27 var、let和const區別
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支