Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2020-092
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2020 - 092
2020-092
Commits
2e437b26
Commit
2e437b26
authored
Nov 02, 2020
by
U C S Bandara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete temp.py
parent
19912ce6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
81 deletions
+0
-81
temp.py
temp.py
+0
-81
No files found.
temp.py
deleted
100644 → 0
View file @
19912ce6
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
#importing dataset
import
pandas
as
pd
import
matplotlib.pyplot
as
plt
import
numpy
as
np
import
seaborn
as
sn
dataset
=
pd
.
read_csv
(
'DrDoS_NTP.csv'
)
#EDA
dataset
.
head
()
dataset
.
columns
dataset
.
head
dataset
.
describe
()
#cleaning
dataset
.
isna
()
.
any
()
#encoding
dataset
=
pd
.
get_dummies
(
dataset
)
dataset
.
columns
dataset
=
dataset
.
drop
(
columns
=
[
' Timestamp'
,
'Fwd PSH Flags'
,
' Bwd PSH Flags'
,
' Fwd URG Flags'
,
' Bwd URG Flags'
])
#remove extra column
attack_id
=
dataset
[
'Flow ID'
]
d_port
=
dataset
[
' Destination Port'
]
state
=
dataset
[
' Inbound'
]
dataset
=
dataset
.
drop
(
columns
=
[
'Flow ID'
,
' Destination Port'
,
' Inbound'
])
#deviding into traing and testing
from
sklearn.model_selection
import
train_test_split
X_train
,
X_test
,
y_train
,
y_test
=
train_test_split
(
dataset
,
state
,
test_size
=
1
,
random_state
=
0
)
# feture scaling
from
sklearn.preprocessing
import
StandardScaler
sc_X
=
StandardScaler
()
X_train2
=
pd
.
DataFrame
(
sc_X
.
fit_transform
(
X_train
))
X_test2
=
pd
.
DataFrame
(
sc_X
.
transform
(
X_test
))
X_train2
.
columns
=
X_train
.
columns
.
values
X_test2
.
columns
=
X_test
.
columns
.
values
X_train2
.
index
=
X_train
.
index
.
values
X_test2
.
index
=
X_test
.
index
.
values
X_train
=
X_train2
X_test
=
X_test2
## SVM (Linear)
from
sklearn.svm
import
SVC
classifier
=
SVC
(
random_state
=
0
,
kernel
=
'linear'
)
classifier
.
fit
(
X_train
,
y_train
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment