|
|
|
@ -470,9 +470,11 @@ def dataSetSelection(): |
|
|
|
|
XData, yData = ArrayDataResults, AllTargetsFloatValues |
|
|
|
|
|
|
|
|
|
global keepOriginalFeatures |
|
|
|
|
global OrignList |
|
|
|
|
keepOriginalFeatures = XData.copy() |
|
|
|
|
keepOriginalFeatures.columns = [str(col) + ' F'+str(idx+1)+'' for idx, col in enumerate(keepOriginalFeatures.columns)] |
|
|
|
|
columnsNewGen = keepOriginalFeatures.columns.values.tolist() |
|
|
|
|
OrignList = keepOriginalFeatures.columns.values.tolist() |
|
|
|
|
|
|
|
|
|
XData.columns = ['F'+str(idx+1) for idx, col in enumerate(XData.columns)] |
|
|
|
|
|
|
|
|
@ -526,6 +528,7 @@ def executeModel(exeCall, flagEx, nodeTransfName): |
|
|
|
|
global listofTransformations |
|
|
|
|
global XDataStoredOriginal |
|
|
|
|
global finalResultsData |
|
|
|
|
global OrignList |
|
|
|
|
global tracker |
|
|
|
|
|
|
|
|
|
global XDataNoRemoval |
|
|
|
@ -539,11 +542,12 @@ def executeModel(exeCall, flagEx, nodeTransfName): |
|
|
|
|
if (flagEx == 3): |
|
|
|
|
XDataStored = XData.copy() |
|
|
|
|
XDataNoRemovalOrig = XDataNoRemoval.copy() |
|
|
|
|
OrignList = columnsNewGen |
|
|
|
|
elif (flagEx == 2): |
|
|
|
|
XData = XDataStored.copy() |
|
|
|
|
XDataStoredOriginal = XDataStored.copy() |
|
|
|
|
XDataNoRemoval = XDataNoRemovalOrig.copy() |
|
|
|
|
columnsNewGen = keepOriginalFeatures.columns.values.tolist() |
|
|
|
|
columnsNewGen = OrignList |
|
|
|
|
else: |
|
|
|
|
XData = XDataStored.copy() |
|
|
|
|
XDataNoRemoval = XDataNoRemovalOrig.copy() |
|
|
|
@ -552,13 +556,12 @@ def executeModel(exeCall, flagEx, nodeTransfName): |
|
|
|
|
if (flagEx == 4): |
|
|
|
|
XDataStored = XData.copy() |
|
|
|
|
XDataNoRemovalOrig = XDataNoRemoval.copy() |
|
|
|
|
print('edw!') |
|
|
|
|
#XDataStoredOriginal = XDataStored.copy() |
|
|
|
|
elif (flagEx == 2): |
|
|
|
|
XData = XDataStored.copy() |
|
|
|
|
XDataStoredOriginal = XDataStored.copy() |
|
|
|
|
XDataNoRemoval = XDataNoRemovalOrig.copy() |
|
|
|
|
columnsNewGen = keepOriginalFeatures.columns.values.tolist() |
|
|
|
|
columnsNewGen = OrignList |
|
|
|
|
else: |
|
|
|
|
XData = XDataStored.copy() |
|
|
|
|
#XDataNoRemoval = XDataNoRemovalOrig.copy() |
|
|
|
@ -572,12 +575,20 @@ def executeModel(exeCall, flagEx, nodeTransfName): |
|
|
|
|
bayesopt.maximize(init_points=10, n_iter=5, acq='ucb') # 35 and 15 |
|
|
|
|
bestParams = bayesopt.max['params'] |
|
|
|
|
estimator = XGBClassifier(n_estimators=int(bestParams.get('n_estimators')), eta=bestParams.get('eta'), max_depth=int(bestParams.get('max_depth')), probability=True, random_state=RANDOM_SEED, silent=True, verbosity = 0, use_label_encoder=False) |
|
|
|
|
columnsNewGen = keepOriginalFeatures.columns.values.tolist() |
|
|
|
|
columnsNewGen = OrignList |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print(columnsNewGen) |
|
|
|
|
|
|
|
|
|
if (len(exeCall) != 0): |
|
|
|
|
if (flagEx == 1): |
|
|
|
|
XData = XData.drop(XData.columns[exeCall], axis=1) |
|
|
|
|
XDataStoredOriginal = XDataStoredOriginal.drop(XDataStoredOriginal.columns[exeCall], axis=1) |
|
|
|
|
currentColumnsDeleted = [] |
|
|
|
|
for uniqueValue in exeCall: |
|
|
|
|
currentColumnsDeleted.append(tracker[uniqueValue]) |
|
|
|
|
for column in XData.columns: |
|
|
|
|
if (column in currentColumnsDeleted): |
|
|
|
|
XData = XData.drop(column, axis=1) |
|
|
|
|
XDataStoredOriginal = XDataStoredOriginal.drop(column, axis=1) |
|
|
|
|
elif (flagEx == 2): |
|
|
|
|
columnsKeepNew = [] |
|
|
|
|
columns = XDataGen.columns.values.tolist() |
|
|
|
@ -665,29 +676,6 @@ def executeModel(exeCall, flagEx, nodeTransfName): |
|
|
|
|
|
|
|
|
|
columnsNamesLoc = XData.columns.values.tolist() |
|
|
|
|
|
|
|
|
|
tracker = [] |
|
|
|
|
for value in columnsNewGen: |
|
|
|
|
value = value.split(' ') |
|
|
|
|
if (len(value) > 1): |
|
|
|
|
tracker.append(value[1]) |
|
|
|
|
else: |
|
|
|
|
tracker.append(value[0]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
storeIndices = [] |
|
|
|
|
valuesStore = [] |
|
|
|
|
for ind, col in enumerate(tracker): |
|
|
|
|
for value in XDataStoredOriginal.columns.values.tolist(): |
|
|
|
|
if col in value: |
|
|
|
|
storeIndices.append(ind) |
|
|
|
|
valuesStore.append(valuesStore) |
|
|
|
|
tracker[ind] = tracker[ind].replace(col, value) |
|
|
|
|
else: |
|
|
|
|
break |
|
|
|
|
# FIX THAT! |
|
|
|
|
#for el in storeIndices: |
|
|
|
|
# columnsNewGen[el] = columnsNewGen[el].replace(columnsNewGen[el],valuesStore[el]) |
|
|
|
|
#print(columnsNewGen) |
|
|
|
|
for col in columnsNamesLoc: |
|
|
|
|
splittedCol = col.split('_') |
|
|
|
|
if (len(splittedCol) == 1): |
|
|
|
@ -704,6 +692,23 @@ def executeModel(exeCall, flagEx, nodeTransfName): |
|
|
|
|
print(XDataStored) |
|
|
|
|
print(XDataStoredOriginal.columns) |
|
|
|
|
print(XDataNoRemoval) |
|
|
|
|
|
|
|
|
|
tracker = [] |
|
|
|
|
for value in columnsNewGen: |
|
|
|
|
value = value.split(' ') |
|
|
|
|
if (len(value) > 1): |
|
|
|
|
tracker.append(value[1]) |
|
|
|
|
else: |
|
|
|
|
tracker.append(value[0]) |
|
|
|
|
print(tracker) |
|
|
|
|
|
|
|
|
|
# for ind, col in enumerate(tracker): |
|
|
|
|
# for value in XDataStoredOriginal.columns.values.tolist(): |
|
|
|
|
# if col in value: |
|
|
|
|
# tracker[ind] = tracker[ind].replace(col, value) |
|
|
|
|
# else: |
|
|
|
|
# break |
|
|
|
|
|
|
|
|
|
estimator.fit(XData, yData) |
|
|
|
|
yPredict = estimator.predict(XData) |
|
|
|
|
yPredictProb = cross_val_predict(estimator, XData, yData, cv=crossValidation, method='predict_proba') |
|
|
|
|