-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.py
27 lines (25 loc) · 815 Bytes
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
from os.path import isfile, isdir, join
def model_dir_tools(model_dir):
"""
This function is used to get the model path and child model path.
Parameters
----------
model_dir : str
Path to the bagged_model in autogulon directory.
Returns
-------
bagged_model_path : str
Path to the bagged_model.pkl.
childs_dir : list
List of child model path.
"""
bagged_model_path = join(model_dir,'model.pkl')
childs_dir = os.listdir(model_dir)
childs_new_dir = []
for child_dir in childs_dir:
if child_dir != 'utils':
if isdir(join(model_dir,child_dir)):
child_dir = join(model_dir,child_dir,'model.pkl')
childs_new_dir.append(child_dir)
return bagged_model_path,childs_new_dir