-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtraining.py
More file actions
58 lines (43 loc) · 1.56 KB
/
Copy pathtraining.py
File metadata and controls
58 lines (43 loc) · 1.56 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import os
import pandas as pd
from config.paths import FILE_PREPROCESSED_PATH
from config.paths import MODELS_PATH
from ml.training import train
from utils.explorer import explorer
def main():
"""
Тока входа тренировки моделей на предварительно обработанных данных;
:return: None.
"""
names = explorer(FILE_PREPROCESSED_PATH, '*.csv')
os.system('cls')
print('Список предобработанных файлов:', names,
sep='\n',
flush=True)
if name := input('Выберите файл: '):
data = pd.read_csv(f'{FILE_PREPROCESSED_PATH}/{name}')
models = {}
print(flush=True)
names = explorer(path=MODELS_PATH,
ext='*.py',
exclude=('__init__.py', 'model.py'))
print('Список файлов c моделями:', names, sep='\n', flush=True)
if files := input('Выберите один или несколько файлов: '):
for file in files.split():
name = file.split('.')[0]
modul = __import__(
name=f'ml.models.{name}',
globals=globals(),
locals=locals(),
fromlist=['model'],
level=0
)
models[name] = modul.model
train(
models=models,
data=data,
n_trials=300,
n_jobs=4
)
if __name__ == '__main__':
main()