|
@@ -124,7 +124,6 @@ class MlConfigEntity():
|
|
|
# 加减分规则
|
|
|
self._rules = rules
|
|
|
|
|
|
-
|
|
|
if self._project_name is None or len(self._project_name) == 0:
|
|
|
self._base_dir = os.path.join(BaseConfig.train_path, f"{f_get_datetime()}")
|
|
|
else:
|
|
@@ -133,6 +132,7 @@ class MlConfigEntity():
|
|
|
self._include = columns_include + list(self.breaks_list.keys())
|
|
|
|
|
|
os.makedirs(self._base_dir, exist_ok=True)
|
|
|
+ print(f"项目路径:【{self._base_dir}】")
|
|
|
|
|
|
if self._jupyter_print:
|
|
|
warning_ignore()
|
|
@@ -294,6 +294,9 @@ class MlConfigEntity():
|
|
|
"""
|
|
|
从配置文件生成实体类
|
|
|
"""
|
|
|
+ if os.path.isdir(config_path):
|
|
|
+ config_path = os.path.join(config_path, "mlcfg.json")
|
|
|
+
|
|
|
if os.path.exists(config_path):
|
|
|
with open(config_path, mode="r", encoding="utf-8") as f:
|
|
|
j = json.loads(f.read())
|
|
@@ -302,6 +305,14 @@ class MlConfigEntity():
|
|
|
|
|
|
return MlConfigEntity(**j)
|
|
|
|
|
|
+ def config_save(self):
|
|
|
+ path = self.f_get_save_path("mlcfg.json")
|
|
|
+ with open(path, mode="w", encoding="utf-8") as f:
|
|
|
+ j = {k.lstrip("_"): v for k, v in self.__dict__.items()}
|
|
|
+ j = json.dumps(j, ensure_ascii=False)
|
|
|
+ f.write(j)
|
|
|
+ print(f"mlcfg save to【{path}】success. ")
|
|
|
+
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
pass
|