Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-AIEngine
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
Operations
Operations
Metrics
Environments
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
OpenXG
OpenXG-AIEngine
Commits
fe3aad70
Commit
fe3aad70
authored
Dec 20, 2022
by
zcq98
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flow type classification
parent
11a5ba5d
Changes
31
Show whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
1582 additions
and
0 deletions
+1582
-0
measurement/oaiflowclassification/.gitignore
measurement/oaiflowclassification/.gitignore
+3
-0
measurement/oaiflowclassification/classify.py
measurement/oaiflowclassification/classify.py
+274
-0
measurement/oaiflowclassification/classify/instances/AR.pkl
measurement/oaiflowclassification/classify/instances/AR.pkl
+0
-0
measurement/oaiflowclassification/classify/instances/iot.pkl
measurement/oaiflowclassification/classify/instances/iot.pkl
+0
-0
measurement/oaiflowclassification/classify/instances/video.pkl
...rement/oaiflowclassification/classify/instances/video.pkl
+0
-0
measurement/oaiflowclassification/classify/instances/voip.pkl
...urement/oaiflowclassification/classify/instances/voip.pkl
+0
-0
measurement/oaiflowclassification/classify/models/dt2.pkl
measurement/oaiflowclassification/classify/models/dt2.pkl
+0
-0
measurement/oaiflowclassification/classify/models/dt2.pkl.bk
measurement/oaiflowclassification/classify/models/dt2.pkl.bk
+0
-0
measurement/oaiflowclassification/classify/models/dt2_9.pkl
measurement/oaiflowclassification/classify/models/dt2_9.pkl
+0
-0
measurement/oaiflowclassification/classify/predict/predict.pkl
...rement/oaiflowclassification/classify/predict/predict.pkl
+0
-0
measurement/oaiflowclassification/classify/predict/predict2.pkl
...ement/oaiflowclassification/classify/predict/predict2.pkl
+0
-0
measurement/oaiflowclassification/classify/result/classify_result.json
...aiflowclassification/classify/result/classify_result.json
+1
-0
measurement/oaiflowclassification/common_utils.py
measurement/oaiflowclassification/common_utils.py
+111
-0
measurement/oaiflowclassification/database/measure.sql
measurement/oaiflowclassification/database/measure.sql
+85
-0
measurement/oaiflowclassification/database/test.py
measurement/oaiflowclassification/database/test.py
+12
-0
measurement/oaiflowclassification/instructions.txt
measurement/oaiflowclassification/instructions.txt
+49
-0
measurement/oaiflowclassification/main.py
measurement/oaiflowclassification/main.py
+73
-0
measurement/oaiflowclassification/model.py
measurement/oaiflowclassification/model.py
+89
-0
measurement/oaiflowclassification/multithread_client.py
measurement/oaiflowclassification/multithread_client.py
+101
-0
measurement/oaiflowclassification/multithread_server.py
measurement/oaiflowclassification/multithread_server.py
+140
-0
measurement/oaiflowclassification/oai_client/multithread_client.py
...nt/oaiflowclassification/oai_client/multithread_client.py
+101
-0
measurement/oaiflowclassification/path_utils.py
measurement/oaiflowclassification/path_utils.py
+12
-0
measurement/oaiflowclassification/pool.py
measurement/oaiflowclassification/pool.py
+55
-0
measurement/oaiflowclassification/predict.py
measurement/oaiflowclassification/predict.py
+146
-0
measurement/oaiflowclassification/process_bar.py
measurement/oaiflowclassification/process_bar.py
+25
-0
measurement/oaiflowclassification/requirement.txt
measurement/oaiflowclassification/requirement.txt
+5
-0
measurement/oaiflowclassification/save_result.py
measurement/oaiflowclassification/save_result.py
+68
-0
measurement/oaiflowclassification/scripts/init.sh
measurement/oaiflowclassification/scripts/init.sh
+35
-0
measurement/oaiflowclassification/scripts/run.sh
measurement/oaiflowclassification/scripts/run.sh
+20
-0
measurement/oaiflowclassification/test.txt
measurement/oaiflowclassification/test.txt
+29
-0
measurement/oaiflowclassification/train.py
measurement/oaiflowclassification/train.py
+148
-0
No files found.
measurement/oaiflowclassification/.gitignore
0 → 100644
View file @
fe3aad70
__pycache__
oai_client/__pycache__
.py38
\ No newline at end of file
measurement/oaiflowclassification/classify.py
0 → 100644
View file @
fe3aad70
"""
预测函数:随机森林
每次运行前,检查:
四个需要修改的地方,命名是否正确
最后的运行模式是否正确
做预测
1. 直接使用之前的模型做预测 分类结果和五元组封装起来
2. 做一个线程池 多线程接收发送来的特征信息
"""
from
common_utils
import
*
# 修改了
from
argparse
import
ArgumentParser
from
collections
import
namedtuple
from
typing
import
List
,
Dict
from
datetime
import
datetime
from
path_utils
import
get_prj_root
import
numpy
as
np
# from sklearn.externals import joblib
import
joblib
import
pprint
import
socket
import
string
from
sklearn.ensemble
import
RandomForestClassifier
# 训练模型
random
.
seed
(
datetime
.
now
())
model_dir
=
os
.
path
.
join
(
get_prj_root
(),
"classify/models"
)
# 修改:模型model文件夹路径
predict_model_pkl
=
os
.
path
.
join
(
model_dir
,
"dt2.pkl"
)
# 修改:模型的版本,只用修改此处就行
Instance
=
namedtuple
(
"Instance"
,
[
"features"
,
"label"
])
# 实例
dirs
=
{
"video"
:
"./tmp/dt/video"
,
"iot"
:
"./tmp/dt/iot"
,
"voip"
:
"./tmp/dt/voip"
,
"AR"
:
"./tmp/dt/AR"
,
}
instances_dir
=
os
.
path
.
join
(
get_prj_root
(),
"classify/instances"
)
# 修改:instances路径
# 通过元组测试
test_flow
=
(
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
6
,
10
)
test_flow2
=
[
221.0
,
1350.0
,
640.0
,
376.26798960315506
,
543.0
,
21257877.349853516
,
4793407917.022705
,
1263437211.5135193
,
2039103758.0566826
,
119541525.84075928
]
def
train_and_predict
():
iot
=
load_pkl
(
os
.
path
.
join
(
instances_dir
,
"iot.pkl"
))
# 不同实例的pkl是不同特征的
videos
=
load_pkl
(
os
.
path
.
join
(
instances_dir
,
"video.pkl"
))
voip
=
load_pkl
(
os
.
path
.
join
(
instances_dir
,
"voip.pkl"
))
AR
=
load_pkl
(
os
.
path
.
join
(
instances_dir
,
"AR.pkl"
))
for
i
in
videos
:
assert
i
.
label
==
0
for
i
in
iot
:
assert
i
.
label
==
1
for
i
in
voip
:
assert
i
.
label
==
2
for
i
in
AR
:
assert
i
.
label
==
3
# print(videos)
debug
(
"# iot instances {}"
.
format
(
len
(
iot
)))
debug
(
"# video instances {}"
.
format
(
len
(
videos
)))
debug
(
"# VOIP instances {}"
.
format
(
len
(
voip
)))
debug
(
"# AR instances {}"
.
format
(
len
(
AR
)))
random
.
shuffle
(
voip
)
# 打乱排序
random
.
shuffle
(
iot
)
random
.
shuffle
(
videos
)
random
.
shuffle
(
AR
)
n_video_train
=
int
(
len
(
videos
)
*
0.7
)
n_video_test
=
len
(
videos
)
-
n_video_train
video_train
=
videos
[:
n_video_train
]
video_test
=
videos
[
n_video_train
:]
iot_train
=
iot
[:
n_video_train
]
iot_test
=
iot
[
len
(
iot
)
-
len
(
video_test
):]
voip_train
=
voip
[:
n_video_train
]
voip_test
=
voip
[
len
(
voip
)
-
len
(
video_test
):]
AR_train
=
AR
[:
n_video_train
]
AR_test
=
AR
[
len
(
AR
)
-
len
(
video_test
):]
info
(
"#video train {}"
.
format
(
len
(
video_train
)))
info
(
"#iot train {}"
.
format
(
len
(
iot_train
)))
info
(
"#voip train {}"
.
format
(
len
(
voip_train
)))
info
(
"#AR train {}"
.
format
(
len
(
AR_train
)))
train
=
[]
train
.
extend
(
iot_train
)
train
.
extend
(
video_train
)
train
.
extend
(
voip_train
)
train
.
extend
(
AR_train
)
random
.
shuffle
(
train
)
train_x
=
[
x
.
features
for
x
in
train
]
train_y
=
[
x
.
label
for
x
in
train
]
# test 1:1
test
=
[]
info
(
"#video test {}"
.
format
(
len
(
video_test
)))
info
(
"#iot test {}"
.
format
(
len
(
iot_test
)))
info
(
"#voip test {}"
.
format
(
len
(
voip_test
)))
info
(
"#AR test {}"
.
format
(
len
(
AR_test
)))
test
.
extend
(
video_test
)
test
.
extend
(
iot_test
)
test
.
extend
(
voip_test
)
test
.
extend
(
AR_test
)
random
.
shuffle
(
test
)
test_x
=
[
t
.
features
for
t
in
test
]
test_y
=
[
t
.
label
for
t
in
test
]
# 训练以及预测
predict_model
=
RandomForestClassifier
(
oob_score
=
True
)
# 引入训练方法
predict_model
.
fit
(
train_x
,
train_y
)
# 队训练数据进行拟合
predicts
=
predict_model
.
predict
(
test_x
)
"""
dt = DT()
dt.fit((train_x, train_y))
predicts = dt.predict(test_x)
"""
"""
# 打印预测的结果
print(predicts)
print("-------------------------------")
"""
# 保存模型
fn_name
=
os
.
path
.
join
(
model_dir
,
predict_model_pkl
)
joblib
.
dump
(
predict_model
,
predict_model_pkl
)
# 评价模型
count
=
0
for
idx
in
range
(
len
(
test_x
)):
if
int
(
predicts
[
idx
])
==
int
(
test_y
[
idx
]):
count
+=
1
# print(count / len(test_x))
return
count
/
len
(
test_x
)
def
classify_flows
(
mode
:
'int'
,
predict_dir
):
"""
该函数用于训练模型并且测试模型的准确度 或者 预测结果
:param mode: 0--训练模型 1--预测和分类流并返回
:param predict_dir: 待预测的流的目录下的pkl文件
:return: 待分类的流的分类结果列表
"""
# 判断是只训练模型 还是 只是预测结果
if
mode
==
0
:
# 此时训练使用数据训练模型 并且 保存模型 评价模型
times
=
10
sum_predict
=
0
for
_
in
range
(
times
):
res
=
train_and_predict
()
sum_predict
=
sum_predict
+
res
print
(
"模型准确率为:"
,
sum_predict
/
times
)
else
:
# 使用传递的文件来预测结果并且返回
predict
=
load_pkl
(
os
.
path
.
join
(
predict_dir
,
"predict2.pkl"
))
test
=
[]
info
(
"#video test {}"
.
format
(
len
(
predict
)))
test
.
extend
(
predict
)
# random.shuffle(test)
test_x
=
[
t
.
features
for
t
in
test
]
predict_model
=
joblib
.
load
(
predict_model_pkl
)
predict_result
=
predict_model
.
predict
(
test_x
)
res_list
=
identify_classification
(
predict_result
)
return
res_list
def
classify_flow_list
(
flow_list
):
"""
该方法用于分类为元组的流
格式:[[1, 2, 3, 4, 5, 6, 7, 8, 6, 10], ["五元组"]]
"""
test_x
=
[
flow_list
[
0
]]
predict_model
=
joblib
.
load
(
predict_model_pkl
)
predict_result
=
predict_model
.
predict
(
test_x
)
# 定义结果的变量 res = ["五元组", "分类结果"]
res
=
[]
res
.
append
(
flow_list
[
1
][
0
])
# 得到字符串的结果
if
predict_result
==
0
:
res
.
append
(
"videos"
)
elif
predict_result
==
1
:
res
.
append
(
"iot"
)
elif
predict_result
==
2
:
res
.
append
(
"voip"
)
else
:
res
.
append
(
"AR"
)
return
res
def
change_result_to_integer_list
(
result_list
):
# 将这个格式 res = ["五元组", "分类结果"] 改为[srcIP, dstIP, srcPort, dstPort, protocol, flowType]
integer_list
=
[]
string_list
=
result_list
[
0
].
split
()
# 添加源ip 转换为int的
integer_list
.
append
(
ipToLong
(
string_list
[
0
]))
# 添加目的ip 转换为int的
integer_list
.
append
(
ipToLong
(
string_list
[
1
]))
# 添加源端口 转换为int的
integer_list
.
append
(
int
(
string_list
[
2
]))
# 添加目的端口 转换为int的
integer_list
.
append
(
int
(
string_list
[
3
]))
# 添加协议类型
#if string_list[4] == 'TCP':
# integer_list.append(1)
#elif string_list[4] == 'UDP':
# integer_list.append(2)
integer_list
.
append
(
int
(
string_list
[
4
]))
# 添加分类结果
integer_list
.
append
(
result_list
[
1
])
return
integer_list
#将字符串形式的ip地址转成整数类型。
def
ipToLong
(
ip_str
):
#print map(int,ip_str.split('.'))
ip_long
=
0
for
index
,
value
in
enumerate
(
reversed
([
int
(
x
)
for
x
in
ip_str
.
split
(
'.'
)])):
ip_long
+=
value
<<
(
8
*
index
)
return
ip_long
def
identify_classification
(
predict_result
):
"""
该函数将分类结果的标签转换为具体内容字符串的结果
:param predict_result:标签分类结果
:return: 字符串分类结果
"""
res_list
=
[]
for
label
in
predict_result
:
if
label
==
0
:
res_list
.
append
(
"videos"
)
elif
label
==
1
:
res_list
.
append
(
"iot"
)
elif
label
==
2
:
res_list
.
append
(
"voip"
)
elif
label
==
3
:
res_list
.
append
(
"AR"
)
return
res_list
if
__name__
==
'__main__'
:
"""
测试 格式转换
# 训练模型
# classify_flows(mode=0, path=instances_dir)
# 预测结果
predict_dir = os.path.join(get_prj_root(), "classify/predict") # 修改:instances路径
predict_result_list = classify_flows(mode=1, predict_dir=predict_dir)
pprint.pprint(predict_result_list)
"""
list1
=
[
'54.52.52.53 51.49.50.44 8242 12596 UDP'
,
'iot'
]
res
=
change_result_to_integer_list
(
list1
)
print
(
res
)
measurement/oaiflowclassification/classify/instances/AR.pkl
0 → 100644
View file @
fe3aad70
File added
measurement/oaiflowclassification/classify/instances/iot.pkl
0 → 100644
View file @
fe3aad70
File added
measurement/oaiflowclassification/classify/instances/video.pkl
0 → 100644
View file @
fe3aad70
File added
measurement/oaiflowclassification/classify/instances/voip.pkl
0 → 100644
View file @
fe3aad70
File added
measurement/oaiflowclassification/classify/models/dt2.pkl
0 → 100644
View file @
fe3aad70
File added
measurement/oaiflowclassification/classify/models/dt2.pkl.bk
0 → 100644
View file @
fe3aad70
File added
measurement/oaiflowclassification/classify/models/dt2_9.pkl
0 → 100644
View file @
fe3aad70
File added
measurement/oaiflowclassification/classify/predict/predict.pkl
0 → 100644
View file @
fe3aad70
File added
measurement/oaiflowclassification/classify/predict/predict2.pkl
0 → 100644
View file @
fe3aad70
File added
measurement/oaiflowclassification/classify/result/classify_result.json
0 → 100644
View file @
fe3aad70
{
"1"
:
"videos"
,
"2"
:
"videos"
,
"3"
:
"videos"
,
"4"
:
"videos"
,
"5"
:
"videos"
,
"6"
:
"videos"
,
"7"
:
"videos"
,
"8"
:
"videos"
,
"9"
:
"videos"
,
"10"
:
"videos"
,
"11"
:
"videos"
,
"12"
:
"videos"
,
"13"
:
"videos"
,
"14"
:
"videos"
,
"15"
:
"videos"
,
"16"
:
"videos"
,
"17"
:
"videos"
,
"18"
:
"videos"
,
"19"
:
"videos"
,
"20"
:
"videos"
,
"21"
:
"videos"
,
"22"
:
"videos"
,
"23"
:
"videos"
,
"24"
:
"videos"
,
"25"
:
"videos"
,
"26"
:
"videos"
,
"27"
:
"videos"
,
"28"
:
"videos"
,
"29"
:
"videos"
,
"30"
:
"videos"
,
"31"
:
"videos"
,
"32"
:
"videos"
,
"33"
:
"videos"
,
"34"
:
"videos"
,
"35"
:
"videos"
,
"36"
:
"videos"
,
"37"
:
"videos"
,
"38"
:
"videos"
,
"39"
:
"videos"
,
"40"
:
"videos"
,
"41"
:
"videos"
,
"42"
:
"videos"
,
"43"
:
"videos"
,
"44"
:
"videos"
,
"45"
:
"videos"
,
"46"
:
"videos"
,
"47"
:
"videos"
,
"48"
:
"videos"
,
"49"
:
"videos"
,
"50"
:
"videos"
,
"51"
:
"videos"
,
"52"
:
"videos"
,
"53"
:
"videos"
,
"54"
:
"videos"
,
"55"
:
"videos"
,
"56"
:
"videos"
,
"57"
:
"videos"
,
"58"
:
"videos"
,
"59"
:
"videos"
,
"60"
:
"videos"
,
"61"
:
"videos"
,
"62"
:
"videos"
,
"63"
:
"videos"
,
"64"
:
"videos"
,
"65"
:
"videos"
,
"66"
:
"videos"
,
"67"
:
"videos"
,
"68"
:
"videos"
,
"69"
:
"videos"
,
"70"
:
"videos"
,
"71"
:
"videos"
,
"72"
:
"videos"
,
"73"
:
"videos"
,
"74"
:
"videos"
,
"75"
:
"videos"
,
"76"
:
"videos"
,
"77"
:
"videos"
,
"78"
:
"videos"
,
"79"
:
"videos"
,
"80"
:
"videos"
,
"81"
:
"videos"
,
"82"
:
"videos"
,
"83"
:
"videos"
,
"84"
:
"videos"
,
"85"
:
"videos"
,
"86"
:
"videos"
,
"87"
:
"videos"
,
"88"
:
"videos"
,
"89"
:
"videos"
,
"90"
:
"videos"
,
"91"
:
"videos"
,
"92"
:
"videos"
,
"93"
:
"videos"
,
"94"
:
"videos"
,
"95"
:
"videos"
,
"96"
:
"videos"
,
"97"
:
"videos"
,
"98"
:
"videos"
,
"99"
:
"videos"
,
"100"
:
"videos"
,
"101"
:
"videos"
,
"102"
:
"videos"
,
"103"
:
"videos"
,
"104"
:
"videos"
,
"105"
:
"videos"
,
"106"
:
"videos"
,
"107"
:
"videos"
,
"108"
:
"videos"
,
"109"
:
"videos"
,
"110"
:
"videos"
,
"111"
:
"videos"
,
"112"
:
"videos"
,
"113"
:
"videos"
,
"114"
:
"videos"
,
"115"
:
"videos"
,
"116"
:
"videos"
,
"117"
:
"videos"
,
"118"
:
"videos"
,
"119"
:
"videos"
,
"120"
:
"videos"
,
"121"
:
"videos"
,
"122"
:
"videos"
,
"123"
:
"videos"
,
"124"
:
"videos"
,
"125"
:
"videos"
,
"126"
:
"videos"
,
"127"
:
"videos"
,
"128"
:
"videos"
,
"129"
:
"videos"
,
"130"
:
"videos"
,
"131"
:
"videos"
,
"132"
:
"videos"
,
"133"
:
"videos"
,
"134"
:
"videos"
,
"135"
:
"videos"
,
"136"
:
"videos"
,
"137"
:
"videos"
,
"138"
:
"videos"
,
"139"
:
"videos"
,
"140"
:
"videos"
,
"141"
:
"videos"
,
"142"
:
"videos"
,
"143"
:
"videos"
,
"144"
:
"voip"
,
"145"
:
"videos"
,
"146"
:
"videos"
,
"147"
:
"videos"
,
"148"
:
"videos"
,
"149"
:
"videos"
,
"150"
:
"videos"
,
"151"
:
"videos"
,
"152"
:
"videos"
,
"153"
:
"videos"
,
"154"
:
"videos"
,
"155"
:
"videos"
,
"156"
:
"videos"
,
"157"
:
"videos"
,
"158"
:
"videos"
,
"159"
:
"videos"
,
"160"
:
"videos"
,
"161"
:
"videos"
,
"162"
:
"videos"
,
"163"
:
"videos"
,
"164"
:
"videos"
,
"165"
:
"videos"
,
"166"
:
"videos"
,
"167"
:
"videos"
,
"168"
:
"videos"
,
"169"
:
"videos"
,
"170"
:
"videos"
,
"171"
:
"videos"
,
"172"
:
"videos"
,
"173"
:
"videos"
,
"174"
:
"videos"
,
"175"
:
"videos"
,
"176"
:
"videos"
,
"177"
:
"videos"
,
"178"
:
"videos"
,
"179"
:
"videos"
,
"180"
:
"videos"
,
"181"
:
"videos"
,
"182"
:
"videos"
,
"183"
:
"videos"
,
"184"
:
"videos"
,
"185"
:
"videos"
,
"186"
:
"videos"
,
"187"
:
"videos"
,
"188"
:
"videos"
,
"189"
:
"videos"
,
"190"
:
"videos"
,
"191"
:
"videos"
,
"192"
:
"videos"
,
"193"
:
"videos"
,
"194"
:
"videos"
,
"195"
:
"videos"
,
"196"
:
"videos"
,
"197"
:
"videos"
,
"198"
:
"videos"
,
"199"
:
"videos"
,
"200"
:
"videos"
,
"201"
:
"videos"
,
"202"
:
"videos"
,
"203"
:
"videos"
,
"204"
:
"videos"
,
"205"
:
"videos"
,
"206"
:
"videos"
,
"207"
:
"videos"
,
"208"
:
"videos"
,
"209"
:
"videos"
,
"210"
:
"videos"
,
"211"
:
"videos"
,
"212"
:
"videos"
,
"213"
:
"videos"
,
"214"
:
"videos"
,
"215"
:
"videos"
,
"216"
:
"videos"
,
"217"
:
"videos"
,
"218"
:
"videos"
,
"219"
:
"videos"
,
"220"
:
"videos"
,
"221"
:
"videos"
,
"222"
:
"videos"
,
"223"
:
"videos"
,
"224"
:
"videos"
,
"225"
:
"videos"
,
"226"
:
"videos"
,
"227"
:
"videos"
,
"228"
:
"videos"
,
"229"
:
"videos"
,
"230"
:
"videos"
,
"231"
:
"videos"
,
"232"
:
"videos"
,
"233"
:
"videos"
,
"234"
:
"videos"
,
"235"
:
"videos"
,
"236"
:
"videos"
,
"237"
:
"videos"
,
"238"
:
"videos"
,
"239"
:
"videos"
,
"240"
:
"videos"
,
"241"
:
"videos"
,
"242"
:
"videos"
,
"243"
:
"videos"
,
"244"
:
"videos"
,
"245"
:
"videos"
,
"246"
:
"videos"
,
"247"
:
"videos"
,
"248"
:
"videos"
,
"249"
:
"videos"
,
"250"
:
"videos"
,
"251"
:
"videos"
,
"252"
:
"videos"
,
"253"
:
"videos"
,
"254"
:
"videos"
,
"255"
:
"videos"
,
"256"
:
"videos"
,
"257"
:
"videos"
,
"258"
:
"videos"
,
"259"
:
"videos"
,
"260"
:
"videos"
,
"261"
:
"videos"
,
"262"
:
"videos"
,
"263"
:
"videos"
,
"264"
:
"videos"
,
"265"
:
"videos"
,
"266"
:
"videos"
,
"267"
:
"videos"
,
"268"
:
"videos"
,
"269"
:
"videos"
,
"270"
:
"videos"
,
"271"
:
"videos"
,
"272"
:
"videos"
,
"273"
:
"videos"
,
"274"
:
"videos"
,
"275"
:
"videos"
,
"276"
:
"videos"
,
"277"
:
"videos"
,
"278"
:
"videos"
,
"279"
:
"videos"
,
"280"
:
"videos"
,
"281"
:
"videos"
,
"282"
:
"videos"
,
"283"
:
"videos"
,
"284"
:
"videos"
,
"285"
:
"videos"
,
"286"
:
"videos"
,
"287"
:
"videos"
,
"288"
:
"videos"
,
"289"
:
"videos"
,
"290"
:
"videos"
,
"291"
:
"videos"
,
"292"
:
"videos"
,
"293"
:
"videos"
,
"294"
:
"videos"
,
"295"
:
"videos"
,
"296"
:
"videos"
,
"297"
:
"videos"
,
"298"
:
"videos"
,
"299"
:
"videos"
,
"300"
:
"videos"
,
"301"
:
"videos"
,
"302"
:
"videos"
,
"303"
:
"videos"
,
"304"
:
"videos"
,
"305"
:
"videos"
,
"306"
:
"videos"
,
"307"
:
"videos"
,
"308"
:
"videos"
,
"309"
:
"videos"
,
"310"
:
"videos"
,
"311"
:
"videos"
,
"312"
:
"videos"
,
"313"
:
"videos"
,
"314"
:
"videos"
,
"315"
:
"videos"
,
"316"
:
"videos"
,
"317"
:
"videos"
,
"318"
:
"videos"
,
"319"
:
"videos"
,
"320"
:
"videos"
,
"321"
:
"videos"
,
"322"
:
"videos"
,
"323"
:
"videos"
,
"324"
:
"videos"
,
"325"
:
"videos"
,
"326"
:
"videos"
,
"327"
:
"videos"
,
"328"
:
"videos"
,
"329"
:
"videos"
,
"330"
:
"videos"
,
"331"
:
"videos"
,
"332"
:
"videos"
,
"333"
:
"videos"
,
"334"
:
"videos"
,
"335"
:
"videos"
,
"336"
:
"videos"
,
"337"
:
"videos"
,
"338"
:
"videos"
,
"339"
:
"videos"
,
"340"
:
"videos"
,
"341"
:
"videos"
,
"342"
:
"videos"
,
"343"
:
"videos"
,
"344"
:
"voip"
,
"345"
:
"videos"
,
"346"
:
"videos"
,
"347"
:
"videos"
,
"348"
:
"videos"
,
"349"
:
"videos"
,
"350"
:
"videos"
,
"351"
:
"videos"
,
"352"
:
"videos"
,
"353"
:
"videos"
,
"354"
:
"videos"
,
"355"
:
"videos"
,
"356"
:
"videos"
,
"357"
:
"videos"
,
"358"
:
"voip"
,
"359"
:
"voip"
,
"360"
:
"videos"
,
"361"
:
"videos"
,
"362"
:
"videos"
,
"363"
:
"videos"
,
"364"
:
"videos"
,
"365"
:
"videos"
,
"366"
:
"videos"
,
"367"
:
"videos"
,
"368"
:
"videos"
,
"369"
:
"videos"
,
"370"
:
"videos"
,
"371"
:
"videos"
,
"372"
:
"videos"
,
"373"
:
"videos"
,
"374"
:
"videos"
,
"375"
:
"videos"
,
"376"
:
"videos"
,
"377"
:
"videos"
,
"378"
:
"videos"
,
"379"
:
"videos"
,
"380"
:
"videos"
,
"381"
:
"videos"
,
"382"
:
"videos"
,
"383"
:
"videos"
,
"384"
:
"voip"
,
"385"
:
"videos"
,
"386"
:
"videos"
,
"387"
:
"videos"
,
"388"
:
"videos"
,
"389"
:
"videos"
,
"390"
:
"videos"
,
"391"
:
"videos"
,
"392"
:
"videos"
,
"393"
:
"videos"
,
"394"
:
"videos"
,
"395"
:
"videos"
,
"396"
:
"videos"
,
"397"
:
"videos"
,
"398"
:
"videos"
,
"399"
:
"videos"
,
"400"
:
"videos"
,
"401"
:
"videos"
,
"402"
:
"videos"
,
"403"
:
"videos"
,
"404"
:
"videos"
,
"405"
:
"videos"
,
"406"
:
"videos"
,
"407"
:
"videos"
,
"408"
:
"videos"
,
"409"
:
"videos"
,
"410"
:
"videos"
,
"411"
:
"videos"
,
"412"
:
"videos"
,
"413"
:
"videos"
,
"414"
:
"videos"
,
"415"
:
"videos"
,
"416"
:
"videos"
,
"417"
:
"videos"
,
"418"
:
"videos"
,
"419"
:
"videos"
,
"420"
:
"videos"
,
"421"
:
"videos"
,
"422"
:
"videos"
,
"423"
:
"videos"
,
"424"
:
"videos"
,
"425"
:
"videos"
,
"426"
:
"videos"
,
"427"
:
"videos"
,
"428"
:
"videos"
,
"429"
:
"videos"
,
"430"
:
"videos"
,
"431"
:
"videos"
,
"432"
:
"videos"
,
"433"
:
"videos"
,
"434"
:
"iot"
,
"435"
:
"videos"
,
"436"
:
"videos"
,
"437"
:
"videos"
,
"438"
:
"videos"
,
"439"
:
"videos"
,
"440"
:
"videos"
,
"441"
:
"videos"
,
"442"
:
"videos"
,
"443"
:
"videos"
,
"444"
:
"videos"
,
"445"
:
"videos"
,
"446"
:
"videos"
,
"447"
:
"videos"
,
"448"
:
"videos"
,
"449"
:
"videos"
,
"450"
:
"videos"
,
"451"
:
"videos"
,
"452"
:
"videos"
,
"453"
:
"videos"
,
"454"
:
"videos"
,
"455"
:
"videos"
,
"456"
:
"videos"
,
"457"
:
"videos"
,
"458"
:
"videos"
,
"459"
:
"videos"
,
"460"
:
"videos"
,
"461"
:
"videos"
,
"462"
:
"voip"
,
"463"
:
"videos"
,
"464"
:
"videos"
,
"465"
:
"videos"
,
"466"
:
"videos"
,
"467"
:
"videos"
,
"468"
:
"videos"
,
"469"
:
"videos"
,
"470"
:
"videos"
,
"471"
:
"videos"
,
"472"
:
"videos"
,
"473"
:
"videos"
,
"474"
:
"videos"
,
"475"
:
"videos"
,
"476"
:
"videos"
,
"477"
:
"videos"
,
"478"
:
"videos"
,
"479"
:
"videos"
,
"480"
:
"videos"
,
"481"
:
"videos"
,
"482"
:
"videos"
,
"483"
:
"videos"
,
"484"
:
"videos"
,
"485"
:
"videos"
,
"486"
:
"videos"
,
"487"
:
"videos"
,
"488"
:
"videos"
,
"489"
:
"videos"
,
"490"
:
"videos"
,
"491"
:
"videos"
,
"492"
:
"videos"
,
"493"
:
"videos"
,
"494"
:
"videos"
,
"495"
:
"videos"
,
"496"
:
"videos"
,
"497"
:
"videos"
,
"498"
:
"videos"
,
"499"
:
"videos"
,
"500"
:
"videos"
,
"501"
:
"videos"
,
"502"
:
"videos"
,
"503"
:
"videos"
,
"504"
:
"videos"
,
"505"
:
"videos"
,
"506"
:
"videos"
,
"507"
:
"videos"
,
"508"
:
"videos"
,
"509"
:
"videos"
,
"510"
:
"videos"
,
"511"
:
"videos"
,
"512"
:
"videos"
,
"513"
:
"videos"
,
"514"
:
"videos"
,
"515"
:
"videos"
,
"516"
:
"videos"
,
"517"
:
"videos"
,
"518"
:
"videos"
,
"519"
:
"videos"
,
"520"
:
"videos"
,
"521"
:
"videos"
,
"522"
:
"videos"
,
"523"
:
"videos"
,
"524"
:
"videos"
,
"525"
:
"videos"
,
"526"
:
"videos"
,
"527"
:
"videos"
,
"528"
:
"videos"
,
"529"
:
"videos"
,
"530"
:
"videos"
,
"531"
:
"videos"
,
"532"
:
"videos"
,
"533"
:
"videos"
,
"534"
:
"videos"
,
"535"
:
"voip"
,
"536"
:
"videos"
,
"537"
:
"videos"
,
"538"
:
"videos"
,
"539"
:
"videos"
,
"540"
:
"videos"
,
"541"
:
"videos"
,
"542"
:
"videos"
,
"543"
:
"videos"
,
"544"
:
"videos"
,
"545"
:
"videos"
,
"546"
:
"videos"
,
"547"
:
"videos"
,
"548"
:
"videos"
,
"549"
:
"videos"
,
"550"
:
"videos"
,
"551"
:
"videos"
,
"552"
:
"videos"
,
"553"
:
"videos"
,
"554"
:
"videos"
,
"555"
:
"videos"
,
"556"
:
"videos"
,
"557"
:
"videos"
,
"558"
:
"videos"
,
"559"
:
"videos"
,
"560"
:
"videos"
,
"561"
:
"videos"
,
"562"
:
"videos"
,
"563"
:
"videos"
,
"564"
:
"videos"
,
"565"
:
"videos"
,
"566"
:
"videos"
,
"567"
:
"videos"
,
"568"
:
"videos"
,
"569"
:
"videos"
,
"570"
:
"videos"
,
"571"
:
"videos"
,
"572"
:
"videos"
,
"573"
:
"videos"
,
"574"
:
"videos"
,
"575"
:
"videos"
,
"576"
:
"videos"
,
"577"
:
"videos"
,
"578"
:
"videos"
,
"579"
:
"videos"
,
"580"
:
"videos"
,
"581"
:
"videos"
,
"582"
:
"videos"
,
"583"
:
"videos"
,
"584"
:
"videos"
,
"585"
:
"videos"
,
"586"
:
"videos"
,
"587"
:
"videos"
,
"588"
:
"videos"
,
"589"
:
"videos"
,
"590"
:
"videos"
,
"591"
:
"videos"
,
"592"
:
"videos"
,
"593"
:
"videos"
,
"594"
:
"videos"
,
"595"
:
"videos"
,
"596"
:
"videos"
,
"597"
:
"videos"
,
"598"
:
"videos"
,
"599"
:
"videos"
,
"600"
:
"videos"
,
"601"
:
"videos"
,
"602"
:
"videos"
,
"603"
:
"videos"
,
"604"
:
"videos"
,
"605"
:
"videos"
,
"606"
:
"videos"
,
"607"
:
"videos"
,
"608"
:
"videos"
,
"609"
:
"videos"
,
"610"
:
"videos"
,
"611"
:
"videos"
,
"612"
:
"videos"
,
"613"
:
"videos"
,
"614"
:
"videos"
,
"615"
:
"videos"
,
"616"
:
"videos"
,
"617"
:
"videos"
,
"618"
:
"videos"
,
"619"
:
"videos"
,
"620"
:
"videos"
,
"621"
:
"videos"
,
"622"
:
"videos"
,
"623"
:
"videos"
,
"624"
:
"videos"
,
"625"
:
"videos"
,
"626"
:
"videos"
,
"627"
:
"videos"
,
"628"
:
"videos"
,
"629"
:
"videos"
,
"630"
:
"videos"
,
"631"
:
"videos"
,
"632"
:
"videos"
,
"633"
:
"videos"
,
"634"
:
"videos"
,
"635"
:
"videos"
,
"636"
:
"videos"
,
"637"
:
"videos"
,
"638"
:
"videos"
,
"639"
:
"videos"
,
"640"
:
"videos"
,
"641"
:
"videos"
,
"642"
:
"videos"
,
"643"
:
"videos"
,
"644"
:
"videos"
,
"645"
:
"videos"
,
"646"
:
"videos"
,
"647"
:
"videos"
,
"648"
:
"videos"
,
"649"
:
"videos"
,
"650"
:
"videos"
,
"651"
:
"videos"
,
"652"
:
"videos"
,
"653"
:
"videos"
,
"654"
:
"videos"
,
"655"
:
"videos"
,
"656"
:
"videos"
,
"657"
:
"videos"
,
"658"
:
"videos"
,
"659"
:
"videos"
,
"660"
:
"videos"
,
"661"
:
"videos"
,
"662"
:
"videos"
,
"663"
:
"videos"
,
"664"
:
"videos"
,
"665"
:
"videos"
,
"666"
:
"videos"
,
"667"
:
"videos"
,
"668"
:
"videos"
,
"669"
:
"videos"
,
"670"
:
"videos"
,
"671"
:
"videos"
,
"672"
:
"videos"
,
"673"
:
"videos"
,
"674"
:
"videos"
,
"675"
:
"videos"
,
"676"
:
"videos"
,
"677"
:
"videos"
,
"678"
:
"videos"
,
"679"
:
"videos"
,
"680"
:
"videos"
,
"681"
:
"videos"
,
"682"
:
"videos"
,
"683"
:
"videos"
,
"684"
:
"videos"
,
"685"
:
"videos"
,
"686"
:
"videos"
,
"687"
:
"videos"
,
"688"
:
"videos"
,
"689"
:
"videos"
,
"690"
:
"videos"
,
"691"
:
"videos"
,
"692"
:
"videos"
,
"693"
:
"videos"
,
"694"
:
"videos"
,
"695"
:
"videos"
,
"696"
:
"videos"
,
"697"
:
"videos"
,
"698"
:
"videos"
,
"699"
:
"videos"
,
"700"
:
"videos"
,
"701"
:
"videos"
,
"702"
:
"videos"
,
"703"
:
"videos"
,
"704"
:
"videos"
,
"705"
:
"videos"
,
"706"
:
"videos"
,
"707"
:
"videos"
,
"708"
:
"videos"
,
"709"
:
"videos"
,
"710"
:
"videos"
,
"711"
:
"videos"
,
"712"
:
"videos"
,
"713"
:
"videos"
,
"714"
:
"videos"
,
"715"
:
"videos"
,
"716"
:
"videos"
,
"717"
:
"videos"
,
"718"
:
"videos"
,
"719"
:
"videos"
,
"720"
:
"videos"
,
"721"
:
"videos"
,
"722"
:
"videos"
,
"723"
:
"videos"
,
"724"
:
"videos"
,
"725"
:
"videos"
,
"726"
:
"videos"
,
"727"
:
"videos"
,
"728"
:
"videos"
,
"729"
:
"videos"
,
"730"
:
"videos"
,
"731"
:
"videos"
,
"732"
:
"videos"
,
"733"
:
"videos"
,
"734"
:
"videos"
,
"735"
:
"videos"
,
"736"
:
"videos"
,
"737"
:
"videos"
,
"738"
:
"videos"
,
"739"
:
"videos"
,
"740"
:
"videos"
,
"741"
:
"videos"
,
"742"
:
"videos"
,
"743"
:
"videos"
,
"744"
:
"videos"
,
"745"
:
"videos"
,
"746"
:
"videos"
,
"747"
:
"videos"
,
"748"
:
"videos"
,
"749"
:
"videos"
,
"750"
:
"videos"
,
"751"
:
"videos"
,
"752"
:
"videos"
,
"753"
:
"videos"
,
"754"
:
"videos"
,
"755"
:
"videos"
,
"756"
:
"videos"
,
"757"
:
"videos"
,
"758"
:
"videos"
,
"759"
:
"videos"
,
"760"
:
"videos"
,
"761"
:
"videos"
,
"762"
:
"videos"
,
"763"
:
"videos"
,
"764"
:
"videos"
,
"765"
:
"videos"
,
"766"
:
"videos"
,
"767"
:
"videos"
,
"768"
:
"videos"
,
"769"
:
"videos"
,
"770"
:
"videos"
,
"771"
:
"videos"
,
"772"
:
"videos"
,
"773"
:
"videos"
,
"774"
:
"videos"
,
"775"
:
"videos"
,
"776"
:
"videos"
,
"777"
:
"videos"
,
"778"
:
"videos"
,
"779"
:
"videos"
,
"780"
:
"videos"
,
"781"
:
"videos"
,
"782"
:
"videos"
,
"783"
:
"videos"
,
"784"
:
"videos"
,
"785"
:
"videos"
,
"786"
:
"videos"
,
"787"
:
"videos"
,
"788"
:
"videos"
,
"789"
:
"videos"
,
"790"
:
"videos"
,
"791"
:
"videos"
,
"792"
:
"videos"
,
"793"
:
"videos"
,
"794"
:
"videos"
,
"795"
:
"videos"
,
"796"
:
"videos"
,
"797"
:
"videos"
,
"798"
:
"videos"
,
"799"
:
"videos"
,
"800"
:
"videos"
,
"801"
:
"videos"
,
"802"
:
"videos"
,
"803"
:
"videos"
,
"804"
:
"videos"
,
"805"
:
"videos"
,
"806"
:
"videos"
,
"807"
:
"videos"
,
"808"
:
"videos"
,
"809"
:
"videos"
,
"810"
:
"videos"
,
"811"
:
"videos"
,
"812"
:
"videos"
,
"813"
:
"videos"
,
"814"
:
"videos"
,
"815"
:
"videos"
,
"816"
:
"videos"
,
"817"
:
"videos"
,
"818"
:
"videos"
,
"819"
:
"videos"
,
"820"
:
"videos"
,
"821"
:
"videos"
,
"822"
:
"videos"
,
"823"
:
"videos"
,
"824"
:
"videos"
,
"825"
:
"videos"
,
"826"
:
"videos"
,
"827"
:
"videos"
,
"828"
:
"videos"
,
"829"
:
"videos"
,
"830"
:
"voip"
,
"831"
:
"voip"
,
"832"
:
"videos"
,
"833"
:
"videos"
,
"834"
:
"videos"
,
"835"
:
"videos"
,
"836"
:
"videos"
,
"837"
:
"videos"
,
"838"
:
"videos"
,
"839"
:
"videos"
,
"840"
:
"videos"
,
"841"
:
"videos"
,
"842"
:
"videos"
,
"843"
:
"videos"
,
"844"
:
"videos"
,
"845"
:
"videos"
,
"846"
:
"videos"
,
"847"
:
"videos"
,
"848"
:
"videos"
,
"849"
:
"videos"
,
"850"
:
"videos"
,
"851"
:
"videos"
,
"852"
:
"videos"
,
"853"
:
"videos"
,
"854"
:
"videos"
,
"855"
:
"videos"
,
"856"
:
"videos"
,
"857"
:
"videos"
,
"858"
:
"videos"
,
"859"
:
"videos"
,
"860"
:
"videos"
,
"861"
:
"videos"
,
"862"
:
"videos"
,
"863"
:
"videos"
,
"864"
:
"videos"
,
"865"
:
"videos"
,
"866"
:
"videos"
,
"867"
:
"videos"
,
"868"
:
"videos"
,
"869"
:
"videos"
,
"870"
:
"videos"
,
"871"
:
"videos"
,
"872"
:
"videos"
,
"873"
:
"videos"
,
"874"
:
"videos"
,
"875"
:
"videos"
,
"876"
:
"videos"
}
\ No newline at end of file
measurement/oaiflowclassification/common_utils.py
0 → 100644
View file @
fe3aad70
import
json
import
os
import
pickle
import
random
from
pathlib
import
Path
import
loguru
import
numpy
as
np
logger
=
loguru
.
logger
info
=
logger
.
info
debug
=
logger
.
debug
err
=
logger
.
error
def
check_dir
(
dir_name
):
if
not
Path
(
dir_name
).
is_dir
():
raise
FileNotFoundError
def
check_file
(
fn
):
if
not
Path
(
fn
).
is_file
():
raise
FileNotFoundError
def
file_exsit
(
fn
):
return
Path
(
fn
).
is_file
()
def
dir_exsit
(
fn
):
return
Path
(
fn
).
is_dir
()
def
gaussion
(
mean
:
float
,
std_var
:
float
,
size
=
1
):
if
size
==
1
:
return
np
.
random
.
normal
(
mean
,
std_var
)
return
np
.
random
.
normal
(
mean
,
std_var
,
size
)
def
exp
(
mean
:
float
,
size
=
1
):
if
1
==
size
:
return
np
.
random
.
normal
(
mean
)
return
np
.
random
.
normal
(
mean
,
size
)
def
uniform
(
low
,
up
,
size
=
1
):
if
1
==
size
:
return
np
.
random
.
uniform
(
low
,
up
)
return
np
.
random
.
uniform
(
low
,
up
,
size
)
def
load_pkl
(
filename
):
if
Path
(
filename
).
is_file
():
data
=
None
with
open
(
filename
,
'rb'
)
as
file
:
data
=
pickle
.
load
(
file
)
file
.
close
()
return
data
raise
FileNotFoundError
def
save_pkl
(
filename
,
obj
,
overwrite
=
True
):
def
write
():
with
open
(
filename
,
'wb'
)
as
file
:
pickle
.
dump
(
obj
,
file
)
file
.
flush
()
file
.
close
()
if
Path
(
filename
).
is_file
()
and
overwrite
:
write
()
return
write
()
def
load_json
(
filename
):
if
Path
(
filename
).
is_file
():
with
open
(
filename
)
as
f
:
return
json
.
load
(
f
)
raise
FileNotFoundError
def
save_json
(
filename
,
obj
,
overwrite
=
True
):
def
write
():
with
open
(
filename
,
'w'
,
encoding
=
"utf8"
)
as
file
:
json
.
dump
(
obj
,
file
,
indent
=
4
)
if
Path
(
filename
).
is_file
and
overwrite
:
write
()
return
write
()
def
is_digit
(
x
:
str
)
->
bool
:
try
:
float
(
x
)
return
True
except
:
return
False
def
normalize
(
x
):
mi
=
min
(
x
)
ma
=
max
(
x
)
diff
=
ma
-
mi
x
=
[(
xx
-
mi
)
/
diff
for
xx
in
x
]
return
x
if
__name__
==
"__main__"
:
pass
measurement/oaiflowclassification/database/measure.sql
0 → 100644
View file @
fe3aad70
/*
Navicat Premium Data Transfer
Source Server : enb2
Source Server Type : MySQL
Source Server Version : 50733
Source Host : 192.168.31.50:3306
Source Schema : mytestdb
Target Server Type : MySQL
Target Server Version : 50733
File Encoding : 65001
Date: 21/06/2021 20:11:19
*/
SET
NAMES
utf8mb4
;
SET
FOREIGN_KEY_CHECKS
=
0
;
-- ----------------------------
-- Table structure for measure
-- ----------------------------
DROP
TABLE
IF
EXISTS
`measure`
;
CREATE
TABLE
`measure`
(
`srcIP`
bigint
(
20
)
NOT
NULL
,
`dstIP`
bigint
(
20
)
NOT
NULL
,
`srcPort`
smallint
(
6
)
UNSIGNED
NOT
NULL
,
`dstPort`
smallint
(
6
)
UNSIGNED
NOT
NULL
,
`protocol`
tinyint
(
4
)
UNSIGNED
NOT
NULL
,
`averBytes`
double
(
20
,
1
)
NULL
DEFAULT
NULL
,
`averPkts`
double
(
20
,
1
)
NULL
DEFAULT
NULL
,
`flowType`
varchar
(
20
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NULL
DEFAULT
NULL
,
PRIMARY
KEY
(
`srcIP`
,
`dstIP`
,
`srcPort`
,
`dstPort`
,
`protocol`
)
USING
BTREE
)
ENGINE
=
InnoDB
CHARACTER
SET
=
utf8
COLLATE
=
utf8_general_ci
ROW_FORMAT
=
DYNAMIC
;
-- ----------------------------
-- Records of measure
-- ----------------------------
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40000
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40001
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40002
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40003
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40004
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40005
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40006
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40007
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40008
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40009
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40010
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40011
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40012
,
11111
,
6
,
21470
.
0
,
14
.
4
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40013
,
11111
,
6
,
29806
.
0
,
20
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40014
,
11111
,
6
,
25293
.
2
,
17
.
4
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40100
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40101
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40102
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40103
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40104
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40105
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40106
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40107
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40108
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40109
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40110
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40111
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40112
,
11111
,
6
,
26057
.
2
,
17
.
6
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40113
,
11111
,
6
,
29806
.
0
,
20
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40114
,
11111
,
6
,
22774
.
0
,
15
.
6
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40200
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40201
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40202
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40203
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40204
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40205
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40206
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40207
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40208
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40209
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40210
,
11111
,
6
,
0
.
0
,
0
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40211
,
11111
,
6
,
5097
.
6
,
3
.
4
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40212
,
11111
,
6
,
29518
.
4
,
20
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40213
,
11111
,
6
,
29806
.
0
,
20
.
0
,
NULL
);
INSERT
INTO
`measure`
VALUES
(
167772418
,
167772417
,
40214
,
11111
,
6
,
24412
.
8
,
16
.
8
,
NULL
);
SET
FOREIGN_KEY_CHECKS
=
1
;
measurement/oaiflowclassification/database/test.py
0 → 100644
View file @
fe3aad70
'''创建数据库'''
import
pymysql
#打开数据库连接,不需要指定数据库,因为需要创建数据库
conn
=
pymysql
.
connect
(
host
=
'localhost'
,
user
=
"root"
,
passwd
=
"123456"
)
#获取游标
cursor
=
conn
.
cursor
()
#创建pythonBD数据库
cursor
.
execute
(
'CREATE DATABASE IF NOT EXISTS pythonDB DEFAULT CHARSET utf8 COLLATE utf8_general_ci;'
)
cursor
.
close
()
#先关闭游标
conn
.
close
()
#再关闭数据库连接
print
(
'创建pythonBD数据库成功'
)
measurement/oaiflowclassification/instructions.txt
0 → 100644
View file @
fe3aad70
由于路径的问题,在import上作了一些删除
在classify文件夹下是运行的数据
先运行parser产生解析PCAP之后的文件,放在./tmp/dt的目录下,statistics.json为各个类型流的数据
再运行train,先把最下面的模式设置为1,产生对statistics.json中包大小,包间隔进行处理产生特征,保存在instances文件夹的pkl中
最后是运行predict,预测
train_dt_1
设置的是8个特征的(前四个包大小,后四个包间隔)+决策树 。。。
特征与标签都保存到instances文件夹,
训练模型保存到models文件夹中
正确率可以达到90%
加了PCA降维之后为88.6%
train_dt_2
设置的是10个特征的(前五个包大小,后五个包间隔):最小值,最大值,平均值,方差,中位数 +决策树
特征与标签都保存到instances2文件夹,
训练模型保存到models2文件夹中
正确率可以达到91.73%
加了PCA降维之后为88.7%
train_dt_3
11个特征(前五个包大小,后五个包间隔):最小值,最大值,平均值,方差,中位数 ;每秒包的数量
预测函数:决策树
特征与标签都保存到instances3文件夹
训练模型保存到models3文件夹中
正确率可以达到91.7%
加了PCA降维之后为88.7%
instances装的是 8个特征的(前四个包大小,后四个包间隔)
pkl文件其实可以处理成Excel表格的形式,然后用MATLAB来跑
predit_1_1 K邻近+8特征 85%
predit_1_2 K邻近+10特征 86.59%
predit_2 支持向量机 + 8特征 25.9%
predict_3 随机森林 +8特征 93.5%
predict_3 随机森林 +10特征 94%
predict_3 随机森林 +11特征 93.5%
models文件下
model_predict文件夹装的是各种预测函数
dt1为 K邻近+8特征 85%
dt1_2 为 K邻近+10特征 86.59%
dt3_1 为 随机森林 +8特征 93.5%
dt3_2 为 随机森林 +10特征 94%
有后缀_9 说明是用9个窗口
measurement/oaiflowclassification/main.py
0 → 100644
View file @
fe3aad70
from
classify
import
*
from
multithread_server
import
TcpServer
,
boot_server
from
pool
import
*
from
save_result
import
*
import
json
def
load_flows
():
# 一直执行
con
=
connect_database
(
DB_ADDR
,
USER_NAME
,
USER_PASSWORD
,
DB_NAME
)
# 建立数据库的连接
while
True
:
# 判断是否停止识别
"""
mutex.acquire()
if len(STOP_CLASSIFY) == 1:
print("程序结束")
mutex.release()
break
mutex.release()
"""
mutex
.
acquire
()
if
PREDECT_FLOWS
:
# 读出所有的结果
for
feature
in
PREDECT_FLOWS
:
if
type
(
feature
)
==
list
:
# print("type: ", type(feature))
# 预测结果
predict_result
=
classify_flow_list
(
feature
)
# 将分类结果放到全局变量中
# if predict_result not in CLASSIFY_RESULT:
# CLASSIFY_RESULT.append(predict_result)
#print("缓冲池中有: ", len(CLASSIFY_RESULT), "个已经分类好的结果,请取走")
# 将分类结果转为整数
integer_list
=
change_result_to_integer_list
(
predict_result
)
# 存入数据库
mysqldb_insert
(
con
,
integer_list
[
0
],
integer_list
[
1
],
integer_list
[
2
],
integer_list
[
3
],
integer_list
[
4
],
integer_list
[
5
])
print
(
integer_list
,
"存入数据库成功!"
)
print
(
"分类结果为:"
,
integer_list
)
# 清空列表
PREDECT_FLOWS
.
clear
()
mutex
.
release
()
# 定义一个函数作为主线程 让其他的守护他 判断关键字close后关闭主线称
def
main_threading
():
global
STOP_CLASSIFY
# 创建线程
t_server
=
threading
.
Thread
(
target
=
boot_server
)
t_classify
=
threading
.
Thread
(
target
=
load_flows
)
# 设置其他的为守护线程
t_server
.
setDaemon
(
True
)
t_classify
.
setDaemon
(
True
)
# 启动线程
t_server
.
start
()
t_classify
.
start
()
while
True
:
mutex
.
acquire
()
if
len
(
STOP_CLASSIFY
)
==
1
:
print
(
"程序结束"
)
mutex
.
release
()
break
mutex
.
release
()
if
__name__
==
"__main__"
:
main_threading
()
measurement/oaiflowclassification/model.py
0 → 100644
View file @
fe3aad70
from
sklearn.tree
import
DecisionTreeClassifier
from
path_utils
import
get_prj_root
from
pathlib
import
Path
import
os
from
common_utils
import
save_pkl
,
load_pkl
,
info
#修改了
import
numpy
as
np
import
random
root_dir
=
get_prj_root
()
model_dir
=
os
.
path
.
join
(
root_dir
,
"models"
)
class
Classifier
:
# def __init__(self,fn_name=None):
# self.model=None
# if fn_name is not None:
# self.load_model(fn_name)
def
fit
(
self
,
data
):
raise
NotImplementedError
def
predict
(
self
,
features
):
raise
NotImplementedError
def
save_model
(
self
,
fn_name
):
raise
NotImplementedError
def
load_model
(
self
,
fn_name
):
raise
NotImplementedError
'''
min_pkt|max_pkt|mean_pkt|var_pkt
min_idt|max_idt|mean_idt|var_idt
'''
class
DT
(
Classifier
):
def
__init__
(
self
):
super
(
DT
,
self
).
__init__
()
self
.
model
:
DecisionTreeClassifier
=
DecisionTreeClassifier
()
def
fit
(
self
,
data
):
assert
len
(
data
)
==
2
features
=
data
[
0
]
y
=
data
[
1
]
assert
len
(
features
)
==
len
(
y
)
info
(
"# instances {}"
.
format
(
len
(
features
)))
self
.
model
.
fit
(
features
,
y
)
def
predict
(
self
,
features
):
# info("# instances {}".format(len(features)))
return
self
.
model
.
predict
(
features
)
def
save_model
(
self
,
fn_name
):
if
self
.
model
is
None
:
return
fn_name
=
os
.
path
.
join
(
model_dir
,
fn_name
)
save_pkl
(
fn_name
,
self
.
model
)
def
load_model
(
self
,
fn_name
):
fn_name
=
os
.
path
.
join
(
model_dir
,
fn_name
)
self
.
model
:
DecisionTreeClassifier
=
load_pkl
(
fn_name
)
class
Dumb
(
Classifier
):
def
fit
(
self
,
data
):
pass
def
predict
(
self
,
features
):
if
random
.
random
()
>=
0.5
:
return
1
return
0
def
save_model
(
self
,
fn_name
):
pass
def
load_model
(
self
,
fn_name
):
pass
if
__name__
==
'__main__'
:
from
sklearn.datasets
import
load_iris
x
,
y
=
load_iris
(
return_X_y
=
True
)
model
=
DT
()
model
.
fit
((
x
,
y
))
model
.
save_model
(
"test.pkl"
)
model
.
load_model
(
"test.pkl"
)
measurement/oaiflowclassification/multithread_client.py
0 → 100644
View file @
fe3aad70
from
socket
import
*
from
threading
import
Thread
from
random
import
choice
import
json
import
time
BUFFER_SIZE
=
8192
# 随机发送数据测试的库:
data_list
=
[
[[
221.0
,
1350.0
,
640.0
,
376.26798960315506
,
543.0
,
21257877.349853516
,
4793407917.022705
,
1263437211.5135193
,
2039103758.0566826
,
119541525.84075928
],[
"10.0.0.0 10.0.0.1 6666 7771 UDP"
]],
[[
171.0
,
1460.0
,
888.4
,
514.1558518581695
,
853.0
,
11920.928955078125
,
17442424058.914185
,
4385495722.293854
,
7538530505.708111
,
49773454.666137695
],[
"10.0.0.0 10.0.0.2 6666 7772 TCP"
]],
[[
498.0
,
1460.0
,
1088.8
,
455.13356281425786
,
1460.0
,
36954.87976074219
,
43512821.197509766
,
11164724.826812744
,
18679961.749486398
,
554561.6149902344
],[
"10.0.0.0 10.0.0.3 6666 7773 UDP"
]],
[[
498.0
,
1460.0
,
1088.8
,
455.13356281425786
,
1460.0
,
30994.415283203125
,
44764995.57495117
,
16246497.631072998
,
18385686.144529935
,
10095000.267028809
],[
"10.0.0.0 10.0.0.4 6666 7774 TCP"
]],
[[
566.0
,
1460.0
,
1281.2
,
357.59999999999997
,
1460.0
,
22172.927856445312
,
21413803.100585938
,
5526959.8960876465
,
9175244.715715846
,
335931.77795410156
],[
"10.0.0.0 10.0.0.5 6666 7775 UDP"
]],
[[
69.0
,
629.0
,
246.6
,
205.1522361564699
,
172.0
,
190973.28186035156
,
457492113.1134033
,
219977498.0545044
,
220039359.48775682
,
211113452.91137695
],[
"10.0.0.6 10.0.0.1 7776 6666 TCP"
]],
[[
69.0
,
278.0
,
137.8
,
78.91108920804477
,
85.0
,
144958.49609375
,
462785959.2437744
,
210317969.3222046
,
211827960.3342278
,
189170479.7744751
],[
"10.0.0.7 10.0.0.1 7777 6666 UDP"
]],
[[
302.0
,
1460.0
,
807.6
,
537.1113850962387
,
498.0
,
12874.603271484375
,
205285072.32666016
,
56649982.92922974
,
86251862.02980827
,
10650992.393493652
],[
"10.0.0.8 10.0.0.1 7778 6666 TCP"
]],
[[
266.0
,
1460.0
,
892.8
,
490.89730086852177
,
780.0
,
24080.276489257812
,
301223039.6270752
,
76725006.10351562
,
129634012.70485088
,
2826452.2552490234
],[
"10.0.0.9 10.0.0.1 7779 6666 UDP"
]],
[[
514.0
,
1460.0
,
1191.6
,
371.89762032043177
,
1460.0
,
10013.580322265625
,
890016.5557861328
,
236511.23046875
,
377434.79666208074
,
23007.39288330078
],[
"10.0.0.10 10.0.0.1 8000 6666 TCP"
]],
"hhh"
,
"exit"
,
"send"
,
"send"
]
class
TcpClient
(
object
):
"""Tcp客户端"""
def
__init__
(
self
,
IP
=
"127.0.0.1"
,
Port
=
5002
):
"""初始化对象"""
self
.
code_mode
=
"utf-8"
#收发数据编码/解码格式
self
.
IP
=
IP
self
.
Port
=
Port
self
.
my_socket
=
socket
(
AF_INET
,
SOCK_STREAM
)
#创建socket
def
run
(
self
):
"""启动"""
self
.
my_socket
.
connect
((
self
.
IP
,
self
.
Port
))
#连接服务器
tr
=
Thread
(
target
=
self
.
recv_data
)
#创建线程收数据
ts
=
Thread
(
target
=
self
.
send_data
)
#创建线程发数据
tr
.
start
()
#开启线程
ts
.
start
()
def
recv_data
(
self
):
"""收数据"""
while
True
:
data
=
self
.
my_socket
.
recv
(
BUFFER_SIZE
).
decode
(
self
.
code_mode
)
if
data
:
if
data
==
"close connecting"
:
print
(
"已下线"
)
break
else
:
print
(
"{}"
.
format
(
data
))
else
:
break
self
.
my_socket
.
close
()
def
send_data
(
self
):
"""发数据"""
while
True
:
# 接收数据
data
=
choice
(
data_list
)
if
type
(
data
)
==
list
:
print
(
"已发送五元组{}的特征"
.
format
(
data
[
1
][
0
]))
else
:
print
(
"发送命令: "
,
data
)
# 两s发送一次 测试
time
.
sleep
(
2
)
# 判断data的类型 如果是列表用 json传输 字符串就直接传输
if
type
(
data
)
==
list
:
send_dat
=
json
.
dumps
(
data
)
self
.
my_socket
.
sendall
(
send_dat
.
encode
(
self
.
code_mode
))
elif
type
(
data
)
==
str
:
self
.
my_socket
.
sendall
(
data
.
encode
(
self
.
code_mode
))
else
:
continue
# 如果是退出 直接推出程序
if
data
==
"exit"
:
break
def
main
():
# 服务器IP和端口
ip
=
"127.0.0.1"
port
=
12345
my_socket
=
TcpClient
(
ip
,
port
)
my_socket
.
run
()
if
__name__
==
"__main__"
:
main
()
\ No newline at end of file
measurement/oaiflowclassification/multithread_server.py
0 → 100644
View file @
fe3aad70
from
socket
import
*
from
threading
import
Thread
from
pool
import
*
import
json
import
struct
class
TcpServer
(
object
):
"""Tcp服务器"""
def
__init__
(
self
,
Port
):
"""初始化对象"""
self
.
code_mode
=
"utf-8"
#收发数据编码/解码格式
self
.
server_socket
=
socket
(
AF_INET
,
SOCK_STREAM
)
#创建socket
self
.
server_socket
.
setsockopt
(
SOL_SOCKET
,
SO_REUSEADDR
,
True
)
#设置端口复用
self
.
server_socket
.
bind
((
SEVER_HOST
,
Port
))
#绑定IP和Port
self
.
server_socket
.
listen
(
100
)
#设置为被动socket
print
(
"服务器正在监听..."
)
def
run
(
self
):
"""运行"""
while
True
:
# 判断程序是否结束
"""
mutex.acquire()
if len(STOP_CLASSIFY) == 1:
print("程序结束")
mutex.release()
break
mutex.release()
"""
client_socket
,
client_addr
=
self
.
server_socket
.
accept
()
#等待客户端连接
print
(
"{} 已上线"
.
format
(
client_addr
))
#创建线程为客户端服务
tr
=
Thread
(
target
=
self
.
recv_data
,
args
=
(
client_socket
,
client_addr
))
# if !tr.is_alive():
tr
.
start
()
#开启线程
self
.
server_socket
.
close
()
def
recv_data
(
self
,
client_socket
,
client_addr
):
"""收发数据"""
while
True
:
# 判断程序是否结束
"""
mutex.acquire()
if len(STOP_CLASSIFY) == 1:
print("程序结束")
mutex.release()
break
mutex.release()
"""
recv
=
client_socket
.
recv
(
80
)
# a = []
data
=
[]
if
recv
:
# print('服务端收到客户端发来的消息:%s' % (recv))
recv
=
recv
[:
77
]
a
=
struct
.
unpack
(
'2i2f1i2l2d1l13B'
,
recv
)
print
(
a
)
data
=
[[],
[]]
idStr
=
""
mystr
=
a
[
10
:]
for
i
in
range
(
10
):
data
[
0
].
append
(
a
[
i
]
+
0.0
)
for
i
in
range
(
8
):
if
i
%
4
==
3
:
idStr
+=
str
(
mystr
[
i
])
+
" "
else
:
idStr
+=
str
(
mystr
[
i
])
+
"."
idStr
+=
str
(
int
(
mystr
[
8
])
*
256
+
int
(
mystr
[
9
]))
+
" "
idStr
+=
str
(
int
(
mystr
[
10
])
*
256
+
int
(
mystr
[
11
]))
+
" "
"""
if int(mystr[12]) == 6:
idStr += "TCP"
else:
idStr += "UDP"
"""
idStr
+=
str
(
int
(
mystr
[
12
]))
+
""
data
[
1
].
append
(
idStr
)
#data = client_socket.recv(BUFFER_SIZE).decode(self.code_mode)
#if len(data) > 8:
# data = json.loads(data)
if
data
:
# 关闭连接的客户端的线程
if
data
==
"exit"
:
# 发送关闭客户端的命令
client_socket
.
send
(
"close connecting"
.
encode
(
self
.
code_mode
))
print
(
"{} 已下线"
.
format
(
client_addr
))
break
# 如果接收的命令是close 修改标志位 停止程序
elif
data
==
"close"
:
mutex
.
acquire
()
close_program
()
mutex
.
release
()
break
# 如果发送的命令是 send 则将分类结果发送过来
elif
data
==
"send"
:
mutex
.
acquire
()
if
CLASSIFY_RESULT
:
for
res
in
CLASSIFY_RESULT
:
client_socket
.
send
(
str
(
res
).
encode
(
self
.
code_mode
))
CLASSIFY_RESULT
.
clear
()
else
:
client_socket
.
send
(
"暂无分类结果"
.
encode
(
self
.
code_mode
))
mutex
.
release
()
else
:
# 将数据保存在PREDECT_FLOWS中 加锁
mutex
.
acquire
()
if
data
not
in
PREDECT_FLOWS
:
PREDECT_FLOWS
.
append
(
data
)
mutex
.
release
()
print
(
"{}:发送特征的五元组为{}"
.
format
(
client_addr
,
data
[
1
]))
# print("缓冲池中有: ", len(PREDECT_FLOWS), " 个待分类的特征,请分类")
# client_socket.send(data.encode(self.code_mode))
else
:
#客户端断开连接
print
(
"{} 已下线"
.
format
(
client_addr
))
break
client_socket
.
close
()
def
boot_server
():
# print("\033c", end="") #清屏
# port = int(input("请输入要绑定的Port:"))
my_server
=
TcpServer
(
SEVER_PORT
)
my_server
.
run
()
if
__name__
==
"__main__"
:
boot_server
()
measurement/oaiflowclassification/oai_client/multithread_client.py
0 → 100644
View file @
fe3aad70
from
socket
import
*
from
threading
import
Thread
from
random
import
choice
import
json
import
time
BUFFER_SIZE
=
8192
# 随机发送数据测试的库:
data_list
=
[
[[
221.0
,
1350.0
,
640.0
,
376.26798960315506
,
543.0
,
21257877.349853516
,
4793407917.022705
,
1263437211.5135193
,
2039103758.0566826
,
119541525.84075928
],[
"1"
]],
[[
171.0
,
1460.0
,
888.4
,
514.1558518581695
,
853.0
,
11920.928955078125
,
17442424058.914185
,
4385495722.293854
,
7538530505.708111
,
49773454.666137695
],[
"2"
]],
[[
498.0
,
1460.0
,
1088.8
,
455.13356281425786
,
1460.0
,
36954.87976074219
,
43512821.197509766
,
11164724.826812744
,
18679961.749486398
,
554561.6149902344
],[
"3"
]],
[[
498.0
,
1460.0
,
1088.8
,
455.13356281425786
,
1460.0
,
30994.415283203125
,
44764995.57495117
,
16246497.631072998
,
18385686.144529935
,
10095000.267028809
],[
"4"
]],
[[
566.0
,
1460.0
,
1281.2
,
357.59999999999997
,
1460.0
,
22172.927856445312
,
21413803.100585938
,
5526959.8960876465
,
9175244.715715846
,
335931.77795410156
],[
"5"
]],
[[
69.0
,
629.0
,
246.6
,
205.1522361564699
,
172.0
,
190973.28186035156
,
457492113.1134033
,
219977498.0545044
,
220039359.48775682
,
211113452.91137695
],[
"6"
]],
[[
69.0
,
278.0
,
137.8
,
78.91108920804477
,
85.0
,
144958.49609375
,
462785959.2437744
,
210317969.3222046
,
211827960.3342278
,
189170479.7744751
],[
"7"
]],
[[
302.0
,
1460.0
,
807.6
,
537.1113850962387
,
498.0
,
12874.603271484375
,
205285072.32666016
,
56649982.92922974
,
86251862.02980827
,
10650992.393493652
],[
"8"
]],
[[
266.0
,
1460.0
,
892.8
,
490.89730086852177
,
780.0
,
24080.276489257812
,
301223039.6270752
,
76725006.10351562
,
129634012.70485088
,
2826452.2552490234
],[
"9"
]],
[[
514.0
,
1460.0
,
1191.6
,
371.89762032043177
,
1460.0
,
10013.580322265625
,
890016.5557861328
,
236511.23046875
,
377434.79666208074
,
23007.39288330078
],[
"10"
]],
"hhh"
,
"exit"
,
"send"
,
"send"
]
class
TcpClient
(
object
):
"""Tcp客户端"""
def
__init__
(
self
,
IP
=
"127.0.0.1"
,
Port
=
5002
):
"""初始化对象"""
self
.
code_mode
=
"utf-8"
#收发数据编码/解码格式
self
.
IP
=
IP
self
.
Port
=
Port
self
.
my_socket
=
socket
(
AF_INET
,
SOCK_STREAM
)
#创建socket
def
run
(
self
):
"""启动"""
self
.
my_socket
.
connect
((
self
.
IP
,
self
.
Port
))
#连接服务器
tr
=
Thread
(
target
=
self
.
recv_data
)
#创建线程收数据
ts
=
Thread
(
target
=
self
.
send_data
)
#创建线程发数据
tr
.
start
()
#开启线程
ts
.
start
()
def
recv_data
(
self
):
"""收数据"""
while
True
:
data
=
self
.
my_socket
.
recv
(
BUFFER_SIZE
).
decode
(
self
.
code_mode
)
if
data
:
if
data
==
"close connecting"
:
print
(
"已下线"
)
break
else
:
print
(
"{}"
.
format
(
data
))
else
:
break
self
.
my_socket
.
close
()
def
send_data
(
self
):
"""发数据"""
while
True
:
# 接收数据
data
=
choice
(
data_list
)
if
type
(
data
)
==
list
:
print
(
"已发送五元组{}的特征"
.
format
(
data
[
1
][
0
]))
else
:
print
(
"发送命令: "
,
data
)
# 两s发送一次 测试
time
.
sleep
(
2
)
# 判断data的类型 如果是列表用 json传输 字符串就直接传输
if
type
(
data
)
==
list
:
send_dat
=
json
.
dumps
(
data
)
self
.
my_socket
.
sendall
(
send_dat
.
encode
(
self
.
code_mode
))
elif
type
(
data
)
==
str
:
self
.
my_socket
.
sendall
(
data
.
encode
(
self
.
code_mode
))
else
:
continue
# 如果是退出 直接推出程序
if
data
==
"exit"
:
break
def
main
():
# 服务器IP和端口
ip
=
"192.168.136.137"
port
=
5005
my_socket
=
TcpClient
(
ip
,
port
)
my_socket
.
run
()
if
__name__
==
"__main__"
:
main
()
\ No newline at end of file
measurement/oaiflowclassification/path_utils.py
0 → 100644
View file @
fe3aad70
from
pathlib
import
Path
import
os.path
def
get_prj_root
():
return
os
.
path
.
abspath
(
os
.
curdir
)
# return Path(__file__).parent
if
__name__
==
'__main__'
:
print
(
get_prj_root
())
measurement/oaiflowclassification/pool.py
0 → 100644
View file @
fe3aad70
import
threading
"""
该文件定义使用的常量 和 进程锁
"""
# 设置服务器的IP和端口
SEVER_HOST
=
"127.0.0.1"
# 发送到windows测试
SEVER_PORT
=
12345
# 缓冲区大小
BUFFER_SIZE
=
8192
# 共享的全局变量 保存解析的特征 用于客户端发送和服务器端读取的缓冲区
PREDECT_FLOWS
=
[]
# 共享的全局变量 保存分类的结果
CLASSIFY_RESULT
=
[]
# 是否停止分类的标志位 长度为1退出程序
STOP_CLASSIFY
=
[]
# 定义修改全局变量的函数
def
close_program
():
global
STOP_CLASSIFY
STOP_CLASSIFY
.
append
(
1
)
# 创建全局的进程锁
mutex
=
threading
.
Lock
()
# 数据库操作
# 数据库地址
DB_ADDR
=
'127.0.0.1'
# 数据库用户名
USER_NAME
=
'root'
# 数据库用户密码
USER_PASSWORD
=
'123456'
# 数据库名称
DB_NAME
=
'mytestdb'
# 测试使用的数据
test
=
[[
221.0
,
1350.0
,
640.0
,
376.26798960315506
,
543.0
,
21257877.349853516
,
4793407917.022705
,
1263437211.5135193
,
2039103758.0566826
,
119541525.84075928
],[
"sip sport dip dport protocol"
]]
measurement/oaiflowclassification/predict.py
0 → 100644
View file @
fe3aad70
"""
预测函数:随机森林
每次运行前,检查:
四个需要修改的地方,命名是否正确
最后的运行模式是否正确
"""
from
common_utils
import
*
# 修改了
from
argparse
import
ArgumentParser
from
collections
import
namedtuple
from
typing
import
List
,
Dict
from
datetime
import
datetime
from
path_utils
import
get_prj_root
import
numpy
as
np
# from sklearn.externals import joblib
import
joblib
from
sklearn.ensemble
import
RandomForestClassifier
# 训练模型
random
.
seed
(
datetime
.
now
())
model_dir
=
os
.
path
.
join
(
get_prj_root
(),
"classify/models"
)
# 修改:模型model文件夹路径
predict_model_pkl
=
os
.
path
.
join
(
model_dir
,
"dt2.pkl"
)
# 修改:模型的版本,只用修改此处就行
Instance
=
namedtuple
(
"Instance"
,
[
"features"
,
"label"
])
# 实例
dirs
=
{
"video"
:
"./tmp/dt/video"
,
"iot"
:
"./tmp/dt/iot"
,
"voip"
:
"./tmp/dt/voip"
,
"AR"
:
"./tmp/dt/AR"
,
}
instances_dir
=
os
.
path
.
join
(
get_prj_root
(),
"classify/instances"
)
# 修改:instances路径
def
train_and_predict
():
iot
=
load_pkl
(
os
.
path
.
join
(
instances_dir
,
"iot.pkl"
))
# 不同实例的pkl是不同特征的
videos
=
load_pkl
(
os
.
path
.
join
(
instances_dir
,
"video.pkl"
))
voip
=
load_pkl
(
os
.
path
.
join
(
instances_dir
,
"voip.pkl"
))
AR
=
load_pkl
(
os
.
path
.
join
(
instances_dir
,
"AR.pkl"
))
for
i
in
videos
:
assert
i
.
label
==
0
for
i
in
iot
:
assert
i
.
label
==
1
for
i
in
voip
:
assert
i
.
label
==
2
for
i
in
AR
:
assert
i
.
label
==
3
# print(videos)
debug
(
"# iot instances {}"
.
format
(
len
(
iot
)))
debug
(
"# video instances {}"
.
format
(
len
(
videos
)))
debug
(
"# VOIP instances {}"
.
format
(
len
(
voip
)))
debug
(
"# AR instances {}"
.
format
(
len
(
AR
)))
random
.
shuffle
(
voip
)
# 打乱排序
random
.
shuffle
(
iot
)
random
.
shuffle
(
videos
)
random
.
shuffle
(
AR
)
n_video_train
=
int
(
len
(
videos
)
*
0.7
)
n_video_test
=
len
(
videos
)
-
n_video_train
video_train
=
videos
[:
n_video_train
]
video_test
=
videos
[
n_video_train
:]
iot_train
=
iot
[:
n_video_train
]
iot_test
=
iot
[
len
(
iot
)
-
len
(
video_test
):]
voip_train
=
voip
[:
n_video_train
]
voip_test
=
voip
[
len
(
voip
)
-
len
(
video_test
):]
AR_train
=
AR
[:
n_video_train
]
AR_test
=
AR
[
len
(
AR
)
-
len
(
video_test
):]
info
(
"#video train {}"
.
format
(
len
(
video_train
)))
info
(
"#iot train {}"
.
format
(
len
(
iot_train
)))
info
(
"#voip train {}"
.
format
(
len
(
voip_train
)))
info
(
"#AR train {}"
.
format
(
len
(
AR_train
)))
train
=
[]
train
.
extend
(
iot_train
)
train
.
extend
(
video_train
)
train
.
extend
(
voip_train
)
train
.
extend
(
AR_train
)
random
.
shuffle
(
train
)
train_x
=
[
x
.
features
for
x
in
train
]
train_y
=
[
x
.
label
for
x
in
train
]
# test 1:1
test
=
[]
info
(
"#video test {}"
.
format
(
len
(
video_test
)))
info
(
"#iot test {}"
.
format
(
len
(
iot_test
)))
info
(
"#voip test {}"
.
format
(
len
(
voip_test
)))
info
(
"#AR test {}"
.
format
(
len
(
AR_test
)))
test
.
extend
(
video_test
)
test
.
extend
(
iot_test
)
test
.
extend
(
voip_test
)
test
.
extend
(
AR_test
)
random
.
shuffle
(
test
)
test_x
=
[
t
.
features
for
t
in
test
]
test_y
=
[
t
.
label
for
t
in
test
]
# 训练以及预测
predict_model
=
RandomForestClassifier
(
oob_score
=
True
)
# 引入训练方法
predict_model
.
fit
(
train_x
,
train_y
)
# 队训练数据进行拟合
predicts
=
predict_model
.
predict
(
test_x
)
"""
dt = DT()
dt.fit((train_x, train_y))
predicts = dt.predict(test_x)
"""
"""
# 打印预测的结果
print(predicts)
print("-------------------------------")
"""
# 保存模型
fn_name
=
os
.
path
.
join
(
model_dir
,
predict_model_pkl
)
joblib
.
dump
(
predict_model
,
predict_model_pkl
)
# 评价模型
count
=
0
for
idx
in
range
(
len
(
test_x
)):
if
int
(
predicts
[
idx
])
==
int
(
test_y
[
idx
]):
count
+=
1
# print(count / len(test_x))
return
count
/
len
(
test_x
)
# save_pkl(predict_model_pkl, knn.model)
# knn.save_model(dt_model_pkl) #储存模型
if
__name__
==
'__main__'
:
n
=
10
s
=
0
predict_sum
=
0
for
i
in
range
(
n
):
s
=
train_and_predict
()
predict_sum
=
predict_sum
+
s
print
(
predict_sum
/
n
)
measurement/oaiflowclassification/process_bar.py
0 → 100644
View file @
fe3aad70
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 18-5-21 下午3:44
# @Author : LK
# @File : 进度条.py
# @Software: PyCharm
import
sys
import
time
def
process_bar
(
precent
,
width
=
50
):
use_num
=
int
(
precent
*
width
)
space_num
=
int
(
width
-
use_num
)
precent
=
precent
*
100
# 第一个和最后一个一样梯形显示, 中间两个正确,但是在python2中报错
#
# print('[%s%s]%d%%'%(use_num*'#', space_num*' ',precent))
# print('[%s%s]%d%%'%(use_num*'#', space_num*' ',precent), end='\r')
print
(
'[%s%s]%d%%'
%
(
use_num
*
'#'
,
space_num
*
' '
,
precent
),
file
=
sys
.
stdout
,
flush
=
True
,
end
=
'
\r
'
)
# print('[%s%s]%d%%'%(use_num*'#', space_num*' ',precent),file=sys.stdout,flush=True)
# for i in range(21):
# precent = i/20
# process_bar(precent)
# time.sleep(0.2)
measurement/oaiflowclassification/requirement.txt
0 → 100644
View file @
fe3aad70
loguru
numpy
joblib
scikit-learn==0.24.1
pymysql
\ No newline at end of file
measurement/oaiflowclassification/save_result.py
0 → 100644
View file @
fe3aad70
"""
该文件用于将分类好的结果保存到mysql数据库中
"""
import
pymysql
from
pool
import
*
# 建立连接
def
connect_database
(
addr
,
uer_name
,
usr_paswd
,
db_name
):
return
pymysql
.
connect
(
host
=
addr
,
user
=
uer_name
,
passwd
=
usr_paswd
,
database
=
db_name
,
charset
=
'utf8'
)
# 插入数据
def
mysqldb_insert
(
con
,
srcIP
,
dstIP
,
srcPort
,
dstPort
,
protocol
,
flowType
):
# con = connect_database(DB_ADDR, USER_NAME, USER_PASSWORD, DB_NAME)
cursor
=
con
.
cursor
()
sql
=
"INSERT INTO measure(srcIP, dstIP, srcPort, dstPort, protocol, flowType) VALUES ({}, {}, {}, {}, {},
\'
{}
\'
) ON DUPLICATE KEY UPDATE flowType =
\'
{}
\'
"
.
format
(
srcIP
,
dstIP
,
srcPort
,
dstPort
,
protocol
,
flowType
,
flowType
)
# print(sql)
try
:
# 执行sql语句
cursor
.
execute
(
sql
)
# 提交到数据库执行
con
.
commit
()
except
:
# 发生错误时回滚
con
.
rollback
()
#cursor.close()
#con.close()
print
(
"插入数据成功!"
)
# 查询数据
def
mysqldb_research
():
return
# 清空数据
def
mysqldb_clearall
(
con
):
cursor
=
con
.
cursor
()
sql
=
"TRUNCATE TABLE measure;"
try
:
# 执行sql语句
cursor
.
execute
(
sql
)
# 提交到数据库执行
con
.
commit
()
except
:
# 发生错误时回滚
con
.
rollback
()
print
(
"表已清空!"
)
if
__name__
==
"__main__"
:
# write_database()
con
=
connect_database
(
DB_ADDR
,
USER_NAME
,
USER_PASSWORD
,
DB_NAME
)
mysqldb_insert
(
con
,
3
,
4
,
1
,
1
,
'UDP'
,
"iot"
)
mysqldb_insert
(
con
,
1
,
2
,
1
,
1
,
1
,
"video"
)
mysqldb_insert
(
con
,
1
,
3
,
3
,
1
,
1
,
"video"
)
mysqldb_insert
(
con
,
1
,
4
,
3
,
1
,
1
,
"video"
)
# mysqldb_clearall(con)
measurement/oaiflowclassification/scripts/init.sh
0 → 100755
View file @
fe3aad70
#!/usr/bin/env bash
# Shell script absolute path
DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
"
echo
"当前脚本所在路径为:
$DIR
"
cd
$DIR
cd
..
# Check Python3
python3_version
=
$(
python3
-V
|awk
'{print $2}'
)
if
[
$python3_version
]
;
then
echo
"python3已安装,当前版本为:{
$python3_version
}"
else
apt update
&&
apt
install
-y
python3
fi
# Check Python3-venv
python3venv_version
=
$(
dpkg
--status
python3-venv 2>/dev/null|grep Version|awk
'{print $2}'
)
if
[
$python3venv_version
]
;
then
echo
"python3-venv已安装,当前版本为:{
$python3venv_version
}"
else
apt update
&&
apt
install
-y
python3-venv
fi
# Check if .py38 has been built
py38
=
$(
ls
-a
../|grep .py38
)
if
[
$py38
]
;
then
echo
"Python3虚拟环境目录已安装"
else
python3
-m
venv .py38
fi
# .py38 install requirements
source
./.py38/bin/activate
pip
install
-r
./requirement.txt
\ No newline at end of file
measurement/oaiflowclassification/scripts/run.sh
0 → 100755
View file @
fe3aad70
#!/usr/bin/env bash
# Shell script absolute path
DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
"
echo
"当前脚本所在路径为:
$DIR
"
cd
$DIR
cd
..
# Check if .py38 has been built
py38
=
$(
ls
-a
./|grep .py38
)
if
[
$py38
]
;
then
echo
"Python3虚拟环境目录已安装"
else
echo
"请先运行init.sh创建Python3虚拟环境并下载依赖"
exit
fi
# Enter Python3 virtual environment
source
./.py38/bin/activate
python ./main.py
\ No newline at end of file
measurement/oaiflowclassification/test.txt
0 → 100644
View file @
fe3aad70
[
Instance(features=[221.0, 1350.0, 640.0, 376.26798960315506, 543.0, 21257877.349853516, 4793407917.022705, 1263437211.5135193, 2039103758.0566826, 119541525.84075928], label=0),
Instance(features=[543.0, 1420.0, 865.8, 397.8187527002718, 543.0, 80108.642578125, 302655220.0317383, 118959307.67059326, 124965001.82909915, 86550951.00402832], label=0),
Instance(features=[51.0, 1420.0, 565.2, 504.39246624032756, 543.0, 37908.55407714844, 152942180.63354492, 114446520.80535889, 66054246.991755255, 152402997.01690674], label=0),
Instance(features=[51.0, 1420.0, 573.0, 500.55289430788434, 543.0, 38146.97265625, 149838924.40795898, 112113237.38098145, 64707617.526605316, 149287939.07165527], label=0),
Instance(features=[543.0, 1420.0, 865.8, 397.8187527002718, 543.0, 80108.642578125, 302655220.0317383, 118959307.67059326, 124965001.82909915, 86550951.00402832], label=0),
Instance(features=[543.0, 543.0, 543.0, 0.0, 543.0, 12002904891.967773, 12002904891.967773, 12002904891.967773, 0.0, 12002904891.967773], label=0),
Instance(features=[543.0, 543.0, 543.0, 0.0, 543.0, 61996713161.468506, 61996713161.468506, 61996713161.468506, 0.0, 61996713161.468506], label=0),
Instance(features=[69.0, 165.0, 88.2, 38.400000000000006, 69.0, 234842.30041503906, 15935797214.508057, 4096173763.2751465, 6838056860.393458, 224331498.14605713], label=0),
Instance(features=[53.0, 53.0, 53.0, 0.0, 53.0, 900425158977.5085, 900619699001.3123, 900495255708.6943, 88229310.2092093, 900440909147.2626], label=0),
Instance(features=[171.0, 1460.0, 888.4, 514.1558518581695, 853.0, 11920.928955078125, 17442424058.914185, 4385495722.293854, 7538530505.708111, 49773454.666137695], label=0),
Instance(features=[69.0, 789.0, 353.8, 348.8440339177381, 69.0, 177860.26000976562, 16926848173.14148, 4387068212.032318, 7244279086.278186, 310623407.3638916], label=0),
Instance(features=[1152.0, 1460.0, 1398.4, 123.19999999999999, 1460.0, 37908.55407714844, 1278162.0025634766, 464260.5781555176, 505904.0109753843, 270485.87799072266], label=0),
Instance(features=[498.0, 1460.0, 1088.8, 455.13356281425786, 1460.0, 36954.87976074219, 43512821.197509766, 11164724.826812744, 18679961.749486398, 554561.6149902344], label=0),
Instance(features=[498.0, 1460.0, 1088.8, 455.13356281425786, 1460.0, 16927.719116210938, 599861.1450195312, 345230.1025390625, 231610.05946217623, 382065.7730102539], label=0),
Instance(features=[498.0, 1460.0, 1088.8, 455.13356281425786, 1460.0, 30994.415283203125, 44764995.57495117, 16246497.631072998, 18385686.144529935, 10095000.267028809], label=0),
Instance(features=[68.0, 1460.0, 796.8, 563.8050726980026, 498.0, 64849.853515625, 59234857.5592041, 23645222.187042236, 25055721.53286109, 17640590.66772461], label=0),
Instance(features=[566.0, 1460.0, 1281.2, 357.59999999999997, 1460.0, 56028.36608886719, 20931959.15222168, 5464732.646942139, 8935189.980569247, 435471.5347290039], label=0),
Instance(features=[53.0, 757.0, 472.2, 266.61687868550257, 498.0, 19500017.166137695, 179983756065.36865, 45023086249.82834, 77919581004.17883, 44544458.38928223], label=0),
Instance(features=[49.0, 1460.0, 1098.6, 546.7517169611816, 1460.0, 19073.486328125, 192880.63049316406, 67472.45788574219, 72792.08549574362, 28967.857360839844], label=0),
Instance(features=[357.0, 1460.0, 1160.2, 429.8894741674888, 1460.0, 10967.254638671875, 7920619964.599609, 1980168759.8228455, 3429721102.1972656, 22053.71856689453], label=0),
Instance(features=[34.0, 1460.0, 1095.6, 552.5133844532637, 1460.0, 12874.603271484375, 39534807.205200195, 9967505.931854248, 17071036.76126337, 161170.95947265625], label=0),
Instance(features=[566.0, 1460.0, 1281.2, 357.59999999999997, 1460.0, 22172.927856445312, 21413803.100585938, 5526959.8960876465, 9175244.715715846, 335931.77795410156], label=0), Instance(features=[645.0, 997.0, 920.2, 138.15701212750656, 997.0, 7315587997.436523, 10015514135.360718, 9327197492.12265, 1161482474.3592775, 9988843917.84668], label=0), Instance(features=[180.0, 1460.0, 832.8, 528.428008341723, 566.0, 6198.883056640625, 778085947.0367432, 194917023.18191528, 336693134.64337415, 787973.4039306641], label=0), Instance(features=[69.0, 629.0, 246.6, 205.1522361564699, 172.0, 190973.28186035156, 457492113.1134033, 219977498.0545044, 220039359.48775682, 211113452.91137695], label=0), Instance(features=[203.0, 517.0, 360.0, 157.0, 360.0, 576164960.861206, 576164960.861206, 576164960.861206, 0.0, 576164960.861206], label=0), Instance(features=[266.0, 1460.0, 834.0, 513.2812094748842, 498.0, 20980.8349609375, 573156118.3929443, 246138036.25106812, 248362972.34601125, 205687522.8881836], label=0), Instance(features=[472.0, 1460.0, 877.4, 475.78213501559725, 498.0, 12159.347534179688, 408530950.54626465, 113934516.90673828, 171170734.5952428, 23597478.86657715], label=0), Instance(features=[68.0, 1460.0, 853.4, 544.8543291559681, 781.0, 23126.602172851562, 110846996.30737305, 41195988.65509033, 45817371.300639905, 26956915.855407715], label=0), Instance(features=[75.0, 1301.0, 892.6, 506.8118388514617, 1285.0, 15974.044799804688, 29991816997.528076, 15005207479.000092, 14716919889.929535, 15014498472.213745], label=0), Instance(features=[154.0, 1460.0, 1119.6, 506.5750092533188, 1460.0, 17166.1376953125, 504382848.739624, 138471961.02142334, 212147087.12124813, 24743914.60418701], label=0), Instance(features=[566.0, 1460.0, 1188.4, 359.36032056975904, 1460.0, 10967.254638671875, 905036.9262695312, 240743.16024780273, 383666.3293895713, 23484.230041503906], label=0), Instance(features=[566.0, 1460.0, 1188.4, 359.36032056975904, 1460.0, 16927.719116210938, 380992.8894042969, 198960.3042602539, 182032.58514404297, 198960.3042602539], label=0), Instance(features=[498.0, 1460.0, 1088.8, 455.13356281425786, 1460.0, 20980.8349609375, 77643156.05163574, 27270257.472991943, 31771635.317431103, 15708446.502685547], label=0), Instance(features=[424.0, 1460.0, 966.8, 447.5562087604193, 992.0, 15974.044799804688, 507964849.4720459, 227932989.59732056, 230850223.75677642, 201875567.43621826], label=0), Instance(features=[498.0, 1460.0, 1070.3333333333333, 413.4298274462333, 1253.0, 22888.18359375, 74783086.7767334, 37402987.480163574, 37380099.296569824, 37402987.480163574], label=0), Instance(features=[498.0, 1460.0, 1029.8, 421.0332053413365, 1165.0, 17881.393432617188, 38013219.83337402, 15703797.340393066, 16351302.199390737, 12392044.067382812], label=0), Instance(features=[180.0, 1460.0, 1124.8, 496.6730916810372, 1460.0, 10967.254638671875, 12046905040.740967, 3011972486.972809, 5216320755.748366, 486969.9478149414], label=0), Instance(features=[180.0, 1460.0, 950.0, 521.1924788405911, 1152.0, 61988.83056640625, 12149194002.15149, 3041020989.41803, 5258609426.934627, 7413983.345031738], label=0), Instance(features=[180.0, 1460.0, 1009.2, 556.3964054520842, 1448.0, 21934.50927734375, 12049144983.291626, 3022482752.799988, 5211570900.783003, 20382046.699523926], label=0), Instance(features=[180.0, 1460.0, 1124.8, 496.6730916810372, 1460.0, 8821.487426757812, 12145423173.904419, 3036862015.724182, 5258830299.664923, 1008033.7524414062], label=0), Instance(features=[180.0, 1460.0, 1124.8, 496.6730916810372, 1460.0, 9059.906005859375, 12099762916.564941, 3025185704.231262, 5239209610.004252, 485420.22705078125], label=0), Instance(features=[302.0, 1460.0, 838.4, 511.9803121214721, 498.0, 10967.254638671875, 289257049.5605469, 73832750.32043457, 124399665.7465824, 3031492.233276367], label=0), Instance(features=[304.0, 1460.0, 848.4, 504.9964752352238, 520.0, 12159.347534179688, 24822950.36315918, 8991003.036499023, 10197928.628486902, 5564451.217651367], label=0), Instance(features=[75.0, 1460.0, 863.4, 539.171809352084, 836.0, 38862.22839355469, 300346136.09313965, 82095265.38848877, 126466518.33213389, 13998031.616210938], label=0), Instance(features=[69.0, 278.0, 137.8, 78.91108920804477, 85.0, 144958.49609375, 462785959.2437744, 210317969.3222046, 211827960.3342278, 189170479.7744751], label=0), Instance(features=[266.0, 1448.0, 765.75, 445.5818527498623, 674.5, 735998.1536865234, 312245845.79467773, 104909976.32344563, 146609181.51557696, 1748085.0219726562], label=0), Instance(features=[266.0, 1460.0, 764.75, 449.50382367672916, 666.5, 22888.18359375, 310250997.54333496, 104106028.87471516, 145768840.9933372, 2044200.8972167969], label=0), Instance(features=[266.0, 1460.0, 765.75, 449.66341579007735, 668.5, 1394033.432006836, 354246139.5263672, 131862004.59798177, 158034992.041647, 39945840.83557129], label=0), Instance(features=[266.0, 1460.0, 765.75, 449.66341579007735, 668.5, 732183.4564208984, 367688894.2718506, 184210538.86413574, 183478355.40771484, 184210538.86413574], label=0), Instance(features=[498.0, 1460.0, 1029.8, 421.0332053413365, 1165.0, 12159.347534179688, 21399974.822998047, 6167769.432067871, 8891484.75069979, 1629471.778869629], label=0), Instance(features=[283.0, 1460.0, 1029.8, 530.7814616205053, 1460.0, 20980.8349609375, 9747028.350830078, 3273328.1453450522, 4577614.802952686, 51975.250244140625], label=0), Instance(features=[498.0, 1460.0, 1029.8, 421.0332053413365, 1165.0, 11920.928955078125, 1834154.1290283203, 668287.2772216797, 746585.1773631036, 413537.02545166016], label=0), Instance(features=[498.0, 1460.0, 1029.8, 421.0332053413365, 1165.0, 15974.044799804688, 44844865.798950195, 15847980.976104736, 18356636.896544904, 9265542.030334473], label=0), Instance(features=[92.0, 1460.0, 793.2, 562.4540514566501, 498.0, 15974.044799804688, 309867143.63098145, 90308785.4385376, 128479053.49490911, 25676012.03918457], label=0), Instance(features=[114.0, 1460.0, 770.0, 576.3374011809402, 498.0, 12874.603271484375, 198775053.024292, 67333757.87734985, 81160540.5818586, 35273551.94091797], label=0), Instance(features=[69.0, 164.0, 110.6, 38.58808106138474, 85.0, 240087.50915527344, 363121986.38916016, 141678988.93356323, 152320843.3736875, 101676940.91796875], label=0), Instance(features=[266.0, 1460.0, 918.0, 542.2563969193909, 973.0, 73909.75952148438, 123717069.62585449, 69681644.43969727, 51664174.322677545, 85253953.93371582], label=0), Instance(features=[75.0, 517.0, 369.6666666666667, 208.360798189636, 517.0, 4271030.426025391, 395777940.7501221, 200024485.58807373, 195753455.16204834, 200024485.58807373], label=0), Instance(features=[203.0, 517.0, 360.0, 157.0, 360.0, 275189876.5563965, 275189876.5563965, 275189876.5563965, 0.0, 275189876.5563965], label=0), Instance(features=[302.0, 1460.0, 807.6, 537.1113850962387, 498.0, 12874.603271484375, 205285072.32666016, 56649982.92922974, 86251862.02980827, 10650992.393493652], label=0), Instance(features=[75.0, 1365.0, 844.6, 496.0006451608707, 917.0, 558137.8936767578, 5907773017.883301, 1607518017.2920227, 2485026948.507088, 260870456.69555664], label=0), Instance(features=[247.0, 1460.0, 827.4, 523.8402810017573, 498.0, 12159.347534179688, 265039920.80688477, 66994488.23928833, 114347651.69753249, 1462936.4013671875], label=0), Instance(features=[472.0, 1460.0, 1033.75, 436.88578312872573, 1101.5, 20027.16064453125, 286478042.60253906, 95511039.09810384, 135034063.30009258, 35047.53112792969], label=0), Instance(features=[318.0, 1460.0, 838.4, 511.01686860611557, 498.0, 30994.415283203125, 304636955.26123047, 87099254.13131714, 126778600.46064155, 21864533.42437744], label=0), Instance(features=[266.0, 1460.0, 892.8, 490.89730086852177, 780.0, 24080.276489257812, 301223039.6270752, 76725006.10351562, 129634012.70485088, 2826452.2552490234], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 317806959.1522217, 317806959.1522217, 317806959.1522217, 0.0, 317806959.1522217], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 388973951.3397217, 388973951.3397217, 388973951.3397217, 0.0, 388973951.3397217], label=0), Instance(features=[112.0, 1460.0, 918.8, 535.7008120210385, 1064.0, 22888.18359375, 988006.591796875, 530779.3617248535, 408667.26212039025, 556111.3357543945], label=0), Instance(features=[566.0, 1460.0, 1033.2, 390.6519678690996, 1070.0, 10013.580322265625, 11563062.66784668, 3137767.3149108887, 4879949.3086357685, 488996.5057373047], label=0), Instance(features=[282.0, 1460.0, 909.8, 484.32402376921175, 849.0, 11920.928955078125, 283659934.9975586, 73796749.11499023, 121254851.01171769, 5757570.266723633], label=0), Instance(features=[302.0, 1460.0, 838.4, 511.9803121214721, 498.0, 13113.021850585938, 281206846.2371826, 74366509.9143982, 119602227.27232686, 8123040.199279785], label=0), Instance(features=[498.0, 1460.0, 1086.4, 453.1973521546656, 1448.0, 15020.370483398438, 13982057.571411133, 3636956.214904785, 5975953.734322401, 275373.4588623047], label=0), Instance(features=[498.0, 1460.0, 1214.0, 369.50994573894764, 1448.0, 44107.43713378906, 9217977.523803711, 4818737.506866455, 3316813.464951306, 5006432.53326416], label=0), Instance(features=[230.0, 1460.0, 896.0, 548.6113378339898, 1064.0, 11205.673217773438, 302710056.30493164, 76157748.69918823, 130802256.44974475, 954866.4093017578], label=0), Instance(features=[51.0, 1460.0, 724.0, 544.1723072704086, 692.5, 41961.669921875, 391793012.61901855, 229004621.5057373, 166636324.29265845, 295178890.2282715], label=0), Instance(features=[154.0, 1460.0, 1119.6, 506.5750092533188, 1460.0, 4053.1158447265625, 338228940.9637451, 85055232.04803467, 146171985.31614003, 993967.0562744141], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 205670118.33190918, 205670118.33190918, 205670118.33190918, 0.0, 205670118.33190918], label=0), Instance(features=[498.0, 1460.0, 1191.6, 364.7736832612792, 1388.0, 25033.950805664062, 17818927.764892578, 4705011.84463501, 7580545.560745716, 488042.83142089844], label=0), Instance(features=[498.0, 1460.0, 1088.8, 455.13356281425786, 1460.0, 10013.580322265625, 38522005.08117676, 9644508.361816406, 16672432.816320054, 23007.39288330078], label=0), Instance(features=[532.0, 1460.0, 1191.6, 366.7116578457794, 1460.0, 20027.16064453125, 846862.79296875, 256001.94931030273, 343350.83213370305, 78558.92181396484], label=0), Instance(features=[514.0, 1460.0, 1191.6, 371.89762032043177, 1460.0, 10013.580322265625, 890016.5557861328, 236511.23046875, 377434.79666208074, 23007.39288330078], label=0), Instance(features=[180.0, 599.0, 447.4, 143.08822453297827, 498.0, 1609802.24609375, 81108537197.11304, 20429762005.80597, 35033619360.69005, 304450511.93237305], label=0), Instance(features=[266.0, 1460.0, 1083.0, 440.00272726427505, 1199.0, 1021862.0300292969, 331479072.5708008, 166250467.30041504, 165228605.27038574, 166250467.30041504], label=0), Instance(features=[266.0, 1460.0, 1083.0, 437.9114065653006, 1165.0, 12159.347534179688, 239316940.3076172, 60148477.55432129, 103444153.28565085, 632405.2810668945], label=0), Instance(features=[266.0, 1460.0, 1083.0, 437.9114065653006, 1165.0, 38146.97265625, 310812950.13427734, 77934980.39245605, 134452544.39998987, 444412.2314453125], label=0), Instance(features=[69.0, 517.0, 191.8, 169.57169575138417, 85.0, 130891.79992675781, 17819832086.56311, 4543594241.142273, 7666402234.468327, 177206993.10302734], label=0), Instance(features=[266.0, 1460.0, 765.75, 449.66341579007735, 668.5, 705957.4127197266, 268321037.29248047, 108160018.92089844, 115435336.07208605, 55453062.05749512], label=0), Instance(features=[266.0, 1460.0, 765.75, 449.66341579007735, 668.5, 41007.99560546875, 284489870.07141113, 103950977.32543945, 128145185.1403774, 27322053.909301758], label=0), Instance(features=[180.0, 1460.0, 802.2, 547.0920946239308, 498.0, 16212.46337890625, 17501767873.764038, 4593563735.485077, 7461061224.855642, 436235427.8564453], label=0), Instance(features=[180.0, 1460.0, 787.0, 500.1127872790297, 498.0, 49019098.28186035, 15566764116.287231, 4286816298.9616394, 6535877782.240981, 765740990.6387329], label=0), Instance(features=[180.0, 1460.0, 1170.6, 498.75990215734066, 1448.0, 1953840.2557373047, 17468115806.57959, 4593526244.163513, 7441991013.864291, 452017664.9093628], label=0), Instance(features=[114.0, 1460.0, 800.8, 555.0821200507183, 498.0, 12874.603271484375, 288254022.5982666, 96975982.18917847, 117678743.18217297, 49818515.77758789], label=0), Instance(features=[180.0, 1460.0, 1124.8, 496.6730916810372, 1460.0, 24080.276489257812, 419086933.1359863, 105257749.55749512, 181190881.50117153, 959992.4087524414], label=0), Instance(features=[344.0, 1460.0, 838.4, 493.33055855075514, 498.0, 24080.276489257812, 372086048.1262207, 106401741.50466919, 154036760.79917333, 26748418.8079834], label=0), Instance(features=[154.0, 1460.0, 1119.6, 506.5750092533188, 1460.0, 5960.4644775390625, 889743089.6759033, 222645521.16394043, 385149103.48257643, 416517.2576904297], label=0), Instance(features=[53.0, 819.0, 387.5, 297.2158306685564, 339.0, 39870977.4017334, 60960207939.14795, 20436065594.355267, 28655105114.495094, 308117866.5161133], label=0), Instance(features=[53.0, 659.0, 347.5, 242.1099956631283, 339.0, 39777994.15588379, 60982697963.7146, 20449623982.111614, 28661450326.960552, 326395988.46435547], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 314588069.9157715, 314588069.9157715, 314588069.9157715, 0.0, 314588069.9157715], label=0), Instance(features=[266.0, 1460.0, 902.2, 486.0372002223698, 839.0, 19073.486328125, 372415065.76538086, 175015985.96572876, 174527868.14289537, 163814902.30560303], label=0), Instance(features=[367.0, 1460.0, 951.0, 467.0511749262601, 996.0, 11920.928955078125, 453582048.4161377, 200553715.22903442, 203938567.07168227, 174310445.78552246], label=0), Instance(features=[498.0, 1460.0, 1007.6, 416.2180197925121, 1054.0, 40054.3212890625, 37325143.814086914, 16097784.042358398, 16392060.92261857, 13512969.017028809], label=0), Instance(features=[164.0, 1460.0, 708.0, 450.9079728725142, 721.0, 84877.01416015625, 59169657945.632935, 14945246458.053589, 25533566151.55131, 305621504.7836304], label=0), Instance(features=[154.0, 1460.0, 827.6, 534.9144230622315, 566.0, 5006.7901611328125, 335884094.23828125, 84220290.184021, 145298381.37850446, 496029.8538208008], label=0), Instance(features=[271.0, 1460.0, 931.8, 491.9725195577493, 996.0, 1320123.6724853516, 365045785.90393066, 222310304.64172363, 158465428.11415598, 300565004.3487549], label=0), Instance(features=[180.0, 1460.0, 1009.2, 556.3964054520842, 1448.0, 25033.950805664062, 14438995838.165283, 3619478702.545166, 6246671188.375674, 19446969.032287598], label=0), Instance(features=[180.0, 1460.0, 1124.8, 496.6730916810372, 1460.0, 6198.883056640625, 13740953922.271729, 3435414254.6653748, 5949906106.022429, 348448.7533569336], label=0), Instance(features=[180.0, 1347.0, 738.8, 443.8312291851487, 498.0, 7065057.754516602, 14477946043.014526, 4058396756.6490173, 6055003527.475111, 874287962.9135132], label=0), Instance(features=[266.0, 1460.0, 1021.0, 536.2219689643459, 1337.0, 33140.18249511719, 360765933.9904785, 180399537.08648682, 180366396.9039917, 180399537.08648682], label=0), Instance(features=[266.0, 1460.0, 1021.0, 536.2219689643459, 1337.0, 27894.973754882812, 399661064.1479492, 199844479.56085205, 199816584.58709717, 199844479.56085205], label=0), Instance(features=[180.0, 1460.0, 791.0, 555.4544085701364, 498.0, 50067.901611328125, 12546051025.390625, 3418325245.3804016, 5289466975.367775, 563599944.114685], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 325339078.90319824, 325339078.90319824, 325339078.90319824, 0.0, 325339078.90319824], label=0), Instance(features=[266.0, 1460.0, 918.0, 542.2563969193909, 973.0, 133991.24145507812, 155073881.149292, 59573332.46866862, 68200197.37709245, 23512125.01525879], label=0), Instance(features=[101.0, 741.0, 352.6, 235.41503775247665, 243.0, 2941131.591796875, 3015913963.317871, 847359299.659729, 1254435935.2671611, 185291051.86462402], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 337796926.4984131, 337796926.4984131, 337796926.4984131, 0.0, 337796926.4984131], label=0), Instance(features=[22.0, 1460.0, 452.2, 529.2003023430731, 180.0, 532150.2685546875, 2548447847.366333, 683387756.3476562, 1078091983.9144962, 92285513.87786865], label=0), Instance(features=[283.0, 1460.0, 1029.8, 526.4136776338548, 1448.0, 10967.254638671875, 1724958.4197998047, 703752.0408630371, 726735.3480454262, 539541.2445068359], label=0), Instance(features=[180.0, 1460.0, 863.8, 464.21822454531014, 996.0, 1472949.9816894531, 335441827.77404785, 144180715.08407593, 131827011.1612705, 119904041.2902832], label=0), Instance(features=[180.0, 1460.0, 809.4, 524.4591881166732, 498.0, 40737152.099609375, 300920009.6130371, 161628544.33059692, 109353491.47627816, 152428507.8048706], label=0), Instance(features=[180.0, 1460.0, 739.0, 458.45043352580655, 498.0, 22044181.82373047, 256494998.93188477, 135958790.77911377, 105756466.66341457, 132647991.18041992], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 331628084.18273926, 331628084.18273926, 331628084.18273926, 0.0, 331628084.18273926], label=0), Instance(features=[180.0, 1460.0, 1011.6, 558.3065824437323, 1460.0, 9059.906005859375, 294625997.54333496, 74688732.62405396, 126991371.99631166, 2059936.5234375], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 285554885.8642578, 285554885.8642578, 285554885.8642578, 0.0, 285554885.8642578], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 355246067.04711914, 355246067.04711914, 355246067.04711914, 0.0, 355246067.04711914], label=0), Instance(features=[180.0, 1460.0, 1009.8, 471.6865060609642, 1064.0, 77009.20104980469, 341979026.7944336, 85746228.69491577, 147936229.57004938, 464439.39208984375], label=0), Instance(features=[185.0, 1460.0, 815.0, 537.9754641245268, 498.0, 953.67431640625, 289327144.62280273, 107834339.1418457, 129090908.0447468, 34174919.12841797], label=0), Instance(features=[266.0, 1460.0, 918.0, 542.2563969193909, 973.0, 31948.089599609375, 163197040.55786133, 75778722.76306152, 67121186.61629394, 64107179.64172363], label=0), Instance(features=[180.0, 1460.0, 832.8, 528.428008341723, 566.0, 39815.90270996094, 323179006.5765381, 81485748.29101562, 139544836.87364933, 1362085.3424072266], label=0), Instance(features=[180.0, 1460.0, 1011.6, 558.3065824437323, 1460.0, 5006.7901611328125, 317117929.45861816, 79771220.68405151, 137034419.31773517, 980973.2437133789], label=0), Instance(features=[498.0, 1460.0, 1029.8, 421.0332053413365, 1165.0, 29087.066650390625, 27698993.682861328, 8252203.464508057, 11427034.255290747, 2640366.554260254], label=0), Instance(features=[498.0, 1460.0, 1029.8, 421.0332053413365, 1165.0, 13828.277587890625, 46239137.64953613, 13513028.621673584, 19157407.009656448, 3899574.2797851562], label=0), Instance(features=[498.0, 1460.0, 1029.8, 421.0332053413365, 1165.0, 102996.826171875, 59205055.236816406, 19073486.328125, 24144027.479256514, 8492946.62475586], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 189449071.88415527, 189449071.88415527, 189449071.88415527, 0.0, 189449071.88415527], label=0), Instance(features=[474.0, 1460.0, 1029.8, 450.2196797120268, 1257.0, 101089.4775390625, 14524936.67602539, 5328238.010406494, 5924671.363884872, 3343462.9440307617], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 291363954.5440674, 291363954.5440674, 291363954.5440674, 0.0, 291363954.5440674], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 291086912.15515137, 291086912.15515137, 291086912.15515137, 0.0, 291086912.15515137], label=0), Instance(features=[283.0, 1460.0, 853.4, 504.02206300915043, 566.0, 10013.580322265625, 32567977.905273438, 8396506.309509277, 13961074.622799322, 504016.8762207031], label=0), Instance(features=[180.0, 1460.0, 776.2, 567.672581687719, 498.0, 30040.740966796875, 314578056.3354492, 84946751.59454346, 132960627.15831636, 12589454.650878906], label=0), Instance(features=[180.0, 1460.0, 832.8, 528.428008341723, 566.0, 30994.415283203125, 335455894.47021484, 92184722.42355347, 141053038.56879073, 16626000.40435791], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 315080881.1187744, 315080881.1187744, 315080881.1187744, 0.0, 315080881.1187744], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 375045061.1114502, 375045061.1114502, 375045061.1114502, 0.0, 375045061.1114502], label=0), Instance(features=[266.0, 1460.0, 918.0, 542.2563969193909, 973.0, 206947.32666015625, 148854017.25769043, 78549385.07080078, 60950485.85205471, 86587190.62805176], label=0), Instance(features=[154.0, 1460.0, 1006.4, 566.0945504065553, 1460.0, 5006.7901611328125, 338291883.4686279, 85260450.83999634, 146091894.377619, 1372456.5505981445], label=0), Instance(features=[24.0, 90.0, 57.0, 33.0, 57.0, 21488189.697265625, 21488189.697265625, 21488189.697265625, 0.0, 21488189.697265625], label=0), Instance(features=[24.0, 90.0, 57.0, 33.0, 57.0, 2779006.9580078125, 2779006.9580078125, 2779006.9580078125, 0.0, 2779006.9580078125], label=0), Instance(features=[24.0, 42.0, 33.0, 9.0, 33.0, 2288818.359375, 2288818.359375, 2288818.359375, 0.0, 2288818.359375], label=0), Instance(features=[180.0, 1460.0, 1011.6, 558.3065824437323, 1460.0, 32901.763916015625, 522522926.3305664, 147658467.29278564, 217918602.25774756, 34039020.53833008], label=0), Instance(features=[180.0, 1460.0, 832.8, 528.428008341723, 566.0, 23841.85791015625, 590304136.2762451, 171848475.93307495, 244806940.30037817, 48532962.799072266], label=0), Instance(features=[34.0, 1460.0, 918.8, 664.4379278758852, 1460.0, 12874.603271484375, 817779064.1784668, 204926252.3651123, 353831564.01913106, 956535.3393554688], label=0), Instance(features=[180.0, 1460.0, 832.8, 528.428008341723, 566.0, 12159.347534179688, 393916130.06591797, 98679244.51828003, 170455180.7013458, 394344.3298339844], label=0), Instance(features=[180.0, 1460.0, 832.8, 528.428008341723, 566.0, 127077.10266113281, 664869070.0531006, 230298360.1888021, 307467964.237317, 25898933.41064453], label=0), Instance(features=[180.0, 1460.0, 832.8, 528.428008341723, 566.0, 30994.415283203125, 961080074.3103027, 246674776.0772705, 412566646.4570605, 12794017.791748047], label=0), Instance(features=[75.0, 517.0, 369.6666666666667, 208.360798189636, 517.0, 303983.6883544922, 722588062.286377, 361446022.9873657, 361142039.29901123, 361446022.9873657], label=0), Instance(features=[180.0, 1460.0, 1011.6, 558.3065824437323, 1460.0, 4053.1158447265625, 654654026.0314941, 173334300.5180359, 278336882.42770785, 19339561.462402344], label=0), Instance(features=[152.0, 1430.0, 702.0, 440.1399777343567, 498.0, 2140998.8403320312, 86138963.69934082, 37965476.512908936, 31358067.098501, 31790971.755981445], label=0), Instance(features=[266.0, 1460.0, 734.4, 427.8511890833073, 498.0, 9660959.243774414, 310178995.1324463, 98984479.9041748, 123893619.96474949, 38048982.62023926], label=0), Instance(features=[498.0, 1460.0, 1088.8, 455.13356281425786, 1460.0, 16927.719116210938, 65076112.74719238, 17923533.91647339, 27353815.503475018, 3300547.5997924805], label=0), Instance(features=[348.0, 1460.0, 838.4, 497.78935304001834, 498.0, 166177.74963378906, 390552997.5891113, 100378513.33618164, 167556897.8167548, 5397439.002990723], label=0), Instance(features=[266.0, 1460.0, 1086.4, 438.29378275307533, 1176.0, 12159.347534179688, 589874029.1595459, 157080292.7017212, 250335464.23282778, 19217491.149902344], label=0), Instance(features=[498.0, 1460.0, 918.8, 446.7493256849976, 678.0, 165939.3310546875, 2074003.2196044922, 944733.6196899414, 699724.5024022621, 769495.964050293], label=0), Instance(features=[498.0, 1460.0, 975.6, 430.27321552706485, 962.0, 20863056.182861328, 54913997.650146484, 35954713.82141113, 14167699.247757833, 32087087.631225586], label=0), Instance(features=[150.0, 1381.0, 800.4, 545.9126670081946, 933.0, 328850030.89904785, 2381392955.7800293, 1448256492.614746, 818344783.5007114, 1541391491.8899536], label=0), Instance(features=[258.0, 1460.0, 848.4, 509.74723147850443, 566.0, 13113.021850585938, 20050048.828125, 5194783.2107543945, 8580944.696644109, 357985.4965209961], label=0), Instance(features=[498.0, 1460.0, 1088.8, 455.13356281425786, 1460.0, 10967.254638671875, 15133142.471313477, 4010498.523712158, 6431045.548357127, 448942.1844482422], label=0), Instance(features=[59.0, 870.0, 555.0, 296.2309909513183, 498.0, 555038.4521484375, 289527177.81066895, 112341761.5890503, 107875994.61652163, 79642415.0466919], label=0), Instance(features=[498.0, 1460.0, 819.2, 362.57214454505464, 678.0, 561952.5909423828, 42387008.66699219, 16403257.846832275, 17272189.08844017, 11332035.064697266], label=0), Instance(features=[2.0, 498.0, 202.0, 241.70064129000568, 10.0, 1943111.4196777344, 2193044900.894165, 698347032.0701599, 882749467.7892686, 299200057.98339844], label=0), Instance(features=[59.0, 1460.0, 651.2, 460.40477842872133, 498.0, 202894.2108154297, 567331075.668335, 246367990.97061157, 249406106.4863269, 208968997.00164795], label=0), Instance(features=[2.0, 1221.0, 308.75, 526.6979091471695, 6.0, 962018.9666748047, 938365936.2792969, 403788010.2793376, 393870076.09840626, 272036075.592041], label=0), Instance(features=[2.0, 836.0, 212.5, 359.99270825948685, 6.0, 5804061.8896484375, 373600959.77783203, 243480364.48160806, 168314808.52449718, 351036071.77734375], label=0), Instance(features=[154.0, 1460.0, 827.6, 534.9144230622315, 566.0, 117063.52233886719, 488145112.991333, 123109757.90023804, 210758545.11926955, 2088427.5436401367], label=0), Instance(features=[33.0, 241.0, 192.8, 80.22318866761655, 232.0, 372215032.57751465, 2143828868.8659668, 920712471.0083008, 717099898.1666881, 583402991.2948608], label=0), Instance(features=[8.0, 1460.0, 639.6, 473.494920775292, 498.0, 38059949.87487793, 646749019.6228027, 320077240.46707153, 263270761.66282758, 297749996.18530273], label=0), Instance(features=[8.0, 498.0, 317.8, 222.1084419827396, 498.0, 42990207.67211914, 351454973.2208252, 206649541.8548584, 130371898.67738624, 216076493.26324463], label=0), Instance(features=[31.0, 238.0, 190.0, 79.82480817390042, 229.0, 526228904.7241211, 1918848037.7197266, 943273484.7068787, 573832515.6496229, 664008498.1918335], label=0), Instance(features=[2.0, 1440.0, 390.4, 558.5071530428236, 10.0, 978946.6857910156, 1177330970.7641602, 417551994.32373047, 472848695.5347159, 245949029.92248535], label=0), Instance(features=[180.0, 1460.0, 570.4, 456.096744123437, 357.0, 2575159.0728759766, 10647056818.008423, 2890199542.0455933, 4483737935.254644, 455583095.5505371], label=0), Instance(features=[180.0, 1460.0, 1124.8, 496.6730916810372, 1460.0, 10967.254638671875, 419295072.555542, 107474029.06417847, 180080459.7312228, 5295038.223266602], label=0), Instance(features=[180.0, 1460.0, 1124.8, 496.6730916810372, 1460.0, 3099.4415283203125, 555128097.5341797, 138786792.75512695, 240374764.4064652, 7987.022399902344], label=0), Instance(features=[180.0, 1460.0, 912.0, 511.9234317747138, 962.0, 953.67431640625, 510086774.8260498, 128070235.25238037, 220557845.78841338, 1096606.2545776367], label=0), Instance(features=[180.0, 1460.0, 1124.8, 496.6730916810372, 1460.0, 3099.4415283203125, 388364791.8701172, 97105741.50085449, 168158491.59047666, 27537.34588623047], label=0), Instance(features=[180.0, 1460.0, 1124.8, 496.6730916810372, 1460.0, 33855.438232421875, 418956995.010376, 107304990.29159546, 179979493.35314205, 5114555.358886719], label=0), Instance(features=[180.0, 1460.0, 1018.4, 552.1831580191486, 1460.0, 9059.906005859375, 445860147.4761963, 111710011.95907593, 192922054.29072875, 485420.22705078125], label=0), Instance(features=[181.0, 1460.0, 754.8, 542.1451466166602, 498.0, 33140.18249511719, 342921972.2747803, 188220739.36462402, 146841487.73932418, 204963922.50061035], label=0), Instance(features=[266.0, 1460.0, 918.0, 542.2563969193909, 973.0, 49114.227294921875, 235726833.34350586, 93728303.90930176, 102101471.64307055, 45408964.15710449], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 504688024.520874, 504688024.520874, 504688024.520874, 0.0, 504688024.520874], label=0), Instance(features=[282.0, 1460.0, 909.8, 484.32402376921175, 849.0, 15020.370483398438, 376907110.2142334, 97098767.75741577, 161614405.22351533, 5736470.2224731445], label=0), Instance(features=[154.0, 1460.0, 827.6, 534.9144230622315, 566.0, 986099.2431640625, 469647884.3688965, 118360757.82775879, 202815948.34682304, 1404523.8494873047], label=0), Instance(features=[24.0, 90.0, 57.0, 33.0, 57.0, 3365039.825439453, 3365039.825439453, 3365039.825439453, 0.0, 3365039.825439453], label=0), Instance(features=[24.0, 90.0, 57.0, 33.0, 57.0, 2835035.3240966797, 2835035.3240966797, 2835035.3240966797, 0.0, 2835035.3240966797], label=0), Instance(features=[24.0, 42.0, 33.0, 9.0, 33.0, 1801013.9465332031, 1801013.9465332031, 1801013.9465332031, 0.0, 1801013.9465332031], label=0), Instance(features=[2.0, 498.0, 219.0, 229.72853544999583, 87.0, 126734972.00012207, 3099634170.5322266, 1003837764.2631531, 1226325242.040202, 394490957.26013184], label=0), Instance(features=[2.0, 480.0, 164.0, 223.4696101635895, 10.0, 304587841.03393555, 3435501098.6328125, 1870044469.833374, 1565456628.7994385, 1870044469.833374], label=0), Instance(features=[2.0, 167.0, 59.666666666666664, 75.96636682696422, 10.0, 569247007.3699951, 3196852922.439575, 1883049964.9047852, 1313802957.53479, 1883049964.9047852], label=0), Instance(features=[180.0, 1460.0, 678.0, 440.5219631301032, 498.0, 7867.8131103515625, 3060411930.0842285, 903623998.1651306, 1261708660.5246222, 277038097.3815918], label=0), Instance(features=[154.0, 1460.0, 827.6, 534.9144230622315, 566.0, 25987.625122070312, 338664054.87060547, 85038542.74749756, 146431309.0040922, 732064.2471313477], label=0), Instance(features=[302.0, 1460.0, 807.6, 537.1113850962387, 498.0, 23841.85791015625, 297491073.60839844, 89486002.9220581, 122500895.36542992, 30214548.110961914], label=0), Instance(features=[318.0, 1430.0, 847.0, 482.56895880278086, 559.0, 593185.4248046875, 245357036.59057617, 77455759.04846191, 98688534.91768344, 31936407.0892334], label=0), Instance(features=[154.0, 1460.0, 827.6, 534.9144230622315, 566.0, 77962.87536621094, 471239805.2215576, 118166208.26721191, 203847644.9187018, 673532.4859619141], label=0), Instance(features=[498.0, 1460.0, 1029.8, 417.3988021065705, 1152.0, 26941.299438476562, 977993.0114746094, 479519.3672180176, 418736.41687141336, 456571.5789794922], label=0), Instance(features=[69.0, 278.0, 137.8, 78.91108920804477, 85.0, 296831.1309814453, 1197694063.1866455, 591389238.8343811, 591150157.4917392, 583783030.5099487], label=0), Instance(features=[472.0, 1460.0, 982.8, 422.88504348108603, 1030.0, 953.67431640625, 1366235017.7764893, 667799234.3902588, 665230364.2959077, 652480483.0551147], label=0), Instance(features=[180.0, 1460.0, 1011.6, 558.3065824437323, 1460.0, 8106.231689453125, 2292271137.237549, 573611259.4604492, 992269102.6882776, 1082897.1862792969], label=0), Instance(features=[203.0, 517.0, 360.0, 157.0, 360.0, 567649126.0528564, 567649126.0528564, 567649126.0528564, 0.0, 567649126.0528564], label=0), Instance(features=[181.0, 1460.0, 754.8, 542.1451466166602, 498.0, 38146.97265625, 870161056.5185547, 329583287.2390747, 337138127.7573473, 224066972.73254395], label=0), Instance(features=[180.0, 1460.0, 1011.6, 558.3065824437323, 1460.0, 15974.044799804688, 726923942.565918, 197869479.65621948, 306582541.1126966, 32269001.007080078], label=0), Instance(features=[180.0, 1460.0, 626.2, 434.6034514359038, 498.0, 46968.46008300781, 1328106880.1879883, 465326488.0180359, 529519613.17227066, 266576051.71203613], label=0), Instance(features=[75.0, 517.0, 369.6666666666667, 208.360798189636, 517.0, 650882.7209472656, 581269025.8026123, 290959954.2617798, 290309071.5408325, 290959954.2617798], label=0), Instance(features=[498.0, 1460.0, 1029.8, 421.0332053413365, 1165.0, 11920.928955078125, 46281099.31945801, 16216278.076171875, 18932301.348393407, 9286046.028137207], label=0), Instance(features=[180.0, 1460.0, 840.2, 524.8871878794528, 603.0, 69141.38793945312, 318445205.68847656, 95492303.37142944, 129931438.79680015, 31727433.20465088], label=0), Instance(features=[180.0, 1460.0, 832.8, 528.428008341723, 566.0, 12159.347534179688, 406101942.0623779, 117814540.86303711, 168551060.01701063, 32572031.021118164], label=0), Instance(features=[53.0, 1460.0, 556.4, 493.19148411139463, 498.0, 43503046.0357666, 61333158969.87915, 15479937732.219696, 26473806729.038822, 271544456.4819336], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 445397138.59558105, 445397138.59558105, 445397138.59558105, 0.0, 445397138.59558105], label=0), Instance(features=[180.0, 1460.0, 1011.6, 558.3065824437323, 1460.0, 30994.415283203125, 552266120.9106445, 138715267.18139648, 238764566.59883955, 1281976.6998291016], label=0), Instance(features=[180.0, 1460.0, 1124.8, 496.6730916810372, 1460.0, 16927.719116210938, 473403215.4083252, 118538260.4598999, 204881571.78311145, 366449.35607910156], label=0), Instance(features=[75.0, 1013.0, 623.8, 355.13963451014587, 517.0, 149011.61193847656, 27237824201.583862, 7440325021.743774, 11474517097.939096, 1261663436.8896484], label=0), Instance(features=[75.0, 757.0, 449.6666666666667, 282.4669105498121, 517.0, 717878.3416748047, 1104288101.196289, 552502989.7689819, 551785111.4273071, 552502989.7689819], label=0), Instance(features=[59.0, 1460.0, 783.0, 572.9020858750647, 498.0, 14066.696166992188, 105442047.11914062, 41730284.69085693, 44515775.417278856, 30732512.47406006], label=0), Instance(features=[266.0, 1460.0, 834.0, 513.2812094748842, 498.0, 46014.78576660156, 794950008.392334, 309257745.74279785, 299486283.1011046, 221017479.8965454], label=0), Instance(features=[498.0, 1460.0, 1029.8, 421.0332053413365, 1165.0, 10967.254638671875, 88099956.51245117, 27053773.403167725, 36184203.78196522, 10052084.922790527], label=0), Instance(features=[68.0, 1460.0, 796.8, 563.8050726980026, 498.0, 12159.347534179688, 2629995.346069336, 814259.0522766113, 1074616.7856355452, 307440.75775146484], label=0), Instance(features=[498.0, 1460.0, 1029.8, 421.0332053413365, 1165.0, 32901.763916015625, 10974168.77746582, 2910017.967224121, 4657279.107689708, 316500.6637573242], label=0), Instance(features=[237.0, 1460.0, 1029.8, 535.0799566419958, 1460.0, 23126.602172851562, 4546880.722045898, 1162230.9684753418, 1954171.0198809756, 39458.274841308594], label=0), Instance(features=[203.0, 1460.0, 1029.8, 539.244805260097, 1460.0, 10013.580322265625, 37044048.30932617, 9280204.772949219, 16029468.676431127, 33378.60107421875], label=0), Instance(features=[498.0, 1460.0, 996.0, 415.5709325734898, 996.0, 943899.1546630859, 4358053.207397461, 2650976.1810302734, 1707077.0263671875, 2650976.1810302734], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 649086952.2094727, 649086952.2094727, 649086952.2094727, 0.0, 649086952.2094727], label=0), Instance(features=[22.0, 1460.0, 603.6, 515.167390272327, 498.0, 492811.2030029297, 441520214.08081055, 146568536.75842285, 176774332.04314804, 72130560.87493896], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 625500917.4346924, 625500917.4346924, 625500917.4346924, 0.0, 625500917.4346924], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 675348997.1160889, 675348997.1160889, 675348997.1160889, 0.0, 675348997.1160889], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 675944089.8895264, 675944089.8895264, 675944089.8895264, 0.0, 675944089.8895264], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 738692998.8861084, 738692998.8861084, 738692998.8861084, 0.0, 738692998.8861084], label=0), Instance(features=[69.0, 278.0, 137.8, 78.91108920804477, 85.0, 296115.8752441406, 708487033.8439941, 288230001.9264221, 302737952.46875507, 222068428.9932251], label=0), Instance(features=[75.0, 901.0, 598.5, 340.4801756343532, 709.0, 106811.5234375, 51745048999.78638, 17486811955.769855, 24225991169.47778, 715280055.9997559], label=0), Instance(features=[69.0, 164.0, 110.6, 38.58808106138474, 85.0, 7867.8131103515625, 718745946.8841553, 284462988.37661743, 303483445.959548, 209549069.40460205], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 599241971.9696045, 599241971.9696045, 599241971.9696045, 0.0, 599241971.9696045], label=0), Instance(features=[498.0, 1460.0, 1029.8, 421.0332053413365, 1165.0, 89168.54858398438, 104675054.5501709, 26550233.364105225, 45106454.76716195, 718355.1788330078], label=0), Instance(features=[283.0, 1460.0, 853.4, 504.02206300915043, 566.0, 23126.602172851562, 40792942.04711914, 11340975.761413574, 17101562.289949346, 2273917.1981811523], label=0), Instance(features=[154.0, 1460.0, 827.6, 534.9144230622315, 566.0, 18119.81201171875, 664000988.0065918, 174796760.08224487, 282797308.32992625, 17583966.25518799], label=0), Instance(features=[180.0, 1460.0, 1124.8, 496.6730916810372, 1460.0, 2861.02294921875, 10182879924.77417, 2545726239.681244, 4409312735.933577, 11086.463928222656], label=0), Instance(features=[68.0, 1460.0, 744.0, 600.4838049439801, 498.0, 22888.18359375, 65099954.60510254, 23232996.463775635, 26697281.51189973, 13904571.533203125], label=0), Instance(features=[247.0, 1460.0, 827.4, 523.8402810017573, 498.0, 11920.928955078125, 642252922.0581055, 183723449.70703125, 267416144.95062873, 46314477.92053223], label=0), Instance(features=[154.0, 1460.0, 827.6, 534.9144230622315, 566.0, 103950.50048828125, 1418726921.081543, 361808240.4136658, 610309144.3732666, 14201045.036315918], label=0), Instance(features=[319.0, 1460.0, 902.2, 481.231919140865, 800.0, 537429094.3145752, 1247168064.1174316, 892298579.2160034, 354869484.9014282, 892298579.2160034], label=0), Instance(features=[302.0, 1460.0, 838.4, 511.9803121214721, 498.0, 21934.50927734375, 1205783128.7384033, 305353522.3007202, 519901893.1031451, 7804512.977600098], label=0), Instance(features=[154.0, 1460.0, 827.6, 534.9144230622315, 566.0, 47922.13439941406, 786674022.6745605, 197611987.5907898, 340096592.33623815, 1863002.7770996094], label=0), Instance(features=[367.0, 1460.0, 950.8, 467.03207598622174, 995.0, 16212.46337890625, 783121824.2645264, 383275508.88061523, 383423217.02048695, 374981999.39727783], label=0), Instance(features=[498.0, 1460.0, 1029.8, 421.0332053413365, 1165.0, 43153.76281738281, 4935979.843139648, 1843035.2210998535, 2005357.0042010501, 1196503.6392211914], label=0), Instance(features=[498.0, 1460.0, 1029.8, 421.0332053413365, 1165.0, 12159.347534179688, 57806015.01464844, 25634765.625, 26036034.08913767, 22360444.06890869], label=0), Instance(features=[34.0, 1460.0, 989.2, 597.7285002407029, 1460.0, 13113.021850585938, 41813135.14709473, 11029779.91104126, 17796700.27598497, 1146435.7376098633], label=0), Instance(features=[266.0, 1460.0, 918.0, 542.2563969193909, 973.0, 73909.75952148438, 606726169.5861816, 235502322.5148519, 265627610.35454825, 99706888.19885254], label=0), Instance(features=[69.0, 278.0, 139.0, 79.465715877981, 85.0, 297069.5495605469, 604851961.1358643, 220544278.62167358, 248919043.25783345, 138514041.90063477], label=0), Instance(features=[69.0, 164.0, 110.6, 38.58808106138474, 85.0, 151872.6348876953, 643829107.2845459, 230873227.1194458, 264263550.35204285, 139755964.2791748], label=0), Instance(features=[266.0, 1460.0, 834.0, 513.2812094748842, 498.0, 56982.04040527344, 623749017.7154541, 247856974.6017456, 238955618.43121415, 183810949.32556152], label=0), Instance(features=[46.0, 1460.0, 706.4, 636.0721971600393, 498.0, 57935.71472167969, 143713951.11083984, 48989236.35482788, 58638326.5304098, 26092529.296875], label=0), Instance(features=[69.0, 278.0, 137.8, 78.91108920804477, 85.0, 129938.12561035156, 569087982.1777344, 259104013.44299316, 261448841.98538607, 233599066.73431396], label=0), Instance(features=[181.0, 1460.0, 754.8, 542.1451466166602, 498.0, 34809.112548828125, 525015115.73791504, 264234006.4048767, 205261200.1738584, 265943050.38452148], label=0), Instance(features=[180.0, 1460.0, 906.2, 511.4881816816494, 933.0, 152111.05346679688, 42836603879.92859, 11792849540.71045, 18009819650.266174, 2167321085.9298706], label=0), Instance(features=[498.0, 1460.0, 1029.8, 421.0332053413365, 1165.0, 23126.602172851562, 95727920.53222656, 47547280.78842163, 47510561.02484816, 47219038.009643555], label=0), Instance(features=[180.0, 1460.0, 783.0, 496.0653182797604, 498.0, 25987.625122070312, 45782200098.03772, 11583422005.176544, 19745437580.67448, 275730967.5216675], label=0), Instance(features=[180.0, 1460.0, 832.8, 528.428008341723, 566.0, 29087.066650390625, 387915134.42993164, 100085794.9256897, 166250297.6318655, 6199479.103088379], label=0), Instance(features=[180.0, 1460.0, 646.2, 430.38605925378204, 498.0, 13013839.721679688, 45729797124.86267, 11579425752.162933, 19717821831.918186, 287446022.0336914], label=0), Instance(features=[101.0, 1292.0, 462.8, 435.43054555233033, 243.0, 105211973.19030762, 46326915025.71106, 11781689226.62735, 19944995151.369263, 347314953.8040161], label=0), Instance(features=[283.0, 1460.0, 853.4, 504.02206300915043, 566.0, 21934.50927734375, 49653053.283691406, 15643239.02130127, 20320120.055861052, 6448984.146118164], label=0), Instance(features=[154.0, 1460.0, 827.6, 534.9144230622315, 566.0, 27894.973754882812, 819767951.965332, 206745207.3097229, 353939598.1682774, 3592491.1499023438], label=0), Instance(features=[266.0, 1460.0, 918.0, 542.2563969193909, 973.0, 37908.55407714844, 402579069.13757324, 138580004.3741862, 186751947.3942248, 13123035.430908203], label=0), Instance(features=[154.0, 1460.0, 827.6, 534.9144230622315, 566.0, 25987.625122070312, 502643823.6236572, 127586007.1182251, 216554216.87360498, 3837108.612060547], label=0), Instance(features=[75.0, 1301.0, 631.0, 506.9621945142129, 517.0, 432968.1396484375, 3657186031.3415527, 1828809499.7406006, 1828376531.6009521, 1828809499.7406006], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 538923978.805542, 538923978.805542, 538923978.805542, 0.0, 538923978.805542], label=0), Instance(features=[302.0, 1460.0, 838.4, 511.9803121214721, 498.0, 50067.901611328125, 462512969.9707031, 127372741.69921875, 194435301.78462642, 23463964.462280273], label=0), Instance(features=[472.0, 1460.0, 1048.0, 428.0093456923575, 1130.0, 10013.580322265625, 355572938.9190674, 118539651.23494466, 167607845.4241671, 36001.20544433594], label=0), Instance(features=[69.0, 278.0, 136.2, 78.28001021972341, 85.0, 190019.6075439453, 703310012.8173828, 252878248.69155884, 288720844.0482355, 154006481.1706543], label=0), Instance(features=[266.0, 1460.0, 1083.0, 437.9114065653006, 1165.0, 10967.254638671875, 520145893.0969238, 145917236.80496216, 217609461.66482857, 31756043.434143066], label=0), Instance(features=[266.0, 1460.0, 918.0, 542.2563969193909, 973.0, 145652055.74035645, 282724857.33032227, 214188456.53533936, 68536400.79498291, 214188456.53533936], label=0), Instance(features=[154.0, 1460.0, 827.6, 534.9144230622315, 566.0, 48160.552978515625, 464936971.6644287, 117350459.09881592, 200685604.1073779, 2208352.0889282227], label=0), Instance(features=[75.0, 1429.0, 838.2, 483.0893913138644, 1013.0, 472068.78662109375, 15089643955.230713, 4873679518.699646, 6099111997.05675, 2202301025.390625], label=0), Instance(features=[114.0, 1460.0, 770.0, 576.3374011809402, 498.0, 12874.603271484375, 332584142.6849365, 100009799.00360107, 137065647.2354696, 33721089.363098145], label=0), Instance(features=[180.0, 1460.0, 817.8, 536.7868850856921, 498.0, 29087.066650390625, 424298048.0194092, 107352495.19348145, 182998623.3140083, 2541422.8439331055], label=0), Instance(features=[266.0, 1460.0, 1083.0, 437.9114065653006, 1165.0, 12159.347534179688, 400681018.8293457, 102712988.85345459, 172079997.79195195, 5079388.618469238], label=0), Instance(features=[532.0, 1460.0, 1029.8, 420.4837214447189, 1165.0, 1192.0928955078125, 742912.2924804688, 307401.02132161456, 316308.43122414686, 178098.6785888672], label=0), Instance(features=[92.0, 1460.0, 793.2, 562.4540514566501, 498.0, 30994.415283203125, 378411054.61120605, 113052248.95477295, 156129194.8786756, 36883473.39630127], label=0), Instance(features=[154.0, 1460.0, 827.6, 534.9144230622315, 566.0, 16927.719116210938, 517507791.51916504, 145185947.4182129, 216486163.97766158, 31609535.217285156], label=0), Instance(features=[498.0, 1460.0, 1029.8, 431.13543115823825, 1199.0, 12874.603271484375, 56128025.05493164, 15905261.039733887, 23420609.509410616, 3740072.250366211], label=0), Instance(features=[498.0, 1460.0, 1029.8, 421.0332053413365, 1165.0, 14066.696166992188, 50130128.86047363, 14490306.377410889, 20817665.031462923, 3908514.976501465], label=0), Instance(features=[498.0, 1460.0, 1029.8, 421.0332053413365, 1165.0, 10967.254638671875, 59736967.08679199, 24947285.652160645, 25887895.094131213, 20020604.133605957], label=0), Instance(features=[180.0, 1460.0, 832.8, 528.428008341723, 566.0, 217199.32556152344, 754125118.2556152, 257151047.38871256, 351481406.79047513, 17110824.584960938], label=0), Instance(features=[92.0, 1460.0, 762.4, 583.8840980879681, 498.0, 10013.580322265625, 697054147.7203369, 222840011.11984253, 285043557.9778357, 97147941.58935547], label=0), Instance(features=[92.0, 1460.0, 762.4, 583.8840980879681, 498.0, 47922.13439941406, 385498046.875, 132160007.9536438, 157473892.42458162, 71547031.40258789], label=0), Instance(features=[498.0, 1460.0, 882.8, 471.2818265114835, 498.0, 24080.276489257812, 690249919.8913574, 194076478.48129272, 288606562.59398603, 43015956.87866211], label=0), Instance(features=[497.0, 1460.0, 887.0, 467.9247802799078, 520.0, 14066.696166992188, 637841939.9261475, 171496987.34283447, 269958428.99558765, 24065971.37451172], label=0), Instance(features=[498.0, 1460.0, 1029.8, 421.0332053413365, 1165.0, 36954.87976074219, 66144227.98156738, 33094048.500061035, 33040049.66761048, 33097505.569458008], label=0), Instance(features=[286.0, 1460.0, 804.4, 540.1531634638458, 498.0, 12874.603271484375, 618175983.4289551, 177098751.06811523, 257301708.27648813, 45103073.12011719], label=0), Instance(features=[180.0, 1460.0, 832.8, 528.428008341723, 566.0, 30994.415283203125, 462455034.25598145, 122639954.09011841, 196520017.37228495, 14036893.844604492], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 551017045.9747314, 551017045.9747314, 551017045.9747314, 0.0, 551017045.9747314], label=0), Instance(features=[180.0, 1460.0, 1011.6, 558.3065824437323, 1460.0, 3814.697265625, 655173063.2781982, 165371716.02249146, 282798542.29879993, 3154993.0572509766], label=0), Instance(features=[180.0, 1460.0, 832.8, 528.428008341723, 566.0, 97990.03601074219, 564059019.0887451, 145039737.22457886, 242003473.4153203, 8000969.886779785], label=0), Instance(features=[498.0, 1460.0, 1029.8, 421.0332053413365, 1165.0, 14066.696166992188, 102065086.3647461, 49063265.323638916, 49116430.44826884, 47086954.11682129], label=0), Instance(features=[180.0, 1460.0, 1089.8, 505.8064451942067, 1460.0, 4053.1158447265625, 828080892.5628662, 207102239.1319275, 358522210.3132679, 162005.42449951172], label=0), Instance(features=[180.0, 1460.0, 832.8, 528.428008341723, 566.0, 13113.021850585938, 829035043.7164307, 248634517.19284058, 341832303.0812877, 82744956.01654053], label=0), Instance(features=[75.0, 517.0, 369.6666666666667, 208.360798189636, 517.0, 293970.10803222656, 532001018.5241699, 266147494.31610107, 265853524.20806885, 266147494.31610107], label=0), Instance(features=[185.0, 1460.0, 815.0, 537.9754641245268, 498.0, 9775.161743164062, 526853084.564209, 172022223.4725952, 215172898.45487073, 80613017.08221436], label=0), Instance(features=[472.0, 1460.0, 877.8, 475.4628902448644, 499.0, 12874.603271484375, 672888994.216919, 209190964.6987915, 275942506.8514404, 81930994.9874878], label=0), Instance(features=[75.0, 1269.0, 642.5, 428.5822558156135, 613.0, 160932.5408935547, 551642894.744873, 190611282.98441568, 255416736.1958952, 20030021.66748047], label=0), Instance(features=[355.0, 1460.0, 853.6, 497.8130572815462, 498.0, 13113.021850585938, 641396045.6848145, 172264754.77218628, 271549111.7992066, 23824930.19104004], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 473716020.58410645, 473716020.58410645, 473716020.58410645, 0.0, 473716020.58410645], label=0), Instance(features=[154.0, 1460.0, 827.6, 534.9144230622315, 566.0, 24080.276489257812, 538847923.2788086, 136382460.59417725, 232377626.7984544, 3328919.4107055664], label=0), Instance(features=[75.0, 1460.0, 728.4, 453.14086110171087, 721.0, 236034.39331054688, 59065145015.71655, 14944052040.576935, 25474974727.394703, 355413556.098938], label=0), Instance(features=[75.0, 1301.0, 631.0, 506.9621945142129, 517.0, 312089.9200439453, 599934101.1047363, 300123095.51239014, 299811005.5923462, 300123095.51239014], label=0), Instance(features=[266.0, 1460.0, 834.0, 517.7597898639871, 498.0, 19073.486328125, 826720952.9876709, 325708746.9100952, 348477507.37690264, 238047480.58319092], label=0), Instance(features=[180.0, 1460.0, 832.8, 528.428008341723, 566.0, 36001.20544433594, 819802999.49646, 205343723.29711914, 354758390.06381625, 767946.2432861328], label=0), Instance(features=[180.0, 1460.0, 869.0, 514.9384429230352, 747.0, 21934.50927734375, 850960969.9249268, 222751498.22235107, 363063372.57279927, 20011544.227600098], label=0), Instance(features=[180.0, 1460.0, 832.8, 528.428008341723, 566.0, 11920.928955078125, 577126026.1535645, 167670249.93896484, 239460885.0924719, 46771526.33666992], label=0), Instance(features=[180.0, 1460.0, 1011.6, 558.3065824437323, 1460.0, 2861.02294921875, 1035663127.8991699, 259408235.54992676, 448171666.6252217, 983476.6387939453], label=0), Instance(features=[180.0, 1460.0, 832.8, 528.428008341723, 566.0, 36001.20544433594, 851855993.270874, 218236505.98526, 365908240.67042524, 10527014.73236084], label=0), Instance(features=[180.0, 1460.0, 832.8, 528.428008341723, 566.0, 13113.021850585938, 1037997007.3699951, 275502979.7554016, 440999613.7368845, 32000899.31488037], label=0), Instance(features=[431.0, 1460.0, 963.6, 451.47429605681873, 995.0, 10967.254638671875, 517104864.1204834, 237323224.54452515, 239194883.6431992, 216088533.40148926], label=0), Instance(features=[75.0, 533.0, 375.0, 212.23257682709, 517.0, 16113996.505737305, 833901882.1716309, 425007939.3386841, 408893942.8329468, 425007939.3386841], label=0), Instance(features=[180.0, 1460.0, 1124.8, 496.6730916810372, 1460.0, 8106.231689453125, 465495109.55810547, 118808507.91931152, 200198808.94133335, 4865407.943725586], label=0), Instance(features=[59.0, 1460.0, 731.4, 611.9403892537246, 498.0, 28133.392333984375, 4484310865.402222, 1141045987.6060486, 1930509283.6940675, 39922475.814819336], label=0), Instance(features=[498.0, 1460.0, 853.4, 355.6389180053274, 849.0, 33855.438232421875, 98803997.03979492, 40949702.26287842, 42191938.512228474, 32480478.286743164], label=0), Instance(features=[154.0, 1460.0, 1006.4, 566.0945504065553, 1460.0, 142097.47314453125, 522368192.6727295, 132419764.99557495, 225153710.7710404, 3584384.9182128906], label=0), Instance(features=[75.0, 1301.0, 631.0, 506.9621945142129, 517.0, 11930942.53540039, 580235958.0993652, 296083450.3173828, 284152507.7819824, 296083450.3173828], label=0), Instance(features=[85.0, 1460.0, 863.8, 571.4565250305574, 996.0, 6198.883056640625, 621131896.9726562, 261876662.57222494, 262757338.4724482, 164491891.8609619], label=0), Instance(features=[180.0, 1460.0, 950.0, 521.1924788405911, 1152.0, 23841.85791015625, 795819044.1131592, 222485005.8555603, 333231867.98379165, 47048568.72558594], label=0), Instance(features=[498.0, 1460.0, 1029.8, 421.0332053413365, 1165.0, 11920.928955078125, 39277076.721191406, 13480007.648468018, 16040435.673164777, 7315516.471862793], label=0), Instance(features=[498.0, 1460.0, 1029.8, 421.0332053413365, 1165.0, 14781.951904296875, 66404104.232788086, 23950755.59616089, 27261719.931433883, 14692068.099975586], label=0), Instance(features=[266.0, 1460.0, 1083.0, 437.9114065653006, 1165.0, 19073.486328125, 467733144.76013184, 117110252.3803711, 202432390.0742285, 344395.63751220703], label=0), Instance(features=[498.0, 1460.0, 1029.8, 417.3988021065705, 1152.0, 36954.87976074219, 2676010.1318359375, 755012.035369873, 1111571.1018679, 153541.56494140625], label=0), Instance(features=[266.0, 1460.0, 1083.0, 437.9114065653006, 1165.0, 10013.580322265625, 468808889.3890381, 117295265.1977539, 202946525.66834623, 181078.91082763672], label=0), Instance(features=[334.0, 1460.0, 1029.8, 504.36669200096867, 1397.0, 953.67431640625, 18138170.24230957, 8272727.330525716, 7489748.21475747, 6679058.074951172], label=0), Instance(features=[180.0, 1460.0, 762.8, 572.9186329663228, 357.0, 788927.0782470703, 3861664056.777954, 1247249960.899353, 1528332921.6978586, 563273429.8706055], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 930862188.3392334, 930862188.3392334, 930862188.3392334, 0.0, 930862188.3392334], label=0), Instance(features=[75.0, 1253.0, 638.5, 422.75140449204895, 613.0, 127077.10266113281, 693108081.817627, 231181701.02437338, 326631284.79949677, 309944.15283203125], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 681262016.2963867, 681262016.2963867, 681262016.2963867, 0.0, 681262016.2963867], label=0), Instance(features=[75.0, 517.0, 296.0, 221.0, 296.0, 854786872.8637695, 854786872.8637695, 854786872.8637695, 0.0, 854786872.8637695], label=0), Instance(features=[283.0, 1460.0, 853.4, 504.02206300915043, 566.0, 11920.928955078125, 165117025.3753662, 64868509.7694397, 69510625.54192932, 47172546.38671875], label=0), Instance(features=[498.0, 1460.0, 1029.8, 417.3988021065705, 1152.0, 22888.18359375, 11232137.680053711, 3040015.697479248, 4741654.41849825, 452518.4631347656], label=0), Instance(features=[258.0, 1460.0, 848.4, 509.74723147850443, 566.0, 36001.20544433594, 49420833.587646484, 19087255.001068115, 20631484.992527563, 13446092.60559082], label=0), Instance(features=[283.0, 1460.0, 853.4, 504.02206300915043, 566.0, 13113.021850585938, 164752006.53076172, 64696729.18319702, 69341127.77270766, 47010898.59008789], label=0), Instance(features=[75.0, 201.0, 138.0, 63.0, 138.0, 1079689025.8789062, 1079689025.8789062, 1079689025.8789062, 0.0, 1079689025.8789062], label=0), Instance(features=[1350.0, 1350.0, 1350.0, 0.0, 1350.0, 151700019.83642578, 1200838088.9892578, 563737511.6348267, 401755316.89502054, 451205968.8568115], label=0), Instance(features=[1350.0, 1350.0, 1350.0, 0.0, 1350.0, 150331974.02954102, 1201927900.314331, 563563466.0720825, 402683134.6019848, 450996994.972229], label=0), Instance(features=[1350.0, 1350.0, 1350.0, 0.0, 1350.0, 150166988.37280273, 1201389074.3255615, 563665747.6425171, 402519906.4482712, 451553463.93585205], label=0), Instance(features=[1350.0, 1350.0, 1350.0, 0.0, 1350.0, 151319980.6213379, 1202176094.0551758, 564242243.7667847, 402417681.41255474, 451736450.1953125], label=0), Instance(features=[1350.0, 1350.0, 1350.0, 0.0, 1350.0, 150342941.2841797, 1200208902.3590088, 563114762.3062134, 402133547.77673554, 450953602.7908325], label=0), Instance(features=[1350.0, 1350.0, 1350.0, 0.0, 1350.0, 151942014.69421387, 1202992916.1071777, 564018011.0931396, 402714455.49136096, 450568556.7855835], label=0), Instance(features=[1350.0, 1350.0, 1350.0, 0.0, 1350.0, 150637865.06652832, 1201406002.0446777, 563974738.1210327, 402510332.2467725, 451927542.6864624], label=0), Instance(features=[1350.0, 1350.0, 1350.0, 0.0, 1350.0, 150534152.98461914, 1200881958.0078125, 563383042.8123474, 402107000.8331577, 451058030.128479], label=0), Instance(features=[1350.0, 1350.0, 1350.0, 0.0, 1350.0, 152068853.3782959, 1201162099.8382568, 564175009.727478, 401847578.3891655, 451734542.8466797], label=0), Instance(features=[1350.0, 1350.0, 1350.0, 0.0, 1350.0, 152570009.23156738, 1200753211.9750977, 563639521.5988159, 401608471.97137743, 450617432.5942993], label=0), Instance(features=[1350.0, 1350.0, 1350.0, 0.0, 1350.0, 151530027.38952637, 1201097011.566162, 563677251.3389587, 402048891.84400564, 451040983.20007324], label=0), Instance(features=[1350.0, 1350.0, 1350.0, 0.0, 1350.0, 151183128.3569336, 1200891971.5881348, 563439249.9923706, 402014253.8941397, 450840950.01220703], label=0), Instance(features=[1350.0, 1350.0, 1350.0, 0.0, 1350.0, 150913000.10681152, 1202771902.0843506, 564182758.3312988, 402729389.626871, 451523065.5670166], label=0), Instance(features=[1350.0, 1350.0, 1350.0, 0.0, 1350.0, 152922153.4729004, 1201146841.0491943, 564281761.6462708, 401479665.9921572, 451529026.03149414], label=0), Instance(features=[1350.0, 1350.0, 1350.0, 0.0, 1350.0, 152642011.64245605, 1200266122.8179932, 563452243.8049316, 401516642.3175579, 450450420.3796387], label=0), Instance(features=[1350.0, 1350.0, 1350.0, 0.0, 1350.0, 151345968.24645996, 1200555086.1358643, 563736259.9372864, 401692709.036359, 451521992.68341064], label=0), Instance(features=[1350.0, 1350.0, 1350.0, 0.0, 1350.0, 150758028.0303955, 1200247049.331665, 563237965.1069641, 401767051.19477487, 450973391.53289795], label=0), Instance(features=[1350.0, 1350.0, 1350.0, 0.0, 1350.0, 150596857.07092285, 1201128005.9814453, 563033223.1521606, 402424459.67106855, 450204014.7781372], label=0), Instance(features=[1350.0, 1350.0, 1350.0, 0.0, 1350.0, 150454044.34204102, 1201855182.647705, 564072549.3431091, 402484296.88020146, 451990485.1913452], label=0), Instance(features=[1350.0, 1350.0, 1350.0, 0.0, 1350.0, 154445886.61193848, 1201619863.5101318, 564642488.9564514, 401456181.89186746, 451252102.8518677], label=0), Instance(features=[1350.0, 1350.0, 1350.0, 0.0, 1350.0, 151687145.2331543, 1202599048.614502, 564393281.9366455, 402508488.3594751, 451643466.9494629], label=0), Instance(features=[1350.0, 1350.0, 1350.0, 0.0, 1350.0, 151703119.2779541, 1202502965.927124, 564364254.4746399, 402480359.36487556, 451625466.3467407], label=0),
[[1, 2, 3, 4, 5, 6, 7, 8, 6, 10], ["五元组"]]
measurement/oaiflowclassification/train.py
0 → 100644
View file @
fe3aad70
"""
10个特征的(前五个包大小,后五个包间隔):最小值,最大值,平均值,方差,中位数
每次运行前,检查:
四个需要修改的地方,命名是否正确
最后的运行模式是否正确
这个文件用于把pcap解析的文件生成特征和标签的形式 并且5个包一组
"""
from
common_utils
import
*
# 修改了
from
argparse
import
ArgumentParser
from
collections
import
namedtuple
from
typing
import
List
,
Dict
from
path_utils
import
get_prj_root
from
model
import
DT
# 修改了
from
datetime
import
datetime
from
path_utils
import
get_prj_root
import
numpy
as
np
from
sklearn.decomposition
import
PCA
import
time
# start counting time
start
=
time
.
time
()
random
.
seed
(
datetime
.
now
())
# get the path of the models
model_dir
=
os
.
path
.
join
(
get_prj_root
(),
"classify/models"
)
# 修改:模型models路径
dt_model_pkl
=
os
.
path
.
join
(
model_dir
,
"dt2_9.pkl"
)
# 修改:模型的版本,只用修改此处就行
Instance
=
namedtuple
(
"Instance"
,
[
"features"
,
"label"
])
# 实例
win_size
=
5
# 窗口大小
limit
=
100000
# the path
# iot-物联网流 video-视频流 voip-音频流 AR-AR流用的高清视频流代替
dirs
=
{
"video"
:
"./tmp/dt/video"
,
"iot"
:
"./tmp/dt/iot"
,
"voip"
:
"./tmp/dt/voip"
,
"AR"
:
"./tmp/dt/AR"
,
}
instances_dir
=
os
.
path
.
join
(
get_prj_root
(),
"classify/instances"
)
# 修改:instances路径
# 获取特征
def
get_median
(
data
):
# 产生中位数
data
.
sort
()
half
=
len
(
data
)
//
2
return
(
data
[
half
]
+
data
[
~
half
])
/
2
def
gen_single_instance
(
dir_name
,
flow
,
flow_type
):
# debug("generate {}".format(flow["file"]))
def
extract_features
(
raw_features
:
List
[
float
]):
# 修改特征
extracted_features
=
[]
raw_features
=
[
r
for
r
in
raw_features
if
int
(
r
)
>=
0
]
extracted_features
.
append
(
min
(
raw_features
))
extracted_features
.
append
(
max
(
raw_features
))
extracted_features
.
append
(
sum
(
raw_features
)
/
len
(
raw_features
))
extracted_features
.
append
(
np
.
std
(
raw_features
))
# 标准差
extracted_features
.
append
(
get_median
(
raw_features
))
# 中位数
return
extracted_features
features
=
[]
idts
=
[]
ps
=
[]
idt_file
=
os
.
path
.
join
(
dir_name
,
flow
[
"idt"
])
# 包大小
ps_file
=
os
.
path
.
join
(
dir_name
,
flow
[
"ps"
])
# 包间隔
with
open
(
idt_file
,
'r'
)
as
fp
:
lines
=
fp
.
readlines
()
fp
.
close
()
lines
=
[
l
.
strip
()
for
l
in
lines
]
# .strip()用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。
lines
=
[
l
for
l
in
lines
if
len
(
l
)
>
-
1
]
if
len
(
lines
)
>
win_size
:
lines
=
lines
[:
win_size
]
for
l
in
lines
:
idts
.
append
(
float
(
l
))
with
open
(
ps_file
,
"r"
)
as
fp
:
lines
=
fp
.
readlines
()
fp
.
close
()
lines
=
[
l
.
strip
()
for
l
in
lines
]
lines
=
[
l
for
l
in
lines
if
len
(
l
)
>
0
]
if
len
(
lines
)
>
win_size
:
lines
=
lines
[:
win_size
]
for
l
in
lines
:
ps
.
append
(
float
(
l
))
# 有很奇怪的现象
ps
=
[
p
for
p
in
ps
if
p
>
0
]
if
len
(
ps
)
==
0
:
print
(
flow
[
"ps"
])
return
None
idts
=
[
i
for
i
in
idts
if
i
>=
0
]
if
len
(
idts
)
==
0
:
return
None
features
.
extend
(
extract_features
(
ps
))
# 包间隔的数理统计
features
.
extend
(
extract_features
(
idts
))
# 包大小的数理统计
if
flow_type
==
"video"
:
label
=
0
elif
flow_type
==
"iot"
:
label
=
1
elif
flow_type
==
"voip"
:
label
=
2
elif
flow_type
==
"AR"
:
label
=
3
else
:
err
(
"Unsupported flow type"
)
raise
Exception
(
"Unsupported flow type"
)
return
Instance
(
features
=
features
,
label
=
label
)
def
generate
():
instances_dir
=
os
.
path
.
join
(
get_prj_root
(),
"classify/instances"
)
# 修改:instances_dir实例的路径
for
flow_type
,
dirname
in
dirs
.
items
():
stats_fn
=
os
.
path
.
join
(
dirname
,
"statistics.json"
)
# statistics.json流量统计的文件
debug
(
stats_fn
)
statistics
=
load_json
(
os
.
path
.
join
(
dirname
,
"statistics.json"
))
debug
(
"#flows {}"
.
format
(
statistics
[
"count"
]))
flows
:
List
=
statistics
[
"flows"
]
sorted
(
flows
,
key
=
lambda
f
:
-
f
[
"num_pkt"
])
if
len
(
flows
)
>
limit
:
flows
=
flows
[:
limit
]
instances
=
[
gen_single_instance
(
dirname
,
f
,
flow_type
)
for
f
in
flows
]
instances
=
[
i
for
i
in
instances
if
i
is
not
None
]
debug
(
"#{} instances {}"
.
format
(
flow_type
,
len
(
instances
)))
# print(len(instances))
save_pkl
(
os
.
path
.
join
(
instances_dir
,
"{}.pkl"
.
format
(
flow_type
)),
instances
)
# 保存Python内存数据到文件
if
__name__
==
'__main__'
:
parser
=
ArgumentParser
()
print
(
"running mode
\n
"
"1. generate instances
\n
"
"2. train dt
\n
"
)
parser
.
add_argument
(
"--mode"
,
type
=
int
,
default
=
1
)
# default为模式修改
args
=
parser
.
parse_args
()
mode
=
int
(
args
.
mode
)
if
mode
==
1
:
generate
()
end
=
time
.
time
()
print
(
"程序运行时间:%.2f秒"
%
(
end
-
start
))
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