parent c6b2705bf3
commit 4fa191957a
  1. BIN
      __pycache__/run.cpython-38.pyc
  2. 2
      frontend/src/components/FeatureSpaceDetail.vue
  3. 20
      frontend/src/components/Heatmap.vue
  4. 1
      frontend/src/components/Main.vue
  5. 22
      frontend/src/components/Results.vue
  6. 63
      run.py

Binary file not shown.

@ -683,7 +683,7 @@ export default {
}
EventBus.$emit('UpdateIDs', IDsGather)
if (selectionCounter == 1) {
EventBus.$emit('storeGeneration')
//EventBus.$emit('storeGeneration')
} else if (selectionCounter == 2) {
EventBus.$emit('UpdateIDs', IDsGather)
EventBus.$emit('CompareTwo', IDsGather)

@ -75,13 +75,17 @@ export default {
var algorithms = []
algorithms.push("Univariate FS")
algorithms.push("Impurity-based FI")
algorithms.push("Permutation FI")
algorithms.push("Accuracy-based FI")
algorithms.push("Ranking-based FS")
algorithms.push("Average")
algorithms.push("# Action #")
var PermImpEli = JSON.parse(this.dataFI[1])
var FeaturesAccuracy = JSON.parse(this.dataFI[2])
var ImpurityFS = JSON.parse(this.dataFI[1])
var PermImpEli = JSON.parse(this.dataFI[2])
var FeaturesAccuracy = JSON.parse(this.dataFI[3])
var RankingFS = JSON.parse(this.dataFI[4])
if (Object.entries(this.generKey).length == 0) {
var Features = JSON.parse(this.featureData[0])
@ -115,12 +119,16 @@ export default {
for (let i = 0; i < len; i++) {
if (algorithms[j] == "Univariate FS") {
values[j] = ((Object.values(featureUni.Score)[i]-minUni)/(maxUni-minUni))
} else if (algorithms[j] == "Impurity-based FI") {
values[j] = ImpurityFS[0][i]
} else if (algorithms[j] == "Permutation FI") {
values[j] = PermImpEli[i][0]
} else if (algorithms[j] == "Accuracy-based FI") {
values[j] = FeaturesAccuracy[i][0]
} else if (algorithms[j] == "Ranking-based FS") {
values[j] = RankingFS[0][i]
} else if (algorithms[j] == "Average") {
values[j] = ((((Object.values(featureUni.Score)[i]-minUni)/(maxUni-minUni)))+(PermImpEli[i][0])+(FeaturesAccuracy[i][0]))/(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 {
if (Object.entries(this.generKey).length == 0) {
values[j] = -2
@ -332,7 +340,7 @@ export default {
return d.idx;
})
.attr("class", "row");
svg.append("text").attr("x", 10).attr("y", -65).text("Technique").style("font-size", "14px").attr("alignment-baseline","top")
svg.append("text").attr("x", 28).attr("y", -80).text("Technique").style("font-size", "14px").attr("alignment-baseline","top")
svg.append("text").attr("transform", "rotate(-90)").attr("x", (-1)*(cellSize*(len/2))).attr("y", -90).style("text-anchor", "middle").style("font-size", "14px").text("Feature"); // -130 before for HeartC
var heatMap = row.selectAll(".cell")
.data(function(d) {
@ -417,7 +425,7 @@ export default {
if (index > -1) {
featuresGen.splice(index, 1);
}
//EventBus.$emit('updateHistoryKey', 4)
EventBus.$emit('updateHistoryKey', 4)
EventBus.$emit('removeFeaturesGen', featuresGen)
return "url(#diagonalHatch)"
} else {
@ -550,7 +558,7 @@ export default {
});
//==================================================
d3.select('#colLabel_3').dispatch('click');
d3.select('#colLabel_5').dispatch('click');
},
changeOrder(newOrder, heatmapId) {
var svg = d3.select(heatmapId);

@ -562,6 +562,7 @@ export default Vue.extend({
axios.post(path, postData, axiosConfig)
.then(response => {
console.log('Store newly generated features!')
this.transformNodesFlag = true
EventBus.$emit('updateHistoryKey', 5)
this.threshold()
if (!this.spaceChange) {

@ -162,9 +162,16 @@ export default {
}
var previously = this.previousState
if (toWhichTrans == 5) {
previously.push("black")
previously.push("black")
previously.push("black")
previously.push("black")
}
var lengthFeatures = this.valuesGlobal.length
var testLoc = this.flag
console.log('Better results found: ', testLoc)
dots.transition()
.duration(duration)
.attr('r', function(d){ return d*2 })
@ -178,6 +185,18 @@ export default {
if (d == state) {
previously[counterSet] = '#B15928'
return previously[counterSet]
} else if (toWhichTrans == 3 || toWhichTrans == 4) {
var found = false
for (let i = 0; i < toWhichPosition.length; i++) {
if (counterSet == (4*toWhichPosition[i] + 0) || counterSet == (4*toWhichPosition[i] + 1) || counterSet == (4*toWhichPosition[i] + 2) || counterSet == (4*toWhichPosition[i] + 3)) {
previously[counterSet] = 'black'
found = true
return previously[counterSet]
}
}
if (!found) {
return previously[counterSet]
}
} else if (counterSet == (4*toWhichPosition + 0) || counterSet == (4*toWhichPosition + 1) || counterSet == (4*toWhichPosition + 2) || counterSet == (4*toWhichPosition + 3)) {
previously[counterSet] = 'black'
return previously[counterSet]
@ -196,7 +215,6 @@ export default {
this.flag = false
this.previousState = previously
var dotLabels = rows.selectAll('.dot-label')
.data(function(d){ return d.values })

@ -24,7 +24,9 @@ from sklearn.metrics import classification_report
from sklearn.feature_selection import mutual_info_classif
from sklearn.feature_selection import SelectKBest
from sklearn.feature_selection import chi2
from sklearn.feature_selection import RFE
from sklearn.feature_selection import RFECV
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression
import eli5
from eli5.sklearn import PermutationImportance
@ -486,6 +488,7 @@ def executeModel(exeCall, flagEx, nodeTransfName):
XDataStored = XData.copy()
else:
XData = XDataStored.copy()
XDataStoredOriginal = XDataStored.copy()
columnsNewGen = keepOriginalFeatures.columns.values.tolist()
# Bayesian Optimization for 150 iterations
if (keyFirstTime):
@ -521,8 +524,6 @@ def executeModel(exeCall, flagEx, nodeTransfName):
storeReplacements.append(replacement)
pos = 0
for repl in storeReplacements:
print(pos)
print(repl)
columnsNewGen[storePositions[pos]] = repl
pos += 1
if (len(splittedCol) == 1):
@ -602,7 +603,53 @@ def estimatorFeatureSelection(Data, clf):
permList = []
PerFeatureAccuracy = []
PerFeatureAccuracyAll = []
ImpurityFS = []
RankingFS = []
rf = RandomForestClassifier(n_estimators = 100,
n_jobs = -1,
random_state = RANDOM_SEED)
rf.fit(Data, yData)
importances = rf.feature_importances_
std = np.std([tree.feature_importances_ for tree in rf.estimators_],
axis=0)
maxList = max(importances)
minList = min(importances)
for f in range(Data.shape[1]):
ImpurityFS.append((importances[f] - minList) / (maxList - minList))
estim = LogisticRegression(n_jobs = -1, random_state=RANDOM_SEED)
selector = RFECV(estimator=estim, n_jobs = -1, step=1, cv=crossValidation)
selector = selector.fit(Data, yData)
RFEImp = selector.ranking_
for f in range(Data.shape[1]):
if (RFEImp[f] == 1):
RankingFS.append(0.95)
elif (RFEImp[f] == 2):
RankingFS.append(0.85)
elif (RFEImp[f] == 3):
RankingFS.append(0.75)
elif (RFEImp[f] == 4):
RankingFS.append(0.65)
elif (RFEImp[f] == 5):
RankingFS.append(0.55)
elif (RFEImp[f] == 6):
RankingFS.append(0.45)
elif (RFEImp[f] == 7):
RankingFS.append(0.35)
elif (RFEImp[f] == 8):
RankingFS.append(0.25)
elif (RFEImp[f] == 9):
RankingFS.append(0.15)
else:
RankingFS.append(0.05)
perm = PermutationImportance(clf, cv = None, refit = True, n_iter = 25).fit(Data, yData)
permList.append(perm.feature_importances_)
n_feats = Data.shape[1]
@ -616,6 +663,12 @@ def estimatorFeatureSelection(Data, clf):
yPredict = clf.predict(Data)
yPredict = np.nan_to_num(yPredict)
RankingFSDF = pd.DataFrame(RankingFS)
RankingFSDF = RankingFSDF.to_json()
ImpurityFSDF = pd.DataFrame(ImpurityFS)
ImpurityFSDF = ImpurityFSDF.to_json()
perm_imp_eli5PD = pd.DataFrame(permList)
perm_imp_eli5PD = perm_imp_eli5PD.to_json()
@ -631,8 +684,10 @@ def estimatorFeatureSelection(Data, clf):
featureScores = featureScores.to_json()
resultsFS.append(featureScores)
resultsFS.append(ImpurityFSDF)
resultsFS.append(perm_imp_eli5PD)
resultsFS.append(PerFeatureAccuracyPandas)
resultsFS.append(PerFeatureAccuracyPandas)
resultsFS.append(RankingFSDF)
return resultsFS

Loading…
Cancel
Save