-
Notifications
You must be signed in to change notification settings - Fork 0
/
results.py
29 lines (24 loc) · 895 Bytes
/
results.py
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
import pandas as pd
# load the data into a dataframe
df = pd.read_csv('Output.csv')
# initialize variables
true_positive = 0
false_positive = 0
false_negative = 0
total_rows = 5196
# iterate over the rows in the dataframe
for index, row in df.iterrows():
# compare the calculated value with the actual value
if row['Output'] == row['Label']:
true_positive += 1
elif row['Output'] == 'DDOS' and row['Label'] == 'Normal':
false_positive += 1
elif row['Output'] == 'Normal' and row['Label'] == 'DDOS':
false_negative += 1
# calculate accuracy and false positive rate
accuracy = true_positive *100/ total_rows
false_positive_rate = false_positive *100/ total_rows
false_negative_rate = false_negative*100 / total_rows
print(f'Accuracy: {accuracy}')
print(f'False positive rate: {false_positive_rate}')
print(f'False negative rate: {false_negative_rate}')