libcity.utils.utils

libcity.utils.utils.ensure_dir(dir_path)[源代码]

Make sure the directory exists, if it does not exist, create it.

参数

dir_path (str) – directory path

libcity.utils.utils.get_evaluator(config)[源代码]

according the config[‘evaluator’] to create the evaluator

参数

config (ConfigParser) – config

返回

the loaded evaluator

返回类型

AbstractEvaluator

libcity.utils.utils.get_executor(config, model, data_feature)[源代码]

according the config[‘executor’] to create the executor

参数
返回

the loaded executor

返回类型

AbstractExecutor

libcity.utils.utils.get_local_time()[源代码]

获取时间

返回

时间

返回类型

datetime

libcity.utils.utils.get_logger(config, name=None)[源代码]

获取Logger对象

参数
返回

logger

返回类型

Logger

libcity.utils.utils.get_model(config, data_feature)[源代码]

according the config[‘model’] to create the model

参数
  • config (ConfigParser) – config

  • data_feature (dict) – feature of the data

返回

the loaded model

返回类型

AbstractModel

libcity.utils.utils.preprocess_data(data, config)[源代码]

split by input_window and output_window

参数

data – shape (T, …)

返回

(train_size/test_size, input_window, …)

(train_size/test_size, output_window, …)

返回类型

np.ndarray

libcity.utils.utils.set_random_seed(seed)[源代码]

重置随机数种子

参数

seed (int) – 种子数

libcity.utils.utils.trans_naming_rule(origin, origin_rule, target_rule)[源代码]

名字转换规则

参数
  • origin (str) – 源命名格式下的变量名

  • origin_rule (str) – 源命名格式,枚举类

  • target_rule (str) – 目标命名格式,枚举类

返回

转换之后的结果

返回类型

target (str)