代码拉取完成,页面将自动刷新
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (c) 2020 Huawei Technologies Co., Ltd.
# A-Tune is licensed under the Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
# http://license.coscl.org.cn/MulanPSL2
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
# PURPOSE.
# See the Mulan PSL v2 for more details.
# Create: 2020-07-14
"""
The tool to generate the AI models.
Usage: python3 generate_models.py [-h] [-d] [-m] [-s]
"""
import argparse
import ast
import os
import sys
FILE_PATH = os.path.realpath(os.path.dirname(__file__))
sys.path.insert(0, FILE_PATH + "/../")
# from analysis.optimizer.workload_characterization import WorkloadCharacterization
from analysis.optimizer.app_characterization import AppCharacterization
def main(csv_path, model_path, feature_selection, search):
"""
generate AI models
:param csv_path: csv path
:param model_path: model path
:param feature_selection: select feature model, default value is False
:param search: enable the grid search for model train, default value is False
:return: None
"""
processor = AppCharacterization(model_path, mode="train")
processor.train(csv_path, feature_selection, search)
if __name__ == '__main__':
ARG_PARSER = argparse.ArgumentParser(description="generate AI models")
ARG_PARSER.add_argument('-d', '--csv_path', metavar='DATA',
default=FILE_PATH + "/../analysis/dataset", help='input csv path')
ARG_PARSER.add_argument('-m', '--model_path', metavar='MODEL',
default=FILE_PATH + "/../analysis/models", help='input model path')
ARG_PARSER.add_argument('-s', '--select', metavar='SELECT',
type=ast.literal_eval, default=False,
help='whether feature models to be generate, True or False')
ARG_PARSER.add_argument('-g', '--search', metavar='SEARCH',
default=False, help='wether enable the parameter space search')
ARGS = ARG_PARSER.parse_args()
main(ARGS.csv_path, ARGS.model_path, ARGS.select, ARGS.search)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。