有没有办法在Python中绘制圆形图表(作为目标)?

2024-05-15 02:01:28 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在建立一个人工神经网络,我实现了K-折叠交叉验证,通过这些方法返回的精度的均值和方差来评估模型。你知道吗

现在我想绘制四个圆形图表(作为目标)来“说明”模型所处的偏差-方差权衡类别,这取决于方差和精度的值。你知道吗

在Python中有这样一种方法吗?你知道吗


Tags: 方法模型目标图表绘制精度圆形类别
1条回答
网友
1楼 · 发布于 2024-05-15 02:01:28

我写了一个简单的例子

import numpy as np    
import matplotlib.mlab as mlab    
import matplotlib.pyplot as plt  


labels = ['USA', 'China', 'India', 'Japan', 'Germany', 'Russia', 'Brazil', 'UK', 'France', 'Italy']

quants = [15094025.0, 11299967.0, 4457784.0, 4440376.0, 3099080.0, 2383402.0, 2293954.0, 2260803.0, 2217900.0, 1846950.0]
def draw_pie(labels,quants):

    plt.figure(1, figsize=(6,6))

    # For China, make the piece explode a bit

    expl = [0,0.1,0,0,0,0,0,0,0,0]

    # Colors used. Recycle if not enough.

    colors  = ["blue","red","coral","green","yellow","orange"]

    # autopct: format of "percent" string;

    plt.pie(quants, explode=expl, colors=colors, labels=labels, 
    autopct='%1.1f%%',pctdistance=0.8, shadow=True)

    plt.title('Top 10 GDP Countries', bbox={'facecolor':'0.8', 'pad':5})

    plt.show()

draw_pie(labels,quants)

enter image description here

相关问题 更多 >

    热门问题