parent 1d17aa97c1
commit f476157f9c
  1. BIN
      __pycache__/run.cpython-38.pyc
  2. 33
      frontend/src/components/FeatureSpaceDetail.vue
  3. 29
      frontend/src/components/Heatmap.vue
  4. 2
      frontend/src/components/Main.vue
  5. 24
      frontend/src/components/Results.vue
  6. 207
      run.py

Binary file not shown.

@ -62,6 +62,7 @@ export default {
mode: 0, // this should be 0 mode: 0, // this should be 0
KeepIDs: [], KeepIDs: [],
KeepIDTransform: [], KeepIDTransform: [],
KeepNamesGlobal: [],
keepNumberOfCompareNodes: 0, keepNumberOfCompareNodes: 0,
activeLeafNode: -1, activeLeafNode: -1,
spaceChangeDetail: false spaceChangeDetail: false
@ -98,6 +99,7 @@ export default {
setLayerExplore() { setLayerExplore() {
this.mode = 0 this.mode = 0
this.KeepIDs = [] this.KeepIDs = []
this.KeepNamesGlobal = []
this.KeepIDTransform = [] this.KeepIDTransform = []
this.keepNumberOfCompareNodes = 0 this.keepNumberOfCompareNodes = 0
//this.graphVizualization() //this.graphVizualization()
@ -822,7 +824,7 @@ export default {
var legendCall = this.legendOnlyOnce var legendCall = this.legendOnlyOnce
var listofNodes = this.dataFS[34] var listofNodes = this.dataFS[33]
var corrTarget = JSON.parse(this.dataFS[8+this.quadrantNumber]) var corrTarget = JSON.parse(this.dataFS[8+this.quadrantNumber])
var corrGlob = JSON.parse(this.dataFS[13+this.quadrantNumber]) var corrGlob = JSON.parse(this.dataFS[13+this.quadrantNumber])
@ -948,6 +950,7 @@ export default {
var selectionCounter = this.keepNumberOfCompareNodes var selectionCounter = this.keepNumberOfCompareNodes
var IDsGather = this.KeepIDs var IDsGather = this.KeepIDs
var IDsGatherTrans = this.KeepIDTransform var IDsGatherTrans = this.KeepIDTransform
var keepNames = this.KeepNamesGlobal
var node = svg.append('g') var node = svg.append('g')
.attr('class', 'nodes') .attr('class', 'nodes')
@ -961,9 +964,17 @@ export default {
if (!clickedNode.includes("root")) { if (!clickedNode.includes("root")) {
var clearSendNode = [] var clearSendNode = []
clearSendNode.push(id.name) clearSendNode.push(id.name)
var name = id.name
var splitName = name.split("_")
for (let m = 0; m < listofNodes.length ; m++) {
if (listofNodes[m].includes(splitName[0])) {
var valueToSend = m
}
}
clearSendNode.push(clickedNode-1) clearSendNode.push(clickedNode-1)
EventBus.$emit('updateHistoryKey', 2) EventBus.$emit('updateHistoryKey', 2)
EventBus.$emit('updateValuesofHistory', clickedNode-1) EventBus.$emit('updateValuesofHistory', valueToSend)
EventBus.$emit('UpdateIDTrans', [clickedNode-1]) EventBus.$emit('UpdateIDTrans', [clickedNode-1])
EventBus.$emit('transformNodes', clearSendNode) EventBus.$emit('transformNodes', clearSendNode)
} else { } else {
@ -1072,13 +1083,21 @@ export default {
groupsColor.setAttribute('fill', '#969696') groupsColor.setAttribute('fill', '#969696')
selectionCounter = selectionCounter + 1 selectionCounter = selectionCounter + 1
EventBus.$emit('Counter', selectionCounter) EventBus.$emit('Counter', selectionCounter)
var name = id.name
var splitName = name.split("_")
for (let m = 0; m < listofNodes.length ; m++) {
if (listofNodes[m].includes(splitName[0])) {
var valueToSend = m
}
}
keepNames.push(valueToSend)
IDsGather.push(idLocal); IDsGather.push(idLocal);
if (selectionCounter == 2) { if (selectionCounter == 2) {
EventBus.$emit('updateValuesofHistory', IDsGather) EventBus.$emit('updateValuesofHistory', keepNames)
EventBus.$emit('UpdateIDs', IDsGather) EventBus.$emit('UpdateIDs', IDsGather)
EventBus.$emit('CompareTwo', IDsGather) EventBus.$emit('CompareTwo', IDsGather)
} else if (selectionCounter == 3) { } else if (selectionCounter == 3) {
EventBus.$emit('updateValuesofHistory', IDsGather) EventBus.$emit('updateValuesofHistory', keepNames)
EventBus.$emit('UpdateIDs', IDsGather) EventBus.$emit('UpdateIDs', IDsGather)
EventBus.$emit('CompareThree', IDsGather) EventBus.$emit('CompareThree', IDsGather)
} else { } else {
@ -1094,8 +1113,9 @@ export default {
} }
EventBus.$emit('UpdateIDs', IDsGather) EventBus.$emit('UpdateIDs', IDsGather)
if (selectionCounter == 1) { if (selectionCounter == 1) {
EventBus.$emit('diactiveTransform') //EventBus.$emit('diactiveTransform')
EventBus.$emit('Default') //EventBus.$emit('Default')
EventBus.$emit('storeGeneration')
} else if (selectionCounter == 2) { } else if (selectionCounter == 2) {
EventBus.$emit('UpdateIDs', IDsGather) EventBus.$emit('UpdateIDs', IDsGather)
EventBus.$emit('CompareTwo', IDsGather) EventBus.$emit('CompareTwo', IDsGather)
@ -1915,6 +1935,7 @@ export default {
EventBus.$on('Counter', data => { this.keepNumberOfCompareNodes = data }) EventBus.$on('Counter', data => { this.keepNumberOfCompareNodes = data })
EventBus.$on('UpdateIDs', data => { this.KeepIDs = data }) EventBus.$on('UpdateIDs', data => { this.KeepIDs = data })
EventBus.$on('UpdateNames', data => { this.KeepNamesGlobal = data })
EventBus.$on('UpdateIDTrans', data => { this.KeepIDTransform = data }) EventBus.$on('UpdateIDTrans', data => { this.KeepIDTransform = data })

@ -40,7 +40,8 @@ export default {
dataFI: [], dataFI: [],
featureData: [], featureData: [],
generKey: [], generKey: [],
featureGenGlobal: [] featureGenGlobal: [],
keepMainRemovedFeatures: [],
} }
}, },
methods: { methods: {
@ -73,6 +74,8 @@ export default {
var featureUni = JSON.parse(this.dataFI[0]) var featureUni = JSON.parse(this.dataFI[0])
var featuresFinal = this.featureData[33] var featuresFinal = this.featureData[33]
var status = this.keepMainRemovedFeatures
var algorithms = [] var algorithms = []
algorithms.push("Univariate FS") algorithms.push("Univariate FS")
algorithms.push("Impurity-based FI") algorithms.push("Impurity-based FI")
@ -131,7 +134,15 @@ export default {
values[j] = ((((Object.values(featureUni.Score)[i]-minUni)/(maxUni-minUni)))+(ImpurityFS[0][i])+(PermImpEli[i][0])+(FeaturesAccuracy[i][0])+(RankingFS[0][i]))/(len2-2) values[j] = ((((Object.values(featureUni.Score)[i]-minUni)/(maxUni-minUni)))+(ImpurityFS[0][i])+(PermImpEli[i][0])+(FeaturesAccuracy[i][0])+(RankingFS[0][i]))/(len2-2)
} else { } else {
if (Object.entries(this.generKey).length == 0) { if (Object.entries(this.generKey).length == 0) {
if (status.length != 0) {
if (status.includes(Features[i])){
values[j] = -4
} else {
values[j] = -2 values[j] = -2
}
} else {
values[j] = -2
}
} else { } else {
if (Object.entries(this.generKey).length == 7) { if (Object.entries(this.generKey).length == 7) {
if (i == 0 || i == 1) { if (i == 0 || i == 1) {
@ -170,6 +181,9 @@ export default {
}, },
heatmap_display(data, heatmapId) { heatmap_display(data, heatmapId) {
var status = this.keepMainRemovedFeatures
if (Object.entries(this.generKey).length == 0) { if (Object.entries(this.generKey).length == 0) {
var Features = JSON.parse(this.featureData[0]) var Features = JSON.parse(this.featureData[0])
} else { } else {
@ -399,6 +413,15 @@ export default {
if (index > -1) { if (index > -1) {
featuresAddRem.splice(index, 1); featuresAddRem.splice(index, 1);
} }
if (status.includes(Features[k])) {
var outputArray = [];
for (let i = 0; i < status.length; i++) {
if (status[i] !== Features[k]) {
outputArray.push(status[i]);
}
}
EventBus.$emit('updateRemovedFeaturesBack', outputArray)
}
EventBus.$emit('updateHistoryKey', 0) EventBus.$emit('updateHistoryKey', 0)
EventBus.$emit('updateValuesofHistory', k) EventBus.$emit('updateValuesofHistory', k)
EventBus.$emit('addFeature', featuresAddRem) EventBus.$emit('addFeature', featuresAddRem)
@ -429,7 +452,9 @@ export default {
EventBus.$emit('removeFeaturesGen', featuresGen) EventBus.$emit('removeFeaturesGen', featuresGen)
return "url(#diagonalHatch)" return "url(#diagonalHatch)"
} else { } else {
status.push(Features[k])
featuresAddRem.push(k) featuresAddRem.push(k)
EventBus.$emit('updateRemovedFeatures', status)
EventBus.$emit('updateHistoryKey', 1) EventBus.$emit('updateHistoryKey', 1)
EventBus.$emit('updateValuesofHistory', k) EventBus.$emit('updateValuesofHistory', k)
EventBus.$emit('removeFeatures', featuresAddRem) EventBus.$emit('removeFeatures', featuresAddRem)
@ -650,6 +675,8 @@ export default {
EventBus.$on('quad', data => { this.featureData = data }) EventBus.$on('quad', data => { this.featureData = data })
EventBus.$on('updateRemovedFeatures', data => { this.keepMainRemovedFeatures = data })
EventBus.$on('reset', this.reset) EventBus.$on('reset', this.reset)
} }
} }

@ -149,7 +149,7 @@ export default Vue.extend({
DataResults: '', DataResults: '',
keyNow: 1, keyNow: 1,
instancesImportance: '', instancesImportance: '',
RetrieveValueFile: 'BreastC', // this is for the default data set RetrieveValueFile: 'IrisC', // this is for the default data set
SelectedFeaturesPerClassifier: '', SelectedFeaturesPerClassifier: '',
FinalResults: 0, FinalResults: 0,
selectedAlgorithm: '', selectedAlgorithm: '',

@ -27,7 +27,9 @@ export default {
whereIsChange: -1, whereIsChange: -1,
previousState: [], previousState: [],
storeBestSoFarAV: [], storeBestSoFarAV: [],
flag: true flag: true,
onHold: 0,
keepFeaturesAddedGenRemoved: 0
} }
}, },
methods: { methods: {
@ -44,8 +46,18 @@ export default {
svg.selectAll("*").remove(); svg.selectAll("*").remove();
var data = [] var data = []
var features = this.featuresReceived[33] var features = this.featuresReceived[33]
if (this.historyKey == 5) {
this.onHold = 0
}
if (this.historyKey == 3) {
if (this.onHold > 0) {
for ( var i = 0; i < this.onHold; i++ ) {
features.pop();
}
}
}
if (this.historyKey == -1) { if (this.historyKey == -1) {
for (let i = 0; i < features.length; i++) { for (let i = 0; i < features.length; i++) {
this.valuesGlobal.push([state,0,0,0]) this.valuesGlobal.push([state,0,0,0])
@ -65,11 +77,13 @@ export default {
this.valuesGlobal[this.whereIsChange[j]][0] = state this.valuesGlobal[this.whereIsChange[j]][0] = state
} }
} else if (this.historyKey == 5) { } else if (this.historyKey == 5) {
for (let k = 0; k < this.keepFeaturesAddedGenRemoved ; k++) {
this.valuesGlobal.push([state,0,0,0]) this.valuesGlobal.push([state,0,0,0])
}
} else { } else {
} }
console.log(this.valuesGlobal)
var toWhichTrans = this.historyKey var toWhichTrans = this.historyKey
var toWhichPosition = this.whereIsChange var toWhichPosition = this.whereIsChange
var counterSet = -1 var counterSet = -1
@ -472,12 +486,16 @@ export default {
EventBus.$on('updateHistoryKey', data => { this.historyKey = data }) EventBus.$on('updateHistoryKey', data => { this.historyKey = data })
EventBus.$on('updateValuesofHistory', data => { this.whereIsChange = data }) EventBus.$on('updateValuesofHistory', data => { this.whereIsChange = data })
EventBus.$on('addFeatureGen', data => { this.onHold = Object.values(data).length })
EventBus.$on('finalResults', data => { this.ValidResultsVar = data }) EventBus.$on('finalResults', data => { this.ValidResultsVar = data })
EventBus.$on('finalResults', this.initializeLinePLot) EventBus.$on('finalResults', this.initializeLinePLot)
EventBus.$on('quad', data => { this.featuresReceived = data }) EventBus.$on('quad', data => { this.featuresReceived = data })
EventBus.$on('finalResults', this.HistoryPun) EventBus.$on('finalResults', this.HistoryPun)
EventBus.$on('addFeatureGen', data => { this.keepFeaturesAddedGenRemoved = Object.values(data).length })
EventBus.$on('reset', this.reset) EventBus.$on('reset', this.reset)
} }
} }

207
run.py

@ -58,11 +58,6 @@ def reset():
global filterActionFinal global filterActionFinal
filterActionFinal = '' filterActionFinal = ''
global storePositions
global storeReplacements
storePositions = []
storeReplacements = []
global keySpecInternal global keySpecInternal
keySpecInternal = 1 keySpecInternal = 1
@ -159,11 +154,6 @@ def retrieveFileName():
global DataResultsRawTest global DataResultsRawTest
global DataRawLengthTest global DataRawLengthTest
global storePositions
global storeReplacements
storePositions = []
storeReplacements = []
global fileName global fileName
fileName = [] fileName = []
fileName = request.get_data().decode('utf8').replace("'", '"') fileName = request.get_data().decode('utf8').replace("'", '"')
@ -481,7 +471,7 @@ def dataSetSelection():
global keepOriginalFeatures global keepOriginalFeatures
keepOriginalFeatures = XData.copy() keepOriginalFeatures = XData.copy()
keepOriginalFeatures.columns = [str(col) + ' (F'+str(idx+1)+')' for idx, col in enumerate(keepOriginalFeatures.columns)] keepOriginalFeatures.columns = [str(col) + ' F'+str(idx+1)+'' for idx, col in enumerate(keepOriginalFeatures.columns)]
columnsNewGen = keepOriginalFeatures.columns.values.tolist() columnsNewGen = keepOriginalFeatures.columns.values.tolist()
XData.columns = ['F'+str(idx+1) for idx, col in enumerate(XData.columns)] XData.columns = ['F'+str(idx+1) for idx, col in enumerate(XData.columns)]
@ -536,6 +526,7 @@ def executeModel(exeCall, flagEx, nodeTransfName):
global listofTransformations global listofTransformations
global XDataStoredOriginal global XDataStoredOriginal
global finalResultsData global finalResultsData
global tracker
global XDataNoRemoval global XDataNoRemoval
global XDataNoRemovalOrig global XDataNoRemovalOrig
@ -548,6 +539,11 @@ def executeModel(exeCall, flagEx, nodeTransfName):
if (flagEx == 3): if (flagEx == 3):
XDataStored = XData.copy() XDataStored = XData.copy()
XDataNoRemovalOrig = XDataNoRemoval.copy() XDataNoRemovalOrig = XDataNoRemoval.copy()
elif (flagEx == 2):
XData = XDataStored.copy()
XDataStoredOriginal = XDataStored.copy()
XDataNoRemoval = XDataNoRemovalOrig.copy()
columnsNewGen = keepOriginalFeatures.columns.values.tolist()
else: else:
XData = XDataStored.copy() XData = XDataStored.copy()
XDataNoRemoval = XDataNoRemovalOrig.copy() XDataNoRemoval = XDataNoRemovalOrig.copy()
@ -555,12 +551,19 @@ def executeModel(exeCall, flagEx, nodeTransfName):
else: else:
if (flagEx == 4): if (flagEx == 4):
XDataStored = XData.copy() XDataStored = XData.copy()
XDataNoRemovalOrig = XDataNoRemoval.copy()
print('edw!')
#XDataStoredOriginal = XDataStored.copy()
elif (flagEx == 2): elif (flagEx == 2):
pass
else:
XData = XDataStored.copy() XData = XDataStored.copy()
XDataStoredOriginal = XDataStored.copy() XDataStoredOriginal = XDataStored.copy()
XDataNoRemoval = XDataNoRemovalOrig.copy()
columnsNewGen = keepOriginalFeatures.columns.values.tolist() columnsNewGen = keepOriginalFeatures.columns.values.tolist()
else:
XData = XDataStored.copy()
#XDataNoRemoval = XDataNoRemovalOrig.copy()
XDataStoredOriginal = XDataStored.copy()
# Bayesian Optimization CHANGE INIT_POINTS! # Bayesian Optimization CHANGE INIT_POINTS!
if (keyFirstTime): if (keyFirstTime):
create_global_function() create_global_function()
@ -569,6 +572,7 @@ def executeModel(exeCall, flagEx, nodeTransfName):
bayesopt.maximize(init_points=10, n_iter=5, acq='ucb') # 35 and 15 bayesopt.maximize(init_points=10, n_iter=5, acq='ucb') # 35 and 15
bestParams = bayesopt.max['params'] 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) 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()
if (len(exeCall) != 0): if (len(exeCall) != 0):
if (flagEx == 1): if (flagEx == 1):
@ -588,18 +592,20 @@ def executeModel(exeCall, flagEx, nodeTransfName):
XDataNoRemoval[columnsKeepNew] = XDataTemp.values XDataNoRemoval[columnsKeepNew] = XDataTemp.values
elif (flagEx == 4): elif (flagEx == 4):
splittedCol = nodeTransfName.split('_') splittedCol = nodeTransfName.split('_')
XData.rename(columns={ XData.columns[exeCall[0]]: nodeTransfName }, inplace = True) for col in XDataNoRemoval.columns:
if ((splittedCol[0] in col)):
storeRenamedColumn = col
XData.rename(columns={ storeRenamedColumn: nodeTransfName }, inplace = True)
XDataNoRemoval.rename(columns={ storeRenamedColumn: nodeTransfName }, inplace = True)
currentColumn = columnsNewGen[exeCall[0]] currentColumn = columnsNewGen[exeCall[0]]
subString = currentColumn[currentColumn.find("(")+1:currentColumn.find(")")] subString = currentColumn[currentColumn.find("(")+1:currentColumn.find(")")]
replacement = currentColumn.replace(subString, nodeTransfName) replacement = currentColumn.replace(subString, nodeTransfName)
storePositions.append(exeCall[0]) for ind, column in enumerate(columnsNewGen):
storeReplacements.append(replacement) if ((splittedCol[0] in column)):
pos = 0 columnsNewGen[ind] = columnsNewGen[ind].replace(storeRenamedColumn, nodeTransfName)
for repl in storeReplacements:
columnsNewGen[storePositions[pos]] = repl
pos += 1
if (len(splittedCol) == 1): if (len(splittedCol) == 1):
XData[nodeTransfName] = XDataStoredOriginal[nodeTransfName] XData[nodeTransfName] = XDataStoredOriginal[nodeTransfName]
XDataNoRemoval[nodeTransfName] = XDataStoredOriginal[nodeTransfName]
else: else:
if (splittedCol[1] == 'r'): if (splittedCol[1] == 'r'):
XData[nodeTransfName] = XData[nodeTransfName].round() XData[nodeTransfName] = XData[nodeTransfName].round()
@ -653,10 +659,35 @@ def executeModel(exeCall, flagEx, nodeTransfName):
XData[nodeTransfName] = np.power(XData[nodeTransfName], 3) XData[nodeTransfName] = np.power(XData[nodeTransfName], 3)
else: else:
XData[nodeTransfName] = np.power(XData[nodeTransfName], 4) XData[nodeTransfName] = np.power(XData[nodeTransfName], 4)
XDataNoRemoval[nodeTransfName] = XData[nodeTransfName]
XDataStored = XData.copy() XDataStored = XData.copy()
XDataNoRemovalOrig = XDataNoRemoval.copy()
columnsNamesLoc = XData.columns.values.tolist() 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: for col in columnsNamesLoc:
splittedCol = col.split('_') splittedCol = col.split('_')
if (len(splittedCol) == 1): if (len(splittedCol) == 1):
@ -669,10 +700,14 @@ def executeModel(exeCall, flagEx, nodeTransfName):
else: else:
columnsNames.append(splittedCol[0]+'_'+tran) columnsNames.append(splittedCol[0]+'_'+tran)
featureImportanceData = estimatorFeatureSelection(XDataNoRemoval, estimator) featureImportanceData = estimatorFeatureSelection(XDataNoRemoval, estimator)
print(XData)
print(XDataStored)
print(XDataStoredOriginal.columns)
print(XDataNoRemoval)
estimator.fit(XData, yData) estimator.fit(XData, yData)
yPredict = estimator.predict(XData) yPredict = estimator.predict(XData)
yPredictProb = cross_val_predict(estimator, XData, yData, cv=crossValidation, method='predict_proba') yPredictProb = cross_val_predict(estimator, XData, yData, cv=crossValidation, method='predict_proba')
print(XData)
num_cores = multiprocessing.cpu_count() num_cores = multiprocessing.cpu_count()
inputsSc = ['accuracy','precision_macro','recall_macro'] inputsSc = ['accuracy','precision_macro','recall_macro']
@ -738,7 +773,7 @@ def featFun (clfLocalPar,DataLocalPar,yDataLocalPar):
# # calculating for all algorithms and models the performance and other results # # calculating for all algorithms and models the performance and other results
# @memory.cache # @memory.cache
def estimatorFeatureSelection(Data, clf): def estimatorFeatureSelection(Data, clf):
print(Data)
resultsFS = [] resultsFS = []
permList = [] permList = []
PerFeatureAccuracy = [] PerFeatureAccuracy = []
@ -1715,7 +1750,7 @@ def Seperation():
packCorr.append(json.dumps(MI4List)) packCorr.append(json.dumps(MI4List))
packCorr.append(json.dumps(MI5List)) packCorr.append(json.dumps(MI5List))
packCorr.append(list(XDataStored.columns.values.tolist())) packCorr.append(list(tracker))
packCorr.append(list(XData.columns.values.tolist())) packCorr.append(list(XData.columns.values.tolist()))
packCorr.append(json.dumps(columnsNames)) packCorr.append(json.dumps(columnsNames))
@ -1776,6 +1811,7 @@ def CompareFunPy():
global columnsKeep global columnsKeep
global XDataGen global XDataGen
global IDsToCompare global IDsToCompare
global columnsNewGen
retrieveComparison = request.get_data().decode('utf8').replace("'", '"') retrieveComparison = request.get_data().decode('utf8').replace("'", '"')
retrieveComparison = json.loads(retrieveComparison) retrieveComparison = json.loads(retrieveComparison)
@ -1783,7 +1819,8 @@ def CompareFunPy():
IDsToCompare = retrieveComparison['getIDs'] IDsToCompare = retrieveComparison['getIDs']
XDataGen = XDataStored.copy() XDataGen = XDataStored.copy()
columns = XData.columns.values.tolist() columns = XData.columns.values.tolist()
columnsOriganl = keepOriginalFeatures.columns.values.tolist() #columnsOriganl = XDataNoRemoval.columns.values.tolist()
columnsKeep = [] columnsKeep = []
columnsKeepNonOrig = [] columnsKeepNonOrig = []
columnsKeepID = [] columnsKeepID = []
@ -1791,76 +1828,76 @@ def CompareFunPy():
if indx in IDsToCompare: if indx in IDsToCompare:
columnsKeepNonOrig.append(col) columnsKeepNonOrig.append(col)
columnExtracted = re.findall('\d+', col) columnExtracted = re.findall('\d+', col)
columnsKeep.append(columnsOriganl[int(columnExtracted[0]) - 1]) columnsKeep.append(columnsNewGen[int(columnExtracted[0]) - 1])
columnsKeepID.append(str(int(columnExtracted[0]))) columnsKeepID.append(str(col))
if (compareMode == 1): if (compareMode == 1):
XDataGen = XData[columnsKeepNonOrig] XDataGen = XData[columnsKeepNonOrig]
feat1 = XDataGen.iloc[:,0] feat1 = XDataGen.iloc[:,0]
feat2 = XDataGen.iloc[:,1] feat2 = XDataGen.iloc[:,1]
XDataGen['F'+columnsKeepID[0]+'+F'+columnsKeepID[1]] = feat1 + feat2 XDataGen[columnsKeepID[0]+'+'+columnsKeepID[1]] = feat1 + feat2
XDataGen['|F'+columnsKeepID[0]+'-F'+columnsKeepID[1]+'|'] = abs(feat1 - feat2) XDataGen['|'+columnsKeepID[0]+'-'+columnsKeepID[1]+'|'] = abs(feat1 - feat2)
XDataGen['F'+columnsKeepID[0]+'xF'+columnsKeepID[1]] = feat1 * feat2 XDataGen[columnsKeepID[0]+'x'+columnsKeepID[1]] = feat1 * feat2
XDataGen['F'+columnsKeepID[0]+'/F'+columnsKeepID[1]] = feat1 / feat2 XDataGen[columnsKeepID[0]+'/'+columnsKeepID[1]] = feat1 / feat2
XDataGen['F'+columnsKeepID[1]+'/F'+columnsKeepID[0]] = feat2 / feat1 XDataGen[columnsKeepID[1]+'/'+columnsKeepID[0]] = feat2 / feat1
columnsKeep.append('F'+columnsKeepID[0]+'+F'+columnsKeepID[1]) columnsKeep.append(columnsKeepID[0]+'+'+columnsKeepID[1])
columnsKeep.append('|F'+columnsKeepID[0]+'-F'+columnsKeepID[1]+'|') columnsKeep.append('|'+columnsKeepID[0]+'-'+columnsKeepID[1]+'|')
columnsKeep.append('F'+columnsKeepID[0]+'xF'+columnsKeepID[1]) columnsKeep.append(columnsKeepID[0]+'x'+columnsKeepID[1])
columnsKeep.append('F'+columnsKeepID[0]+'/F'+columnsKeepID[1]) columnsKeep.append(columnsKeepID[0]+'/'+columnsKeepID[1])
columnsKeep.append('F'+columnsKeepID[1]+'/F'+columnsKeepID[0]) columnsKeep.append(columnsKeepID[1]+'/'+columnsKeepID[0])
elif (compareMode == 2): elif (compareMode == 2):
XDataGen = XData[columnsKeepNonOrig] XDataGen = XData[columnsKeepNonOrig]
feat1 = XDataGen.iloc[:,0] feat1 = XDataGen.iloc[:,0]
feat2 = XDataGen.iloc[:,1] feat2 = XDataGen.iloc[:,1]
feat3 = XDataGen.iloc[:,2] feat3 = XDataGen.iloc[:,2]
XDataGen['F'+columnsKeepID[0]+'+F'+columnsKeepID[1]] = feat1 + feat2 XDataGen[columnsKeepID[0]+'+'+columnsKeepID[1]] = feat1 + feat2
XDataGen['F'+columnsKeepID[1]+'+F'+columnsKeepID[2]] = feat2 + feat3 XDataGen[columnsKeepID[1]+'+'+columnsKeepID[2]] = feat2 + feat3
XDataGen['F'+columnsKeepID[0]+'+F'+columnsKeepID[2]] = feat1 + feat3 XDataGen[columnsKeepID[0]+'+'+columnsKeepID[2]] = feat1 + feat3
XDataGen['F'+columnsKeepID[0]+'+F'+columnsKeepID[1]+'+F'+columnsKeepID[2]] = feat1 + feat2 + feat3 XDataGen[columnsKeepID[0]+'+'+columnsKeepID[1]+'+'+columnsKeepID[2]] = feat1 + feat2 + feat3
XDataGen['|F'+columnsKeepID[0]+'-F'+columnsKeepID[1]+'|'] = abs(feat1 - feat2) XDataGen['|'+columnsKeepID[0]+'-'+columnsKeepID[1]+'|'] = abs(feat1 - feat2)
XDataGen['|F'+columnsKeepID[1]+'-F'+columnsKeepID[2]+'|'] = abs(feat2 - feat3) XDataGen['|'+columnsKeepID[1]+'-'+columnsKeepID[2]+'|'] = abs(feat2 - feat3)
XDataGen['|F'+columnsKeepID[0]+'-F'+columnsKeepID[2]+'|'] = abs(feat1 - feat3) XDataGen['|'+columnsKeepID[0]+'-'+columnsKeepID[2]+'|'] = abs(feat1 - feat3)
XDataGen['|F'+columnsKeepID[0]+'-F'+columnsKeepID[1]+'-F'+columnsKeepID[2]+'|'] = abs(feat1 - feat2 - feat3) XDataGen['|'+columnsKeepID[0]+'-'+columnsKeepID[1]+'-'+columnsKeepID[2]+'|'] = abs(feat1 - feat2 - feat3)
XDataGen['F'+columnsKeepID[0]+'xF'+columnsKeepID[1]] = feat1 * feat2 XDataGen[columnsKeepID[0]+'x'+columnsKeepID[1]] = feat1 * feat2
XDataGen['F'+columnsKeepID[1]+'xF'+columnsKeepID[2]] = feat2 * feat3 XDataGen[columnsKeepID[1]+'x'+columnsKeepID[2]] = feat2 * feat3
XDataGen['F'+columnsKeepID[0]+'xF'+columnsKeepID[2]] = feat1 * feat3 XDataGen[columnsKeepID[0]+'x'+columnsKeepID[2]] = feat1 * feat3
XDataGen['F'+columnsKeepID[0]+'xF'+columnsKeepID[1]+'xF'+columnsKeepID[2]] = feat1 * feat2 * feat3 XDataGen[columnsKeepID[0]+'x'+columnsKeepID[1]+'x'+columnsKeepID[2]] = feat1 * feat2 * feat3
XDataGen['F'+columnsKeepID[0]+'/F'+columnsKeepID[1]] = feat1 / feat2 XDataGen[columnsKeepID[0]+'/'+columnsKeepID[1]] = feat1 / feat2
XDataGen['F'+columnsKeepID[1]+'/F'+columnsKeepID[0]] = feat2 / feat1 XDataGen[columnsKeepID[1]+'/'+columnsKeepID[0]] = feat2 / feat1
XDataGen['F'+columnsKeepID[1]+'/F'+columnsKeepID[2]] = feat2 / feat3 XDataGen[columnsKeepID[1]+'/'+columnsKeepID[2]] = feat2 / feat3
XDataGen['F'+columnsKeepID[2]+'/F'+columnsKeepID[1]] = feat3 / feat2 XDataGen[columnsKeepID[2]+'/'+columnsKeepID[1]] = feat3 / feat2
XDataGen['F'+columnsKeepID[0]+'/F'+columnsKeepID[2]] = feat1 / feat3 XDataGen[columnsKeepID[0]+'/'+columnsKeepID[2]] = feat1 / feat3
XDataGen['F'+columnsKeepID[2]+'/F'+columnsKeepID[0]] = feat3 / feat1 XDataGen[columnsKeepID[2]+'/'+columnsKeepID[0]] = feat3 / feat1
XDataGen['F'+columnsKeepID[0]+'/F'+columnsKeepID[1]+'/F'+columnsKeepID[2]] = feat1 / feat2 / feat3 XDataGen[columnsKeepID[0]+'/'+columnsKeepID[1]+'/'+columnsKeepID[2]] = feat1 / feat2 / feat3
XDataGen['F'+columnsKeepID[0]+'/F'+columnsKeepID[2]+'/F'+columnsKeepID[1]] = feat1 / feat3 / feat2 XDataGen[columnsKeepID[0]+'/'+columnsKeepID[2]+'/'+columnsKeepID[1]] = feat1 / feat3 / feat2
XDataGen['F'+columnsKeepID[1]+'/F'+columnsKeepID[2]+'/F'+columnsKeepID[0]] = feat2 / feat3 / feat1 XDataGen[columnsKeepID[1]+'/'+columnsKeepID[2]+'/'+columnsKeepID[0]] = feat2 / feat3 / feat1
XDataGen['F'+columnsKeepID[1]+'/F'+columnsKeepID[0]+'/F'+columnsKeepID[2]] = feat2 / feat1 / feat3 XDataGen[columnsKeepID[1]+'/'+columnsKeepID[0]+'/'+columnsKeepID[2]] = feat2 / feat1 / feat3
XDataGen['F'+columnsKeepID[2]+'/F'+columnsKeepID[0]+'/F'+columnsKeepID[1]] = feat3 / feat1 / feat2 XDataGen[columnsKeepID[2]+'/'+columnsKeepID[0]+'/'+columnsKeepID[1]] = feat3 / feat1 / feat2
XDataGen['F'+columnsKeepID[2]+'/F'+columnsKeepID[1]+'/F'+columnsKeepID[0]] = feat3 / feat2 / feat1 XDataGen[columnsKeepID[2]+'/'+columnsKeepID[1]+'/'+columnsKeepID[0]] = feat3 / feat2 / feat1
columnsKeep.append('F'+columnsKeepID[0]+'+F'+columnsKeepID[1]) columnsKeep.append(columnsKeepID[0]+'+'+columnsKeepID[1])
columnsKeep.append('F'+columnsKeepID[1]+'+F'+columnsKeepID[2]) columnsKeep.append(columnsKeepID[1]+'+'+columnsKeepID[2])
columnsKeep.append('F'+columnsKeepID[0]+'+F'+columnsKeepID[2]) columnsKeep.append(columnsKeepID[0]+'+'+columnsKeepID[2])
columnsKeep.append('F'+columnsKeepID[0]+'+F'+columnsKeepID[1]+'+F'+columnsKeepID[2]) columnsKeep.append(columnsKeepID[0]+'+'+columnsKeepID[1]+'+'+columnsKeepID[2])
columnsKeep.append('|F'+columnsKeepID[0]+'-F'+columnsKeepID[1]+'|') columnsKeep.append('|'+columnsKeepID[0]+'-'+columnsKeepID[1]+'|')
columnsKeep.append('|F'+columnsKeepID[1]+'-F'+columnsKeepID[2]+'|') columnsKeep.append('|'+columnsKeepID[1]+'-'+columnsKeepID[2]+'|')
columnsKeep.append('|F'+columnsKeepID[0]+'-F'+columnsKeepID[2]+'|') columnsKeep.append('|'+columnsKeepID[0]+'-'+columnsKeepID[2]+'|')
columnsKeep.append('|F'+columnsKeepID[0]+'-F'+columnsKeepID[1]+'-F'+columnsKeepID[2]+'|') columnsKeep.append('|'+columnsKeepID[0]+'-'+columnsKeepID[1]+'-'+columnsKeepID[2]+'|')
columnsKeep.append('F'+columnsKeepID[0]+'xF'+columnsKeepID[1]) columnsKeep.append(columnsKeepID[0]+'x'+columnsKeepID[1])
columnsKeep.append('F'+columnsKeepID[1]+'xF'+columnsKeepID[2]) columnsKeep.append(columnsKeepID[1]+'x'+columnsKeepID[2])
columnsKeep.append('F'+columnsKeepID[0]+'xF'+columnsKeepID[2]) columnsKeep.append(columnsKeepID[0]+'x'+columnsKeepID[2])
columnsKeep.append('F'+columnsKeepID[0]+'xF'+columnsKeepID[1]+'xF'+columnsKeepID[2]) columnsKeep.append(columnsKeepID[0]+'x'+columnsKeepID[1]+'x'+columnsKeepID[2])
columnsKeep.append('F'+columnsKeepID[0]+'/F'+columnsKeepID[1]) columnsKeep.append(columnsKeepID[0]+'/'+columnsKeepID[1])
columnsKeep.append('F'+columnsKeepID[1]+'/F'+columnsKeepID[0]) columnsKeep.append(columnsKeepID[1]+'/'+columnsKeepID[0])
columnsKeep.append('F'+columnsKeepID[1]+'/F'+columnsKeepID[2]) columnsKeep.append(columnsKeepID[1]+'/'+columnsKeepID[2])
columnsKeep.append('F'+columnsKeepID[2]+'/F'+columnsKeepID[1]) columnsKeep.append(columnsKeepID[2]+'/'+columnsKeepID[1])
columnsKeep.append('F'+columnsKeepID[0]+'/F'+columnsKeepID[2]) columnsKeep.append(columnsKeepID[0]+'/'+columnsKeepID[2])
columnsKeep.append('F'+columnsKeepID[2]+'/F'+columnsKeepID[0]) columnsKeep.append(columnsKeepID[2]+'/'+columnsKeepID[0])
columnsKeep.append('F'+columnsKeepID[0]+'/F'+columnsKeepID[1]+'/F'+columnsKeepID[2]) columnsKeep.append(columnsKeepID[0]+'/'+columnsKeepID[1]+'/'+columnsKeepID[2])
columnsKeep.append('F'+columnsKeepID[0]+'/F'+columnsKeepID[2]+'/F'+columnsKeepID[1]) columnsKeep.append(columnsKeepID[0]+'/'+columnsKeepID[2]+'/'+columnsKeepID[1])
columnsKeep.append('F'+columnsKeepID[1]+'/F'+columnsKeepID[2]+'/F'+columnsKeepID[0]) columnsKeep.append(columnsKeepID[1]+'/'+columnsKeepID[2]+'/'+columnsKeepID[0])
columnsKeep.append('F'+columnsKeepID[1]+'/F'+columnsKeepID[0]+'/F'+columnsKeepID[2]) columnsKeep.append(columnsKeepID[1]+'/'+columnsKeepID[0]+'/'+columnsKeepID[2])
columnsKeep.append('F'+columnsKeepID[2]+'/F'+columnsKeepID[0]+'/F'+columnsKeepID[1]) columnsKeep.append(columnsKeepID[2]+'/'+columnsKeepID[0]+'/'+columnsKeepID[1])
columnsKeep.append('F'+columnsKeepID[2]+'/F'+columnsKeepID[1]+'/F'+columnsKeepID[0]) columnsKeep.append(columnsKeepID[2]+'/'+columnsKeepID[1]+'/'+columnsKeepID[0])
else: else:
pass pass
featureCompareData = estimatorFeatureSelection(XDataGen, estimator) featureCompareData = estimatorFeatureSelection(XDataGen, estimator)

Loading…
Cancel
Save