|
|
@ -1049,7 +1049,6 @@ def PreprocessingPredUpdate(Models): |
|
|
|
dfGradBFiltered = dfGradB.loc[GradBModels, :] |
|
|
|
dfGradBFiltered = dfGradB.loc[GradBModels, :] |
|
|
|
|
|
|
|
|
|
|
|
df_concatProbs = pd.concat([dfKNNFiltered, dfSVCFiltered, dfGausNBFiltered, dfMLPFiltered, dfLRFiltered, dfLDAFiltered, dfQDAFiltered, dfRFFiltered, dfExtraTFiltered, dfAdaBFiltered, dfGradBFiltered]) |
|
|
|
df_concatProbs = pd.concat([dfKNNFiltered, dfSVCFiltered, dfGausNBFiltered, dfMLPFiltered, dfLRFiltered, dfLDAFiltered, dfQDAFiltered, dfRFFiltered, dfExtraTFiltered, dfAdaBFiltered, dfGradBFiltered]) |
|
|
|
|
|
|
|
|
|
|
|
listProbs = df_concatProbs.index.values.tolist() |
|
|
|
listProbs = df_concatProbs.index.values.tolist() |
|
|
|
deletedElements = 0 |
|
|
|
deletedElements = 0 |
|
|
|
for index, element in enumerate(listProbs): |
|
|
|
for index, element in enumerate(listProbs): |
|
|
@ -1474,7 +1473,9 @@ def InitializeEnsemble(): |
|
|
|
XModels = PreprocessingMetrics() |
|
|
|
XModels = PreprocessingMetrics() |
|
|
|
global ModelSpaceMDS |
|
|
|
global ModelSpaceMDS |
|
|
|
global ModelSpaceTSNE |
|
|
|
global ModelSpaceTSNE |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
XModels = XModels.fillna(0) |
|
|
|
|
|
|
|
|
|
|
|
ModelSpaceMDS = FunMDS(XModels) |
|
|
|
ModelSpaceMDS = FunMDS(XModels) |
|
|
|
ModelSpaceTSNE = FunTsne(XModels) |
|
|
|
ModelSpaceTSNE = FunTsne(XModels) |
|
|
|
ModelSpaceTSNE = ModelSpaceTSNE.tolist() |
|
|
|
ModelSpaceTSNE = ModelSpaceTSNE.tolist() |
|
|
@ -1583,14 +1584,17 @@ def SendPredBacktobeUpdated(): |
|
|
|
def RetrieveSelClassifiersID(): |
|
|
|
def RetrieveSelClassifiersID(): |
|
|
|
ClassifierIDsList = request.get_data().decode('utf8').replace("'", '"') |
|
|
|
ClassifierIDsList = request.get_data().decode('utf8').replace("'", '"') |
|
|
|
ComputeMetricsForSel(ClassifierIDsList) |
|
|
|
ComputeMetricsForSel(ClassifierIDsList) |
|
|
|
|
|
|
|
ClassifierIDCleaned = json.loads(ClassifierIDsList) |
|
|
|
|
|
|
|
|
|
|
|
key = 1 |
|
|
|
global keySpec |
|
|
|
EnsembleModel(ClassifierIDsList, key) |
|
|
|
keySpec = ClassifierIDCleaned['keyNow'] |
|
|
|
|
|
|
|
EnsembleModel(ClassifierIDsList, 1) |
|
|
|
return 'Everything Okay' |
|
|
|
return 'Everything Okay' |
|
|
|
|
|
|
|
|
|
|
|
def ComputeMetricsForSel(Models): |
|
|
|
def ComputeMetricsForSel(Models): |
|
|
|
Models = json.loads(Models) |
|
|
|
Models = json.loads(Models) |
|
|
|
MetricsAlltoSel = PreprocessingMetrics() |
|
|
|
MetricsAlltoSel = PreprocessingMetrics() |
|
|
|
|
|
|
|
|
|
|
|
listofModels = [] |
|
|
|
listofModels = [] |
|
|
|
for loop in Models['ClassifiersList']: |
|
|
|
for loop in Models['ClassifiersList']: |
|
|
|
listofModels.append(loop) |
|
|
|
listofModels.append(loop) |
|
|
@ -2340,6 +2344,8 @@ def EnsembleModel(Models, keyRetrieved): |
|
|
|
global all_classifiersSelection |
|
|
|
global all_classifiersSelection |
|
|
|
all_classifiersSelection = [] |
|
|
|
all_classifiersSelection = [] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
global all_classifiers |
|
|
|
|
|
|
|
|
|
|
|
global XData |
|
|
|
global XData |
|
|
|
global yData |
|
|
|
global yData |
|
|
|
global sclf |
|
|
|
global sclf |
|
|
@ -2347,7 +2353,6 @@ def EnsembleModel(Models, keyRetrieved): |
|
|
|
lr = LogisticRegression() |
|
|
|
lr = LogisticRegression() |
|
|
|
|
|
|
|
|
|
|
|
if (keyRetrieved == 0): |
|
|
|
if (keyRetrieved == 0): |
|
|
|
global all_classifiers |
|
|
|
|
|
|
|
all_classifiers = [] |
|
|
|
all_classifiers = [] |
|
|
|
columnsInit = [] |
|
|
|
columnsInit = [] |
|
|
|
columnsInit = [XData.columns.get_loc(c) for c in XData.columns if c in XData] |
|
|
|
columnsInit = [XData.columns.get_loc(c) for c in XData.columns if c in XData] |
|
|
@ -2443,8 +2448,11 @@ def EnsembleModel(Models, keyRetrieved): |
|
|
|
elif (keyRetrieved == 1): |
|
|
|
elif (keyRetrieved == 1): |
|
|
|
Models = json.loads(Models) |
|
|
|
Models = json.loads(Models) |
|
|
|
ModelsAll = preProceModels() |
|
|
|
ModelsAll = preProceModels() |
|
|
|
|
|
|
|
global keySpec |
|
|
|
|
|
|
|
print(ModelsAll) |
|
|
|
for index, modHere in enumerate(ModelsAll): |
|
|
|
for index, modHere in enumerate(ModelsAll): |
|
|
|
flag = 0 |
|
|
|
flag = 0 |
|
|
|
|
|
|
|
print(Models['ClassifiersList']) |
|
|
|
for loop in Models['ClassifiersList']: |
|
|
|
for loop in Models['ClassifiersList']: |
|
|
|
if (int(loop) == int(modHere)): |
|
|
|
if (int(loop) == int(modHere)): |
|
|
|
flag = 1 |
|
|
|
flag = 1 |
|
|
@ -2456,6 +2464,9 @@ def EnsembleModel(Models, keyRetrieved): |
|
|
|
meta_classifier=lr, |
|
|
|
meta_classifier=lr, |
|
|
|
random_state=RANDOM_SEED, |
|
|
|
random_state=RANDOM_SEED, |
|
|
|
n_jobs = -1) |
|
|
|
n_jobs = -1) |
|
|
|
|
|
|
|
print(keySpec) |
|
|
|
|
|
|
|
if (keySpec == 0): |
|
|
|
|
|
|
|
sclfStack = sclf |
|
|
|
elif (keyRetrieved == 2): |
|
|
|
elif (keyRetrieved == 2): |
|
|
|
# fix this part! |
|
|
|
# fix this part! |
|
|
|
if (len(all_classifiersSelection) == 0): |
|
|
|
if (len(all_classifiersSelection) == 0): |
|
|
@ -2640,7 +2651,7 @@ def EnsembleModel(Models, keyRetrieved): |
|
|
|
# meta_classifier=lr, |
|
|
|
# meta_classifier=lr, |
|
|
|
# random_state=RANDOM_SEED, |
|
|
|
# random_state=RANDOM_SEED, |
|
|
|
# n_jobs = -1) |
|
|
|
# n_jobs = -1) |
|
|
|
|
|
|
|
|
|
|
|
num_cores = multiprocessing.cpu_count() |
|
|
|
num_cores = multiprocessing.cpu_count() |
|
|
|
inputsSc = ['accuracy','precision_weighted','recall_weighted','accuracy','precision_weighted','recall_weighted'] |
|
|
|
inputsSc = ['accuracy','precision_weighted','recall_weighted','accuracy','precision_weighted','recall_weighted'] |
|
|
|
flat_results = Parallel(n_jobs=num_cores)(delayed(solve)(sclf,sclfStack,XData,yData,crossValidation,item,index) for index, item in enumerate(inputsSc)) |
|
|
|
flat_results = Parallel(n_jobs=num_cores)(delayed(solve)(sclf,sclfStack,XData,yData,crossValidation,item,index) for index, item in enumerate(inputsSc)) |
|
|
|