fixed prediction space data space, etc.

master
parent 4987cda12a
commit c1665c58f2
  1. BIN
      __pycache__/run.cpython-37.pyc
  2. 57
      frontend/src/components/DataSpace.vue
  3. 13
      frontend/src/components/FinalResultsLinePlot.vue
  4. 46
      frontend/src/components/Heatmap.vue
  5. 55
      frontend/src/components/Main.vue
  6. 72
      frontend/src/components/PredictionsSpace.vue
  7. 23
      frontend/src/components/Provenance.vue
  8. 64
      frontend/src/components/ScatterPlot.vue
  9. 108
      run.py

Binary file not shown.

@ -17,7 +17,12 @@ export default {
},
methods: {
ScatterPlotDataView () {
var target_names = JSON.parse(this.DataSpace[4])
const XandYCoordinates = JSON.parse(this.DataSpace[7])
const DataSet = JSON.parse(this.DataSpace[14])
const DataSetY = JSON.parse(this.DataSpace[15])
var DataSetParse = JSON.parse(DataSet)
var result = XandYCoordinates.reduce(function(r, a) {
a.forEach(function(s, i) {
@ -32,33 +37,59 @@ export default {
var dataPointInfo = []
for (let i = 0; i < XandYCoordinates.length; i++) {
dataPointInfo[i] = 'Data Point ID: ' + i
dataPointInfo[i] = 'Data Point ID: ' + i + '; Details: ' + JSON.stringify(DataSetParse[i])
}
var colors = ['#a6cee3','#1f78b4','#b2df8a','#33a02c','#fb9a99','#e31a1c','#fdbf6f','#ff7f00','#cab2d6','#6a3d9a']
var traces = []
var countPrev = 0
var count = 0
for (let i = 0; i < target_names.length; i++) {
count = 0
for (let j = 0; j < DataSetY.length; j++) {
if (i == DataSetY[j]) {
count = count + 1
}
}
traces.push({
x: result.Xax.slice(countPrev,count+countPrev),
y: result.Yax.slice(countPrev,count+countPrev),
mode: 'markers',
name: target_names[i],
marker: {
color: colors[i]
},
hovertemplate:
"<b>%{text}</b><br><br>" +
"<extra></extra>",
text: dataPointInfo.slice(countPrev,count+countPrev),
})
countPrev = count + countPrev
}
var width = this.WH[0]*3 // interactive visualization
var height = this.WH[1]*1.5 // interactive visualization
const Data = [{
x: result.Xax,
y: result.Yax,
mode: 'markers',
hovertemplate:
"<b>%{text}</b><br><br>" +
"<extra></extra>",
text: dataPointInfo,
}]
var height = this.WH[1]*2.1 // interactive visualization
const layout = {
title: 'Data Space Projection (tSNE)',
title: 'Data Space Projection (t-SNE)',
xaxis: {
visible: false
},
yaxis: {
visible: false
},
dragmode: 'lasso',
hovermode: "closest",
autosize: true,
width: width,
height: height,
}
Plotly.newPlot('OverviewDataPlotly', Data, layout, {responsive: true})
var config = {scrollZoom: true, displaylogo: false, showLink: false, showSendToCloud: false, modeBarButtonsToRemove: ['toImage', 'toggleSpikelines', 'autoScale2d', 'hoverClosestGl2d','hoverCompareCartesian','select2d','hoverClosestCartesian','zoomIn2d','zoomOut2d','zoom2d'], responsive: true}
Plotly.newPlot('OverviewDataPlotly', traces, layout, config)
}
},
mounted() {

@ -46,7 +46,6 @@ export default {
this.xaxis.push(this.NumberofExecutions)
// Under Exploration = Current
console.log(this.FinalResultsforLinePlot)
this.scoresMean.push((JSON.parse(this.FinalResultsforLinePlot[0])*100).toFixed(1))
this.scoresSTD.push((JSON.parse(this.FinalResultsforLinePlot[1])*100).toFixed(1))
@ -106,7 +105,9 @@ export default {
text: text,
line: {color: "rgb(127,201,127)"},
mode: "lines+markers",
name: "Current Accuracy",
marker : {
symbol: 'pentagon' },
name: "Current Accuracy",
type: "scatter"
}
@ -182,7 +183,7 @@ export default {
line: {color: "rgb(190,174,212)"},
mode: "lines+markers",
marker : {
symbol: 'square' },
symbol: 'circle' },
name: "Stack Accuracy",
type: "scatter"
}
@ -207,7 +208,7 @@ export default {
line: {color: "rgb(56,108,176)"},
mode: "lines+markers",
marker : {
symbol: 'star-triangle-up' },
symbol: 'square' },
name: "Stack Precision",
type: "scatter"
}
@ -230,9 +231,9 @@ export default {
y: this.Stack_scoresMean3,
text: text,
line: {color: "rgb(240,2,127)"},
mode: "lines+markers",
mode: "lines+markers",
marker : {
symbol: 'pentagon' },
symbol: 'star-triangle-up' },
name: "Stack Recall",
type: "scatter"
}

@ -21,7 +21,8 @@ export default {
limitation: 0,
flag: false,
classesNumber: 10,
cellSize: 20
cellSize: 20,
ModelsIDHeatStack: []
}
},
methods: {
@ -30,16 +31,15 @@ export default {
},
Heatmap () {
// Clear Heatmap first
var svg = d3.select("#Heatmap");
svg.selectAll("*").remove();
// Clear Heatmap first
var svg = d3.select("#Heatmap");
svg.selectAll("*").remove();
var FeaturesAccuracy = JSON.parse(this.GetResultsAll[5])
var Features= JSON.parse(this.GetResultsAll[6])
var keepingArrayIndices = this.indicestoRem
var PermImpEli = JSON.parse(this.GetResultsAll[10])
var featureUni = JSON.parse(this.GetResultsAll[11])
var modelIds = JSON.parse(this.GetResultsAll[13])
var FeaturesAccuracy = JSON.parse(this.GetResultsAll[5])
var Features = JSON.parse(this.GetResultsAll[6])
var PermImpEli = JSON.parse(this.GetResultsAll[10])
var featureUni = JSON.parse(this.GetResultsAll[11])
var modelIds = JSON.parse(this.GetResultsAll[13])
var len2 = modelIds.length
@ -59,6 +59,30 @@ export default {
indicesXAxis[i] = temp
}
if (this.ModelsIDHeatStack.length != 0) {
var FeaturesAccuracyNew = []
var PermImpEliNew = []
indicesXAxis = new Array(len)
for (let i = 0; i < modelIds.length; i++) {
if (this.ModelsIDHeatStack.includes(modelIds[i])) {
} else {
FeaturesAccuracyNew.push(FeaturesAccuracy[i])
PermImpEliNew.push(PermImpEli[i])
}
}
FeaturesAccuracy = FeaturesAccuracyNew
PermImpEli = PermImpEliNew
len2 = this.ModelsIDHeatStack.length
for (let i = 0; i < len2; i++) {
temp = []
temp.push("R")
temp.push("Model "+this.ModelsIDHeatStack[i].toString())
indicesXAxis[i] = temp
}
}
temp = []
temp.push("R")
temp.push("Average")
@ -525,6 +549,8 @@ export default {
}
},
mounted () {
EventBus.$on('NewHeatmapAccordingtoNewStack', data => { this.ModelsIDHeatStack = data })
EventBus.$on('NewHeatmapAccordingtoNewStack', this.Heatmap)
EventBus.$on('emittedEventCallingToggles', data => { this.Toggles = data })
EventBus.$on('emittedEventCallingHeatmapView', data => { this.GetResultsAll = data; this.flag = false })
EventBus.$on('emittedEventCallingHeatmapView', this.Heatmap)

@ -186,7 +186,7 @@ export default Vue.extend({
PerformancePerModel: '',
PerformanceCheck: '',
firstTimeFlag: 1,
selectedAlgorithms_Stack: [],
selectedModels_Stack: [],
selectedAlgorithms: [],
parametersofModels: [],
reset: false,
@ -252,8 +252,9 @@ export default Vue.extend({
console.log('Server successfully sent all the data related to visualizations!')
EventBus.$emit('emittedEventCallingScatterPlot', this.OverviewResults)
if (this.firstTimeFlag == 1) {
this.selectedAlgorithms_Stack = this.selectedAlgorithms
EventBus.$emit('InitializeProvenance', this.selectedAlgorithms_Stack)
this.selectedModels_Stack.push(0)
this.selectedModels_Stack.push(JSON.stringify(this.modelsUpdate))
EventBus.$emit('InitializeProvenance', this.selectedModels_Stack)
}
this.firstTimeFlag = 0
EventBus.$emit('InitializeMetricsBarChart', this.OverviewResults)
@ -332,6 +333,53 @@ export default Vue.extend({
})
}
},
RemoveFromStackModels () {
const path = `http://127.0.0.1:5000/data/ServerRemoveFromStack`
const postData = {
ClassifiersList: this.ClassifierIDsList
}
const axiosConfig = {
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'Origin, Content-Type, X-Auth-Token',
'Access-Control-Allow-Methods': 'GET, PUT, POST, DELETE, OPTIONS'
}
}
axios.post(path, postData, axiosConfig)
.then(response => {
console.log('Sent the selected points to the server (scatterplot)!')
EventBus.$emit('GrayOutPoints', this.ClassifierIDsList)
this.updatePredictionsSpace()
this.getFinalResults()
})
.catch(error => {
console.log(error)
})
},
updatePredictionsSpace () {
const path = `http://localhost:5000/data/UpdatePredictionsSpace`
const axiosConfig = {
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'Origin, Content-Type, X-Auth-Token',
'Access-Control-Allow-Methods': 'GET, PUT, POST, DELETE, OPTIONS'
}
}
axios.get(path, axiosConfig)
.then(response => {
this.UpdatePredictions = response.data.UpdatePredictions
console.log('Updating Predictions Space!')
EventBus.$emit('updatePredictionsSpace', this.UpdatePredictions)
EventBus.$emit('InitializeProvenance', this.UpdatePredictions)
})
.catch(error => {
console.log(error)
})
},
SendSelectedDataPointsToServer () {
const path = `http://127.0.0.1:5000/data/ServerRequestDataPoint`
@ -691,6 +739,7 @@ export default Vue.extend({
EventBus.$on('sendPointsNumber', data => {this.OverSelLength = data})
EventBus.$on('sendPointsNumber', data => {this.OverAllLength = data})
EventBus.$on('AllSelModels', data => {this.valueSel = data})
EventBus.$on('RemoveFromStack', this.RemoveFromStackModels)
//Prevent double click to search for a word.
document.addEventListener('mousedown', function (event) {
if (event.detail > 1) {

@ -11,12 +11,17 @@ export default {
data () {
return {
PredictionsData: '',
UpdatedData: '',
WH: []
}
},
methods: {
ScatterPlotDataView () {
var target_names = JSON.parse(this.PredictionsData[4])
const XandYCoordinates = JSON.parse(this.PredictionsData[8])
const DataSet = JSON.parse(this.PredictionsData[14])
const DataSetY = JSON.parse(this.PredictionsData[15])
var DataSetParse = JSON.parse(DataSet)
var result = XandYCoordinates.reduce(function(r, a) {
a.forEach(function(s, i) {
@ -31,22 +36,43 @@ export default {
var dataPointInfo = []
for (let i = 0; i < XandYCoordinates.length; i++) {
dataPointInfo[i] = 'Data Point ID: ' + i
dataPointInfo[i] = 'Data Point ID: ' + i + '; Details: ' + JSON.stringify(DataSetParse[i])
}
var colors = ['#a6cee3','#1f78b4','#b2df8a','#33a02c','#fb9a99','#e31a1c','#fdbf6f','#ff7f00','#cab2d6','#6a3d9a']
var traces = []
var countPrev = 0
var count = 0
for (let i = 0; i < target_names.length; i++) {
count = 0
for (let j = 0; j < DataSetY.length; j++) {
if (i == DataSetY[j]) {
count = count + 1
}
}
traces.push({
x: result.Xax.slice(countPrev,count+countPrev),
y: result.Yax.slice(countPrev,count+countPrev),
mode: 'markers',
name: target_names[i],
marker: {
color: colors[i]
},
hovertemplate:
"<b>%{text}</b><br><br>" +
"<extra></extra>",
text: dataPointInfo.slice(countPrev,count+countPrev),
})
countPrev = count + countPrev
}
var width = this.WH[0]*3 // interactive visualization
var height = this.WH[1]*1.48 // interactive visualization
const Data = [{
x: result.Xax,
y: result.Yax,
mode: 'markers',
hovertemplate:
"<b>%{text}</b><br><br>" +
"<extra></extra>",
text: dataPointInfo,
}]
const layout = {
title: 'Predictions Space Projection (tSNE)',
title: 'Predictions Space Projection (t-SNE)',
xaxis: {
visible: false
},
@ -62,9 +88,29 @@ export default {
var config = {scrollZoom: true, displaylogo: false, showLink: false, showSendToCloud: false, modeBarButtonsToRemove: ['toImage', 'toggleSpikelines', 'autoScale2d', 'hoverClosestGl2d','hoverCompareCartesian','select2d','hoverClosestCartesian','zoomIn2d','zoomOut2d','zoom2d'], responsive: true}
Plotly.newPlot('OverviewPredPlotly', Data, layout, config)
Plotly.newPlot('OverviewPredPlotly', traces, layout, config)
this.selectedPointsOverview()
},
UpdateScatterPlot () {
const XandYCoordinates = JSON.parse(this.UpdatedData[0])
Plotly.animate('OverviewPredPlotly', {
data: [
{x: XandYCoordinates[0], y: XandYCoordinates[1]}
],
traces: [0],
layout: {}
}, {
transition: {
duration: 1000,
easing: 'cubic-in-out'
},
frame: {
duration: 1000
}
})
this.selectedPointsOverview()
},
selectedPointsOverview () {
const OverviewPlotly = document.getElementById('OverviewPredPlotly')
OverviewPlotly.on('plotly_selected', function (evt) {
@ -88,6 +134,8 @@ export default {
},
},
mounted() {
EventBus.$on('updatePredictionsSpace', data => { this.UpdatedData = data })
EventBus.$on('updatePredictionsSpace', this.UpdateScatterPlot)
EventBus.$on('emittedEventCallingPredictionsSpacePlotView', data => {
this.PredictionsData = data})
EventBus.$on('emittedEventCallingPredictionsSpacePlotView', this.ScatterPlotDataView)

@ -26,7 +26,8 @@ export default {
data: [],
counter: 0,
typeCounter: [],
typeColumnCounter: []
typeColumnCounter: [],
KNNModels: 576, //KNN models
}
},
@ -38,12 +39,12 @@ export default {
var flagKNN = 0
var flagRF = 0
var StackInfo = JSON.parse(this.stackInformation[1])
// Create a WebGL 2D platform on the canvas:
var platform = Stardust.platform("webgl-2d", canvas, width, height);
for (let i = 0; i < this.stackInformation.length; i++) {
if (this.stackInformation[i] == 'KNN'){
for (let i = 0; i < StackInfo.length; i++) {
if (StackInfo[i] < this.KNNModels){
this.data.push({
type:0, column:this.counter, height:height
})
@ -62,10 +63,12 @@ export default {
this.typeCounter.push(0)
}
this.typeColumnCounter.push(0)
this.data.forEach(d => {
d.typeIndex = this.typeCounter[d.type]++;
d.typeColumnIndex = this.typeColumnCounter[d.column]++;
if (d.column == this.counter) {
d.typeIndex = this.typeCounter[d.type]++;
d.typeColumnIndex = this.typeColumnCounter[d.column]++;
}
});
// Convert the SVG file to Stardust mark spec.
@ -80,7 +83,7 @@ export default {
let pScale = Stardust.scale.custom(`
Vector2(
20 + column * 160 + typeColumnIndex % 5 * 8,
20 + column * 100 + typeColumnIndex % 5 * 8,
height - 10 - floor(typeColumnIndex / 5) * 10
)
`);
@ -110,7 +113,7 @@ export default {
isotypes.data(this.data);
isotypes.render();
this.counter = this.counter + 1
}
},
mounted () {

@ -40,7 +40,8 @@ export default {
parametersAll: [],
length: 0,
valueStackRemove: 'Remove from Stack',
DataPointsSelUpdate: []
DataPointsSelUpdate: [],
ModelsIDGray: []
}
},
methods: {
@ -50,36 +51,10 @@ export default {
EventBus.$emit('RepresentationSelection', this.representationSelection)
},
RemoveStack () {
EventBus.$emit('PCPCallDB')
EventBus.$emit('RemoveFromStack')
},
ScatterPlotView () {
function isEquivalent(a, b) {
// Create arrays of property names
var aProps = Object.getOwnPropertyNames(a);
var bProps = Object.getOwnPropertyNames(b);
// If number of properties is different,
// objects are not equivalent
if (aProps.length != bProps.length) {
return false;
}
for (var i = 0; i < aProps.length; i++) {
var propName = aProps[i];
// If values of same property are not equal,
// objects are not equivalent
if (a[propName] !== b[propName]) {
return false;
}
}
// If we made it this far, objects
// are considered equivalent
return true;
}
Plotly.purge('OverviewPlotly')
var colorsforScatterPlot = JSON.parse(this.ScatterPlotResults[0])
var MDSData = JSON.parse(this.ScatterPlotResults[1])
@ -106,6 +81,37 @@ export default {
classifiersInfoProcessing[i] = 'Model ID: ' + modelId[i] + '; Details: ' + JSON.stringify(parameters[i])
}
var listofNumbersModelsIDs = []
var StackModelsIDs = []
if (this.ModelsIDGray.length != 0) {
for (let j = 0; j < this.ModelsIDGray.length; j++){
listofNumbersModelsIDs.push(parseInt(this.ModelsIDGray[j].replace(/\D/g, "")))
}
var parametersNew = []
var MDSDataNewX = []
var MDSDataNewY = []
var colorsforScatterPlotNew = []
for (let i = 0; i < modelId.length; i++) {
if (listofNumbersModelsIDs.includes(modelId[i])) {
} else {
StackModelsIDs.push(modelId[i])
parametersNew.push(parameters[i])
colorsforScatterPlotNew.push(colorsforScatterPlot[i])
MDSDataNewX.push(MDSData[0][i])
MDSDataNewY.push(MDSData[1][i])
}
}
EventBus.$emit('sendPointsNumber', StackModelsIDs.length)
var classifiersInfoProcessing = []
for (let i = 0; i < StackModelsIDs.length; i++) {
classifiersInfoProcessing[i] = 'Model ID: ' + StackModelsIDs[i] + '; Details: ' + JSON.stringify(parametersNew[i])
}
MDSData[0] = MDSDataNewX
MDSData[1] = MDSDataNewY
colorsforScatterPlot = colorsforScatterPlotNew
EventBus.$emit('NewHeatmapAccordingtoNewStack', StackModelsIDs)
}
var DataGeneral
var layout
if (this.representationDef == 'mds') {
@ -249,6 +255,8 @@ export default {
}
},
mounted() {
EventBus.$on('GrayOutPoints', data => { this.ModelsIDGray = data })
EventBus.$on('GrayOutPoints', this.ScatterPlotView)
EventBus.$on('emittedEventCallingBrushedBoxPlot', data => {
this.brushedBox = data})
EventBus.$on('emittedEventCallingScatterPlot', data => {

108
run.py

@ -575,6 +575,54 @@ def PreprocessingPred():
predictions.append(el)
return predictions
def PreprocessingPredUpdate(Models):
Models = json.loads(Models)
ModelsList= []
for loop in Models['ClassifiersList']:
temp = [int(s) for s in re.findall(r'\b\d+\b', loop)]
ModelsList.append(temp[0])
dicKNN = json.loads(allParametersPerformancePerModel[7])
dicRF = json.loads(allParametersPerformancePerModel[15])
dfKNN = pd.DataFrame.from_dict(dicKNN)
dfKNN.index = dfKNN.index.astype(int)
dfKNNFiltered = dfKNN.loc[KNNModels, :]
dfRF = pd.DataFrame.from_dict(dicRF)
dfRF.index = dfRF.index.astype(int) + 576
dfRFFiltered = dfRF.loc[RFModels, :]
df_concatProbs = pd.concat([dfKNNFiltered, dfRFFiltered])
listProbs = df_concatProbs.index.values.tolist()
deletedElements = 0
for index, element in enumerate(listProbs):
if element in ModelsList:
index = index - deletedElements
df_concatProbs = df_concatProbs.drop(df_concatProbs.index[index])
deletedElements = deletedElements + 1
df_concatProbsCleared = df_concatProbs
listIDsRemaining = df_concatProbsCleared.index.values.tolist()
predictionsAll = PreprocessingPred()
PredictionSpaceAll = FunTsne(predictionsAll)
predictionsSel = []
for column, content in df_concatProbsCleared.items():
el = [sum(x)/len(x) for x in zip(*content)]
predictionsSel.append(el)
PredictionSpaceSel = FunTsne(predictionsSel)
#ModelSpaceMDSNewComb = [list(a) for a in zip(PredictionSpaceAll[0], ModelSpaceMDS[1])]
#ModelSpaceMDSNewSel = FunMDS(df_concatMetrics)
#ModelSpaceMDSNewSelComb = [list(a) for a in zip(ModelSpaceMDSNewSel[0], ModelSpaceMDSNewSel[1])]
mtx2PredFinal = []
mtx1Pred, mtx2Pred, disparity2 = procrustes(PredictionSpaceAll, PredictionSpaceSel)
a1, b1 = zip(*mtx2Pred)
mtx2PredFinal.append(a1)
mtx2PredFinal.append(b1)
return [mtx2PredFinal,listIDsRemaining]
def PreprocessingParam():
dicKNN = json.loads(allParametersPerformancePerModel[1])
dicRF = json.loads(allParametersPerformancePerModel[9])
@ -733,6 +781,7 @@ def ReturnResults(ModelSpaceMDS,ModelSpaceTSNE,DataSpaceList,PredictionSpaceList
FeatureAccuracy = FeatureAccuracy.to_json(orient='records')
perm_imp_eli5PDCon = perm_imp_eli5PDCon.to_json(orient='records')
featureScoresCon = featureScoresCon.to_json(orient='records')
XDataJSONEntireSet = XData.to_json(orient='records')
XDataJSON = XData.columns.tolist()
Results.append(json.dumps(sumPerClassifier)) # Position: 0
@ -749,6 +798,8 @@ def ReturnResults(ModelSpaceMDS,ModelSpaceTSNE,DataSpaceList,PredictionSpaceList
Results.append(featureScoresCon) # Position: 11
Results.append(json.dumps(ModelSpaceTSNE)) # Position: 12
Results.append(json.dumps(ModelsIDs)) # Position: 13
Results.append(json.dumps(XDataJSONEntireSet)) # Position: 14
Results.append(json.dumps(yData)) # Position: 15
return Results
@ -764,12 +815,40 @@ def SendToPlot():
}
return jsonify(response)
# Retrieve data from client
@cross_origin(origin='localhost',headers=['Content-Type','Authorization'])
@app.route('/data/ServerRemoveFromStack', methods=["GET", "POST"])
def RetrieveSelClassifiersIDandRemoveFromStack():
ClassifierIDsList = request.get_data().decode('utf8').replace("'", '"')
PredictionProbSelUpdate = PreprocessingPredUpdate(ClassifierIDsList)
global resultsUpdatePredictionSpace
resultsUpdatePredictionSpace = []
resultsUpdatePredictionSpace.append(json.dumps(PredictionProbSelUpdate[0])) # Position: 0
resultsUpdatePredictionSpace.append(json.dumps(PredictionProbSelUpdate[1]))
key = 3
EnsembleModel(ClassifierIDsList, key)
return 'Everything Okay'
# Sending the overview classifiers' results to be visualized as a scatterplot
@app.route('/data/UpdatePredictionsSpace', methods=["GET", "POST"])
def SendPredBacktobeUpdated():
response = {
'UpdatePredictions': resultsUpdatePredictionSpace
}
return jsonify(response)
# Retrieve data from client
@cross_origin(origin='localhost',headers=['Content-Type','Authorization'])
@app.route('/data/ServerRequestSelPoin', methods=["GET", "POST"])
def RetrieveSelClassifiersID():
ClassifierIDsList = request.get_data().decode('utf8').replace("'", '"')
ComputeMetricsForSel(ClassifierIDsList)
key = 1
EnsembleModel(ClassifierIDsList, key)
return 'Everything Okay'
@ -909,6 +988,7 @@ def RetrieveSelDataPoints():
ModelSpaceMDSNewComb = [list(a) for a in zip(ModelSpaceMDS[0], ModelSpaceMDS[1])]
ModelSpaceMDSNewSel = FunMDS(df_concatMetrics)
ModelSpaceMDSNewSelComb = [list(a) for a in zip(ModelSpaceMDSNewSel[0], ModelSpaceMDSNewSel[1])]
global mt2xFinal
@ -917,6 +997,7 @@ def RetrieveSelDataPoints():
a, b = zip(*mtx2)
mt2xFinal.append(a)
mt2xFinal.append(b)
return 'Everything Okay'
@ -1029,7 +1110,6 @@ def EnsembleModel(Models, keyRetrieved):
global all_classifiersSelection
all_classifiersSelection = []
sclf = 0
lr = LogisticRegression()
if (keyRetrieved == 0):
@ -1055,6 +1135,9 @@ def EnsembleModel(Models, keyRetrieved):
global sclfStack
sclfStack = 0
global sclf
sclf = 0
sclf = StackingCVClassifier(classifiers=all_classifiers,
use_probas=True,
meta_classifier=lr,
@ -1078,7 +1161,8 @@ def EnsembleModel(Models, keyRetrieved):
meta_classifier=lr,
random_state=RANDOM_SEED,
n_jobs = -1)
else:
elif (keyRetrieved == 2):
# fix this part!
if (len(all_classifiersSelection) == 0):
all_classifiers = []
columnsInit = []
@ -1106,12 +1190,30 @@ def EnsembleModel(Models, keyRetrieved):
print(index)
print(featureSelection['featureSelection'][index+store])
all_classifiers.append(make_pipeline(ColumnSelector(cols=featureSelection['featureSelection'][index+store]), RandomForestClassifier().set_params(**arg)))
sclf = StackingCVClassifier(classifiers=all_classifiers,
use_probas=True,
meta_classifier=lr,
random_state=RANDOM_SEED,
n_jobs = -1)
else:
Models = json.loads(Models)
ModelsAll = preProceModels()
for index, modHere in enumerate(ModelsAll):
flag = 0
for loop in Models['ClassifiersList']:
temp = [int(s) for s in re.findall(r'\b\d+\b', loop)]
if (int(temp[0]) == int(modHere)):
flag = 1
if (flag is 0):
all_classifiersSelection.append(all_classifiers[index])
sclfStack = StackingCVClassifier(classifiers=all_classifiersSelection,
use_probas=True,
meta_classifier=lr,
random_state=RANDOM_SEED,
n_jobs = -1)
#else:
# for index, eachelem in enumerate(algorithmsWithoutDuplicates):
# if (eachelem == 'KNN'):

Loading…
Cancel
Save