Python
Hello there, please make sure you have pandas, matplotlib and sklearn installed on your system.
----------------------------------------------------------------------------------------------------------------
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.preprocessing import normalize
def freq_scatter_plot(filename):
df = pd.read_csv(filename)
columns = list(df.columns)
### x, y
x = list(range(len(df.index)))
y = df[columns[-1]].values
## size
marker_size = df[columns[2]].values
## color
colors = {'dos':'y', 'u2r':'g', 'r21':'b',
'probe':'r'}
attack_type = list(df[columns[1]].values)
## set plot
fig = plt.figure(figsize=(10, 5), dpi=100)
ax = fig.add_subplot(1, 1, 1)
for i in range(len(df.index)):
ax.scatter(x[i], y[i],
s=marker_size[i], c=colors[attack_type[i]])
ax.set_xlabel('Attack number detected')
ax.set_ylabel('Attack frequency')
plt.legend(markerscale=0.3)
plt.show()
---------------------------------------------------------------
If you have any doubts please use comment section!
Task description: Cyber security attacks can be grouped into 4 categories: DOS attack, PROBE atta...