-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestplot.py
More file actions
104 lines (76 loc) · 2.8 KB
/
Copy pathtestplot.py
File metadata and controls
104 lines (76 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
###F1
import plotly.express as px
import pandas as pd
# Create sample data
data = {
'knn': [95,77,72,67,62],
'nb': [84,59,46,43,37],
'rf': [99,93,91,88,84],
'dt': [99,94,91,87,84],
'nn': [98,92,89,85,82]
}
df = pd.DataFrame(data)
# Create the box plot
fig = px.box(df, title='Box Plot F1')
fig.update_xaxes(title_text='Classifiers')
fig.update_yaxes(title_text='Scores')
# fig.update_layout(boxmode='overlay', boxgroupgap=.1)
# Display the plot
fig.show()
########################### 222222222222222222
import plotly.express as px
import pandas as pd
# Create sample data
data = {
'2': [95,84,99,99,98],
'3': [77,59,93,94,92],
'4': [72,46,91,91,89],
'5': [67,43,88,87,85],
'6': [62,37,84,84,82]
}
df = pd.DataFrame(data)
# Create the box plot
fig = px.box(df, title='Box Plot F1 of classifiers')
fig.update_xaxes(title_text='# of classes')
fig.update_yaxes(title_text='Scores')
# fig.update_layout(boxmode='overlay', boxgroupgap=.1)
# Display the plot
fig.show()
#######################################################3333333333333333333333
# import plotly.graph_objects as go
# import pandas as pd
# # Create sample data
# data = {
# 'Method': ['Method 1', 'Method 2', 'Method 3', 'Method 4', 'Method 5'],
# 'Precision': [[95,77,74,70,66], [85,61,51,46,40], [99,93,93,90,87], [99,94,91,87,85], [98,92,90,87,83]],
# 'Recall': [[95,77,72,67,62], [86,61,50,47,41], [99,93,91,89,84], [99,94,91,87,84], [99,92,89,85,82]],
# 'F1': [[95,77,72,67,62], [95,77,72,67,62], [84,59,46,43,37], [99,93,91,88,84], [98,92,89,85,82]],
# 'Accuracy': [[95,80,75,72,68], [95,80,75,72,68], [84,61,48,45,39], [99,95,92,90,87], [99,93,91,88,86]]
# }
# df = pd.DataFrame(data)
# # Create the box plots
# fig = go.Figure()
# metrics = ['Precision', 'Recall', 'F1', 'Accuracy']
# for metric in metrics:
# fig.add_trace(go.Box(y=df[metric], x=df['Method'], name=metric, boxpoints='all', jitter=0.5))
# fig.update_layout(
# title='Performance Comparison of Methods for Each Metric',
# xaxis=dict(title='Method'),
# yaxis=dict(title='Score'),
# boxmode='group'
# )
# # Display the plot
# fig.show()
import plotly.express as px
import pandas as pd
# sample data
data = {'Classifiers': ['knn']*5 + ['nb']*5 + ['rf']*5+ ['dt']*5+ ['nn']*5,
'Precision': [95,77,74,70,66,85,61,51,46,40,99,93,93,90,87,99,94,91,87,85,98,92,90,87,83],
'Recall': [95,77,72,67,62,86,61,50,47,41,99,93,91,89,84,99,94,91,87,84,99,92,89,85,82],
'F1': [95,77,72,67,62,84,59,46,43,37,99,93,91,88,84,99,94,91,87,84,98,92,89,85,82],
'Accuracy': [95,80,75,72,68,84,61,48,45,39,99,94,93,91,88,99,95,92,90,87,99,93,91,88,86]}
df = pd.DataFrame(data)
# create boxplot
fig = px.box(df.melt(id_vars='Classifiers'), x='Classifiers', y='value', color='variable')
# show plot
fig.show()