Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
A-Tune
提交
326905f4
A
A-Tune
项目概览
openeuler
/
A-Tune
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
A-Tune
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
326905f4
编写于
8月 04, 2020
作者:
Z
Zhipeng Xie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix pylint warnings
Signed-off-by:
N
Zhipeng Xie
<
xiezhipeng1@huawei.com
>
上级
74e5e36e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
5 addition
and
5 deletion
+5
-5
analysis/optimizer/workload_characterization.py
analysis/optimizer/workload_characterization.py
+5
-5
未找到文件。
analysis/optimizer/workload_characterization.py
浏览文件 @
326905f4
...
...
@@ -17,7 +17,7 @@ This class is used to train models and characterize system workload.
import
os
import
glob
from
collections
import
Counter
import
collections
import
numpy
as
np
import
pandas
as
pd
from
sklearn
import
svm
...
...
@@ -31,7 +31,7 @@ from sklearn.utils import class_weight
from
xgboost
import
XGBClassifier
class
WorkloadCharacterization
:
class
WorkloadCharacterization
(
object
)
:
"""train models and characterize system workload"""
def
__init__
(
self
,
model_path
):
...
...
@@ -291,7 +291,7 @@ class WorkloadCharacterization:
workload
=
type_clf
.
predict
(
data
)
workload
=
self
.
tencoder
.
inverse_transform
(
workload
)
print
(
"Current workload:"
,
workload
)
prediction
=
Counter
(
workload
).
most_common
(
1
)[
0
]
prediction
=
collections
.
Counter
(
workload
).
most_common
(
1
)[
0
]
confidence
=
prediction
[
1
]
/
len
(
workload
)
if
confidence
<
0.5
:
resourcelimit
=
'default'
...
...
@@ -309,7 +309,7 @@ class WorkloadCharacterization:
result
=
self
.
aencoder
.
inverse_transform
(
result
)
print
(
result
)
prediction
=
Counter
(
result
).
most_common
(
1
)[
0
]
prediction
=
collections
.
Counter
(
result
).
most_common
(
1
)[
0
]
confidence
=
prediction
[
1
]
/
len
(
result
)
if
confidence
>
0.5
:
return
resourcelimit
,
prediction
[
0
],
confidence
...
...
@@ -357,7 +357,7 @@ class WorkloadCharacterization:
result
=
encoder
.
inverse_transform
(
result
)
print
(
result
)
prediction
=
Counter
(
result
).
most_common
(
1
)[
0
]
prediction
=
collections
.
Counter
(
result
).
most_common
(
1
)[
0
]
confidence
=
prediction
[
1
]
/
len
(
result
)
if
confidence
>
0.5
:
return
prediction
[
0
],
confidence
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录