-
Notifications
You must be signed in to change notification settings - Fork 4
/
generateScript.py
73 lines (53 loc) · 2.5 KB
/
generateScript.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
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 27 11:19:43 2022
@author: akshay
"""
from UI.componentIDs import classification_Com_IDS,classification_models,\
undersampling_Com_IDS,underSamp_models,\
overrsampling_Com_IDS, overSamp_models, \
modelEval_Com_IDS,\
scaling_Com_IDS,scaling_models, \
featSel_Com_IDS, featSel_models,featSel_est
from helperFunctions import getAlgoNames,removeModelId,getActiveAlgo,getMoedlEvalActive,saveUserInputData,getActiveAlgoFeatSel
import pickle
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# importing the module
import ast
with open('myfile.txt') as f:
data = f.read()
userInputData=ast.literal_eval(data)
#a=saveUserInputData(userInputData)
#get random state4
if("random_seed" in userInputData.keys()):
rs=userInputData["random_seed"]
else:
rs=12345
#set numpy random seed
import numpy as np
np.random.seed(rs)
scaling_tab_active=getActiveAlgo(userInputData,"scaling_tab_data",
scaling_models,rs,scaling_Com_IDS)
underSamp_tab_active=getActiveAlgo(userInputData,"underSamp_tab_para",
underSamp_models,rs,undersampling_Com_IDS)
overSamp_tab_active=getActiveAlgo(userInputData,"overSamp_tab_para",
overSamp_models,rs,overrsampling_Com_IDS)
featSel_tab_active=getActiveAlgoFeatSel(userInputData,"featSel_tab_para",
featSel_models,rs,featSel_Com_IDS,featSel_est)
classification_tab_active=getActiveAlgo(userInputData,"classification_tab_para",
classification_models,rs,classification_Com_IDS)
modelEval_tab_active=getMoedlEvalActive(userInputData,"modelEval_tab_para",
modelEval_Com_IDS,rs)
userInputData={"random_state":rs,"n_jobs":userInputData["n_jobs"],\
"scaling_tab_active":scaling_tab_active,"underSamp_tab_active":underSamp_tab_active,\
"overSamp_tab_active":overSamp_tab_active,"classification_tab_active":classification_tab_active,
"featSel_tab_active":userInputData["featSel_tab_para"],\
"modelEval_tab_active":modelEval_tab_active,\
"modelEval_metrices":userInputData["modelEval_metrices_tab_para"][0]
}
#Save user input data as pkl object
with open('userInputData.pkl', 'wb') as handle:
pickle.dump(userInputData, handle)
with open('userInputData_1.pkl', 'rb') as handle:
userInputData=pickle.load(handle)