Spaces:
Sleeping
Sleeping
Create utils/grace_plot.py
Browse files- utils/grace_plot.py +18 -0
utils/grace_plot.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# utils/grace_plot.py
|
2 |
+
import pandas as pd
|
3 |
+
from evaluate.visualization import radar_plot
|
4 |
+
|
5 |
+
def plot_radar():
|
6 |
+
scores = {
|
7 |
+
"Model A": [4.0, 4.5, 3.5, 4.0],
|
8 |
+
"Model B": [3.5, 4.0, 4.0, 3.5]
|
9 |
+
}
|
10 |
+
labels = ["Generalization", "Relevance", "Artistry", "Efficiency"]
|
11 |
+
df = pd.DataFrame(scores, index=labels).T
|
12 |
+
|
13 |
+
data = []
|
14 |
+
for model in df.index:
|
15 |
+
data.append({label: df.loc[model, label] for label in df.columns})
|
16 |
+
fig = radar_plot(data=data, model_names=list(df.index))
|
17 |
+
fig.suptitle("GRACE 模型评估对比图", fontsize=14)
|
18 |
+
return fig
|