Compare commits

...

15 Commits

Author SHA1 Message Date
Angelos Chatzimparmpas 41adb35006 Update 'frontend/node_modules/perfect-scrollbar/README.md' 2 years ago
Angelos Chatzimparmpas 8a4533e40d Update 'README.md' 2 years ago
Angelos Chatzimparmpas b6b95d7b40 Update 'insertMongo.py' 2 years ago
Angelos Chatzimparmpas 7d88ed20b7 Update 'README.md' 2 years ago
Angelos Chatzimparmpas e8d4e323f6 Update 'README.md' 2 years ago
Angelos Chatzimparmpas 08c8a55a10 Update 'README.md' 2 years ago
Angelos Chatzimparmpas f2ee9d345a Update 'README.md' 3 years ago
Angelos Chatzimparmpas e069030893 fix the frontend 3 years ago
Angelos Chatzimparmpas a4a843e63d Delete '__pycache__/run.cpython-38.pyc' 3 years ago
Angelos Chatzimparmpas 263721f38d Delete '.vscode/settings.json' 3 years ago
Angelos Chatzimparmpas 7880a56b46 Update '.gitignore' 3 years ago
Angelos Chatzimparmpas 3d4cfd24e2 Updating list of requirements 3 years ago
Angelos Chatzimparmpas 77299c502c Updating list of requirements 3 years ago
Angelos Chatzimparmpas 7d33372640 Blending Implementation 3 years ago
Angelos Chatzimparmpas f25ea1a37e responsive 4 years ago
  1. 24
      .gitignore
  2. 4
      .vscode/settings.json
  3. 27
      README.md
  4. BIN
      __pycache__/run.cpython-38.pyc
  5. 372
      frontend/node_modules/perfect-scrollbar/README.md
  6. 1
      frontend/src/components/AlgorithmHyperParam.vue
  7. 8
      frontend/src/components/Algorithms.vue
  8. 31
      frontend/src/components/BalancePredictions.vue
  9. 3
      frontend/src/components/BarChart.vue
  10. 17
      frontend/src/components/DataSetExecController.vue
  11. 24
      frontend/src/components/DataSpace.vue
  12. 49
      frontend/src/components/FinalResultsLinePlot.vue
  13. 33
      frontend/src/components/Heatmap.vue
  14. 107
      frontend/src/components/Main.vue
  15. 34
      frontend/src/components/Mode.vue
  16. 19
      frontend/src/components/PCPData.vue
  17. 14
      frontend/src/components/Parameters.vue
  18. 177
      frontend/src/components/PerMetricBarChart.vue
  19. 19
      frontend/src/components/PredictionsSpace.vue
  20. 6
      frontend/src/components/Provenance.vue
  21. 20
      frontend/src/components/ScatterPlot.vue
  22. 29
      frontend/src/components/SlidersController.vue
  23. 18
      frontend/src/components/ToggleSelection.vue
  24. 4
      insertMongo.py
  25. 9
      requirements.txt
  26. 171
      run.py

24
.gitignore vendored

@ -1,13 +1,13 @@
.DS_Store
/dist/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*~
**/.DS_Store
paper/template.aux
paper/template.fdb_latexmk
paper/template.fls
paper/template.log
paper/template.out
paper/template.pdf
template.bbl
template.blg
cachedir
__pycache__

@ -1,4 +0,0 @@
{
"git.ignoreLimitWarning": true,
"python.pythonPath": "/usr/local/bin/python3"
}

@ -1,9 +1,8 @@
# StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/715aec02557a47cdb42562ebb6c4d5fe)](https://www.codacy.com/gh/angeloschatzimparmpas/StackGenVis/dashboard?utm_source=github.com&utm_medium=referral&utm_content=angeloschatzimparmpas/StackGenVis&utm_campaign=Badge_Grade)
This Git repository contains the code that accompanies the research paper "StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics". The details of the experiments and the research outcome are described in [the paper](https://doi.org/10.1109/TVCG.2020.3030352).
**Note:** StackGenVis is optimized to work better for standard resolutions (such as 1440p/QHD (Quad High Definition)). Any other resolution might need manual adjustment of your browser's zoom level to work properly.
**Note:** StackGenVis is optimized to work better for standard resolutions (such as 1440p/QHD (Quad High Definition) and 1080p). For lower resolutions, our recommendation is to use the collapsible functionality of the top dark gray panels. Finally, any other resolution might need manual adjustment of your browser's zoom level to work properly.
**Note:** The tag `paper-version` matches the implementation at the time of the paper's publication. The current version might look significantly different depending on how much time has passed since then.
@ -17,22 +16,28 @@ Most of them are available online from the [UCI Machine Learning Repository](htt
For the backend:
- [Python 3](https://www.python.org/downloads/)
- [Flask](https://palletsprojects.com/p/flask/)
- Other packages: `pymongo`, `numpy`, `scipy`, `scikit-learn`, `sk-dist`, `eli5`, and `pandas`.
- [MongoDB](https://www.mongodb.com/try/download/community) (Version: 4.x)
- Other packages: `pymongo`, `Flask-PyMongo`, `flask_cors`, `mlxtend`, `imblearn`, `joblib`, `numpy`, `scikit-learn`, `scikit-learn-extra`, `sk-dist`, `eli5`, `umap-learn`, and `pandas`.
You can install all the backend requirements with the following command:
You can install all the backend requirements for Python with the following command:
```
pip install -r requirements.txt
```
For the frontend:
- [Node.js](https://nodejs.org/en/)
- [D3.js](https://d3js.org/)
- [Plotly.js](https://github.com/plotly/plotly.js/)
- [Node.js](https://nodejs.org/en/) (including Webpack; to install it, `npm install webpack-dev-server@3.10.3`)
There is no need to install anything for the frontend, since all modules are in the repository.
There is no need to install anything further for the frontend (e.g., D3 and Plotly.js), since all modules are in the repository.
For the reproducibility of the first use case, the red wine quality data set should be inserted to MongoDB by using the commands below:
```
# recommendation: use insertMongo script to add a data set in Mongo database
# for Python3
python3 insertMongo.py
```
# Usage #
Below is an example of how you can get StackGenVis running using Python for both frontend and backend. The frontend is written in JavaScript/HTML, so it could be hosted in any other web server of your preference. The only hard requirement (currently) is that both frontend and backend must be running on the same machine.
Below is an example of how you can get StackGenVis running using Python and Node.js for the backend and frontend, respectively. The frontend is written in JavaScript/HTML with the help of Vue.js framework, so it could be hosted in any other web server of your preference. The only hard requirement (currently) is that both frontend and backend must be running on the same machine.
```
# first terminal: hosting the visualization side (client)
# with Node.js
@ -43,10 +48,6 @@ npm run dev
```
# second terminal: hosting the computational side (server)
FLASK_APP=run.py flask run
# (optional) recommendation: use insertMongo script to add a data set in Mongo database
# for Python3
python3 insertMongo.py
```
Then, open your browser and point it to `localhost:8080`. We recommend using an up-to-date version of Google Chrome.

Binary file not shown.

@ -1,6 +1,6 @@
<p align="center">
<a href="https://mdbootstrap.com/docs/jquery/getting-started/download/?utm_source=GitHub&utm_medium=PerfectScrollbar">
<img src="https://mdbootstrap.com/img/Marketing/general/logo/medium/mdb-r.png">
<a href="https://perfectscrollbar.com/?utm_source=GitHub&utm_medium=PerfectScrollbar">
<img src="https://perfectscrollbar.com/logo2.png" width="300" height="200">
</a>
</p>
@ -13,15 +13,14 @@
<a href="https://npmcharts.com/compare/perfect-scrollbar?minimal=true"><img src="https://img.shields.io/npm/dm/perfect-scrollbar.svg" alt="Downloads"></a>
<a href="https://github.com/mdbootstrap/bootstrap-material-design/blob/master/License.pdf"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License"></a>
<a href="https://badge.fury.io/js/perfect-scrollbar"><img src="https://badge.fury.io/js/perfect-scrollbar.svg" alt="npm"></a>
<a href="https://twitter.com/intent/tweet/?text=Thanks+@mdbootstrap+for+maintaining+amazing+and+free+Perfect+Scrollbar+Plugin%20https://mdbootstrap.com/freebies/perfect-scrollbar/&hashtags=javascript,code,webdesign,github"><img src="https://img.shields.io/twitter/url/http/shields.io.svg?style=social"></a>
<a href="https://twitter.com/intent/tweet/?text=Thanks+@mdbootstrap+for+maintaining+amazing+and+free+Perfect+Scrollbar+Plugin%20https://perfectscrollbar.com/&hashtags=javascript,code,webdesign,bootstrap"><img src="https://img.shields.io/twitter/url/http/shields.io.svg?style=social&label=Let%20us%20know%20you%20were%20here%21&"></a>
<a href="https://www.youtube.com/watch?v=c9B4TPnak1A"><img alt="YouTube Video Views" src="https://img.shields.io/youtube/views/c9B4TPnak1A?label=Bootstrap%205%20Tutorial%20Views&style=social"></a>
</p>
## [Official documentation](https://mdbootstrap.com/freebies/perfect-scrollbar/?utm_source=GitHub&utm_medium=PerfectScrollbar)
***The official documentation can be found [here](https://mdbootstrap.com/freebies/perfect-scrollbar/?utm_source=GitHub&utm_medium=PerfectScrollbar).***
***To read documentation for versions < 1.0, please visit [`v0.8.1`](https://github.com/mdbootstrap/perfect-scrollbar/tree/0.8.1).***
________
## Why perfect-scrollbar?
perfect-scrollbar is minimalistic but *perfect* (for us, and maybe for most
@ -37,341 +36,20 @@ We hope you will love it!
## Live preview
Check out the [Live Preview](https://mdbootstrap.com/snippets/jquery/filipkapusta/765760/?utm_source=GitHub&utm_medium=PerfectScrollbar) snippet. You can fork it right away for testing and experimenting purposes.
## More useful plugins
***You'll find some example plugins below, you can explore all of them [here](https://mdbootstrap.com/plugins/jquery/?utm_source=GitHub&utm_medium=PerfectScrollbar)***
[Datatable Plugin](https://mdbootstrap.com/docs/jquery/tables/datatables/?utm_source=GitHub&utm_medium=PerfectScrollbar)| [Treeview Plugin](https://mdbootstrap.com/plugins/jquery/treeview/?utm_source=GitHub&utm_medium=PerfectScrollbar)| [Filter Plugin](https://mdbootstrap.com/plugins/jquery/filter/?utm_source=GitHub&utm_medium=PerfectScrollbar)
------------ | ------------- | -------------
<a href="https://mdbootstrap.com/docs/jquery/tables/datatables/?utm_source=GitHub&utm_medium=PerfectScrollbar"><img src="https://mdbootstrap.com/img/Marketing/products/jquery/plugins/datatable.jpg" alt="Filter Plugin"></a> | <a href="https://mdbootstrap.com/plugins/jquery/treeview/?utm_source=GitHub&utm_medium=PerfectScrollbar"><img src="https://mdbootstrap.com/img/Marketing/products/jquery/plugins/treeview.jpg" alt="Filter Plugin"></a> | <a href="https://mdbootstrap.com/plugins/jquery/filter/?utm_source=GitHub&utm_medium=PerfectScrollbar"><img src="https://mdbootstrap.com/img/Marketing/products/jquery/plugins/filter.jpg" alt="Filter Plugin"></a>
_________
## Table of Contents
* [Install](#install)
* [Before using perfect-scrollbar](#before-using-perfect-scrollbar)
* [Caveats](#caveats)
* [How to use](#how-to-use)
* [Options](#options)
* [Events](#events)
* [Helpdesk](#helpdesk)
* [IE Support](#ie-support)
* [License](#license)
* [Related resources](#related-resources)
* [Social media](#social-media)
## Install
#### Download now
You can manually download perfect-scrollbar [here](https://mdbootstrap.com/freebies/perfect-scrollbar/?utm_source=GitHub&utm_medium=PerfectScrollbar).
#### npm
You can install and use perfect-scrollbar with npm. It's registered
as [perfect-scrollbar](https://www.npmjs.com/package/perfect-scrollbar).
```
$ npm install perfect-scrollbar
```
#### From sources
If you want to use the development version of the plugin, build from source
manually. The development version may be unstable.
```
$ git clone https://github.com/mdbootstrap/perfect-scrollbar.git
$ cd perfect-scrollbar
$ npm install
$ npm run build
```
#### Unofficial sources
Sources not mentioned above are not maintained officially. If there are issues
of the following sources, please ask and resolve in each repository.
## Before using perfect-scrollbar
The following requirements should meet.
* the container must have a `position` style.
* the container must be a normal container element.
The following requirements are included in the basic CSS, but please keep in
mind when you'd like to change the CSS files.
* the container must have an `overflow: hidden` css style.
* the scrollbar's position must be `absolute`.
* the scrollbar-x must have `bottom` or `top`, and the scrollbar-y must have
`right` or `left`.
Finally, scroll hooking is generally considered as a bad practice, and
perfect-scrollbar should be used carefully. Unless custom scroll is really
needed, using browser-native scroll is always recommended.
## Caveats
perfect-scrollbar emulates some scrolls, but not all of the kinds. It also *does not* work
in some situations. You can find these cases in [Caveats](https://github.com/mdbootstrap/perfect-scrollbar/wiki/Caveats).
Basically, items listed in the caveats are hacky to implement and may not be
implemented in the future. If the features are really needed, please consider
using browser-native scroll.
## How to use
First of all, please check if the container element meets the requirements and
the main CSS is imported.
```html
<style>
#container {
position: relative;
width: 600px;
height: 400px;
}
</style>
<link rel="stylesheet" href="css/perfect-scrollbar.css">
```
Import via ES modules:
```js
import PerfectScrollbar from 'perfect-scrollbar';
```
Or in browser:
```html
<script src="dist/perfect-scrollbar.js"></script>
```
To initialise:
```js
const container = document.querySelector('#container');
const ps = new PerfectScrollbar(container);
// or just with selector string
const ps = new PerfectScrollbar('#container');
```
It can be initialised with [options](#options).
```js
const ps = new PerfectScrollbar('#container', {
wheelSpeed: 2,
wheelPropagation: true,
minScrollbarLength: 20
});
```
If the size of your container or content changes, call `update`.
```js
ps.update();
```
If you want to destroy the scrollbar, use `destroy`.
```js
ps.destroy();
ps = null; // to make sure garbages are collected
```
If you want to scroll to somewhere, just update `scrollTop`.
```js
const container = document.querySelector('#container');
container.scrollTop = 0;
```
You can also get information about how to use the plugin from code in [`examples/`](examples).
## Options
### `handlers {String[]}`
It is a list of handlers to scroll the element.
**Default**: `['click-rail', 'drag-thumb', 'keyboard', 'wheel', 'touch']`
### `wheelSpeed {Number}`
The scroll speed applied to mousewheel event.
**Default**: `1`
### `wheelPropagation {Boolean}`
If this option is true, when the scroll reaches the end of the side, mousewheel
event will be propagated to parent element.
**Default**: `false`
### `swipeEasing {Boolean}`
If this option is true, swipe scrolling will be eased.
**Default**: `true`
### `minScrollbarLength {Number?}`
When set to an integer value, the thumb part of the scrollbar will not shrink
below that number of pixels.
Check out the [Live Preview](https://mdbootstrap.com/snippets/standard/marveluck/3498209?utm_source=GitHub&utm_medium=PerfectScrollbar) snippet. You can fork it right away for testing and experimenting purposes.
**Default**: `null`
### `maxScrollbarLength {Number?}`
When set to an integer value, the thumb part of the scrollbar will not expand
over that number of pixels.
**Default**: `null`
### `scrollingThreshold {Number}`
This sets threshold for `ps--scrolling-x` and `ps--scrolling-y` classes to
remain. In the default CSS, they make scrollbars shown regardless of hover
state. The unit is millisecond.
**Default**: `1000`
### `useBothWheelAxes {Boolean}`
When set to true, and only one (vertical or horizontal) scrollbar is visible
then both vertical and horizontal scrolling will affect the scrollbar.
**Default**: `false`
### `suppressScrollX {Boolean}`
When set to true, the scrollbar in X-axis will not be available, regardless of
the content width.
**Default**: `false`
### `suppressScrollY {Boolean}`
When set to true, the scroll bar in Y-axis will not be available, regardless of
the content height.
**Default**: `false`
### `scrollXMarginOffset {Number}`
The number of pixels the content width can surpass the container width without
enabling the X-axis scroll bar. Allows some "wiggle room" or "offset break", so
that X-axis scroll bar is not enabled just because of a few pixels.
**Default**: `0`
### `scrollYMarginOffset {Number}`
The number of pixels the content height can surpass the container height without
enabling the Y-axis scroll bar. Allows some "wiggle room" or "offset break", so
that Y-axis scroll bar is not enabled just because of a few pixels.
**Default**: `0`
## Events
perfect-scrollbar dispatches custom events.
```js
container.addEventListener('ps-scroll-x', () => ...);
```
### `ps-scroll-y`
This event fires when the y-axis is scrolled in either direction.
### `ps-scroll-x`
This event fires when the x-axis is scrolled in either direction.
### `ps-scroll-up`
This event fires when scrolling upwards.
### `ps-scroll-down`
This event fires when scrolling downwards.
### `ps-scroll-left`
This event fires when scrolling to the left.
### `ps-scroll-right`
This event fires when scrolling to the right.
### `ps-y-reach-start`
This event fires when scrolling reaches the start of the y-axis.
### `ps-y-reach-end`
This event fires when scrolling reaches the end of the y-axis (useful for
infinite scroll).
### `ps-x-reach-start`
This event fires when scrolling reaches the start of the x-axis.
### `ps-x-reach-end`
This event fires when scrolling reaches the end of the x-axis.
You can also watch the reach state via the `reach` property.
```js
const ps = new PerfectScrollbar(...);
console.log(ps.reach.x); // => 'start' or 'end' or null
console.log(ps.reach.y); // => 'start' or 'end' or null
```
## Helpdesk
If you have any idea to improve this project or any problem using this, please
feel free to upload an [issue](https://github.com/mdbootstrap/perfect-scrollbar/issues).
For common problems, there is a [FAQ](https://github.com/mdbootstrap/perfect-scrollbar/wiki/FAQ) wiki
page. Please check the page before uploading an issue.
Also, the project is not actively maintained. No maintainer is paid, and most of
us are busy on our professional or personal works. Please understand that it may
take a while for an issue to be resolved. Uploading a PR would be the fastest
way to fix an issue.
## IE Support
The plugin is developed to work in modern MS browsers including Edge and IE11,
but may have some issues in IE11 mainly because of IE rendering bug concerning
sync update on scroll properties. The problem is mentioned in
[Caveats](https://github.com/mdbootstrap/perfect-scrollbar/wiki/Caveats) too.
IE<11 is not supported, and patches to fix problems in IE<=10 will not be
accepted. When old IEs should be supported, please fork the project and make
modification locally.
## License
[MIT](LICENSE)
## Related resources
- [Material Scrollbar](https://mdbootstrap.com/docs/jquery/javascript/scroll/?utm_source=GitHub&utm_medium=PerfectScrollbar)
- [Table scroll](https://mdbootstrap.com/docs/jquery/tables/scroll/?utm_source=GitHub&utm_medium=PerfectScrollbar)
- [Scroll Back To Top](https://mdbootstrap.com/docs/standard/extended/back-to-top/?utm_source=GitHub&utm_medium=PerfectScrollbar)
- [Full screen scroller](https://mdbootstrap.com/plugins/jquery/screen-scroller/?utm_source=GitHub&utm_medium=PerfectScrollbar)
- [Scrollspy](https://mdbootstrap.com/docs/standard/navigation/scrollspy/?utm_source=GitHub&utm_medium=PerfectScrollbar)
- [Scrollspy](https://mdbootstrap.com/docs/jquery/navigation/scrollspy/?utm_source=GitHub&utm_medium=PerfectScrollbar)
- [Scrollbar](https://mdbootstrap.com/docs/standard/methods/scrollbar/)
- [Scroll Status](https://mdbootstrap.com/docs/standard/plugins/scroll-status/?utm_source=GitHub&utm_medium=PerfectScrollbar)
## Social Media
@ -387,6 +65,28 @@ modification locally.
- [YouTube](https://www.youtube.com/channel/UC5CF7mLQZhvx8O5GODZAhdA)
## MDB PRO
## Get Free Material Design for Bootstrap 5
<table>
<tbody>
<tr>
<td>
<a href="https://mdbootstrap.com/docs/standard/" alt="Bootstrap 5" rel="dofollow">
<img src="https://mdbcdn.b-cdn.net/wp-content/themes/mdbootstrap4/content/en/_mdb5/standard/pro/_main/assets/mdb5-about-v2.jpg">
</a>
</td>
<td>
<ul style="list-style-type:none;">
<li>Material Design 2.0 + latest Bootstrap 5 based on plain JavaScript. 700+ material UI components, super simple, 1 minute installation, free templates & much more</li>
</ul>
</td>
</tr>
</tbody>
</table>
## Free Tutorials
Huge collection of free and high-quality tutorials. Learn Bootstrap, Angular, React, Vue, WordPress and many more. Create your own websites and apps.
- [Material Design for Bootstrap PRO](https://mdbootstrap.com/products/jquery-ui-kit/?utm_source=GitHub&utm_medium=PerfectScrollbar)
[Check it out](https://www.youtube.com/c/Mdbootstrap)

@ -44,6 +44,7 @@ export default {
d3.selectAll("#PCP > *").remove();
},
PCPView () {
d3.selectAll("#PCP > *").remove();
if (this.selAlgorithm != '') {
var colors = ['#a6cee3','#1f78b4','#b2df8a','#33a02c','#fb9a99','#e31a1c','#fdbf6f','#ff7f00','#cab2d6','#6a3d9a','#b15928']

@ -1,6 +1,6 @@
<template>
<div>
<div id="exploding_boxplot" class="exploding_boxplot" style="min-height: 450px;"></div>
<div id="exploding_boxplot" class="exploding_boxplot" style="min-height: 337px;"></div>
</div>
</template>
@ -342,7 +342,7 @@ export default {
// label : displayed text in toolbox
this.chart = exploding_boxplot(data, {y:'# Performance (%) #',group:'Algorithm',color:'Algorithm',label:'Model'})
this.chart.width(this.WH[0]*10.225) // interactive visualization
this.chart.height(this.WH[1]*0.95) // interactive visualization
this.chart.height(this.WH[1]*0.72) // interactive visualization
//call chart on a div
this.chart('#exploding_boxplot')
@ -1073,7 +1073,7 @@ export default {
$(el)[8].dispatchEvent(new Event('click'))
} else if (this.selectedAlgorithm == 'AdaB') {
$(el)[9].dispatchEvent(new Event('click'))
} else {
} else if (this.selectedAlgorithm == 'GradB') {
$(el)[10].dispatchEvent(new Event('click'))
}
}
@ -1093,8 +1093,8 @@ export default {
this.WH = data})
EventBus.$on('ResponsiveandChange', data => {
this.WH = data})
EventBus.$on('ResponsiveandChange', this.boxplot)
EventBus.$on('ResponsiveandChange', this.previousBoxPlotState)
EventBus.$on('ResponsiveandChange', this.brushed)
EventBus.$on('emittedEventCallingSelectedALgorithm', data => {
this.selectedAlgorithm = data})
EventBus.$on('brusheAllOn', this.brushActivationAll)

@ -18,7 +18,8 @@
return {
resultsfromOverview: '',
newResultsFromSelection: '',
responsiveWidthHeight: []
responsiveWidthHeight: [],
smallScreenMode: '0px',
}
},
methods: {
@ -31,9 +32,17 @@
var svg = d3.select("#my_dataviz");
svg.selectAll("*").remove();
// responsive visualizations
var widthInitial = this.responsiveWidthHeight[0]*6.5
var heightInitial = this.responsiveWidthHeight[1]*0.5
if (this.smallScreenMode != "370px") {
var widthInitial = this.responsiveWidthHeight[0]*6.5
var heightInitial = this.responsiveWidthHeight[1]*0.5
var heightforText = 215
var widthforText = 215
} else {
var widthInitial = this.responsiveWidthHeight[0]*6.8
var heightInitial = this.responsiveWidthHeight[1]*0.395
var heightforText = 202
var widthforText = 20
}
var performancePerModel = JSON.parse(this.resultsfromOverview[0])
var performancePerModelSelection = []
@ -186,12 +195,11 @@
// Handmade legend
var heightforText = 215
svg.append("circle").attr("cx", 215).attr("cy", heightforText-1.5).attr("r", 6).style("fill", "#000")
svg.append("circle").attr("cx", 785).attr("cy", heightforText-1.5).attr("r", 6).style("fill", "#D3D3D3")
svg.append("text").attr("x", 230).attr("y", heightforText).text("All Points").style("font-size", "16px").attr("alignment-baseline","middle")
svg.append("text").attr("x", 515).attr("y", heightforText-6).text("# Performance (%) #").style("font-size", "16px").attr("alignment-baseline","top")
svg.append("text").attr("x", 800).attr("y", heightforText).text("Selected Points").style("font-size", "16px").attr("alignment-baseline","middle")
svg.append("circle").attr("cx", widthforText).attr("cy", heightforText-1.5).attr("r", 6).style("fill", "#000")
svg.append("circle").attr("cx", widthforText+570).attr("cy", heightforText-1.5).attr("r", 6).style("fill", "#D3D3D3")
svg.append("text").attr("x", widthforText+15).attr("y", heightforText).text("All Points").style("font-size", "16px").attr("alignment-baseline","middle")
svg.append("text").attr("x", widthforText+275).attr("y", heightforText-6).text("# Performance (%) #").style("font-size", "16px").attr("alignment-baseline","top")
svg.append("text").attr("x", widthforText+585).attr("y", heightforText).text("Selected Points").style("font-size", "16px").attr("alignment-baseline","middle")
svg.append("text").attr("transform", "rotate(-90)").attr("x", -89).attr("y", -45).style("text-anchor", "middle").style("font-size", "16px").text("Number of Models");
// Function to compute density
@ -216,8 +224,7 @@
EventBus.$on('UpdateBalanceView', this.Balance)
EventBus.$on('Responsive', data => {
this.responsiveWidthHeight = data})
EventBus.$on('ResponsiveandChange', data => {
this.responsiveWidthHeight = data})
EventBus.$on('ResponsiveandAdapt', data => { this.smallScreenMode = data })
// reset view
EventBus.$on('resetViews', this.reset)

@ -409,7 +409,7 @@ export default {
autosize: true,
barmode: 'group',
width: this.WH[0]*10.205,
height: this.WH[1]*0.6,
height: this.WH[1]*0.61,
xaxis: {
title: 'Algorithm',
type:"category",
@ -585,6 +585,7 @@ export default {
EventBus.$on('Responsive', data => {
this.WH = data})
EventBus.$on('ResponsiveandChange', data => {
this.WH = data})

@ -3,9 +3,14 @@
<label id="data" for="param-dataset" data-toggle="tooltip" data-placement="right" title="Tip: use one of the data sets already provided or upload a new file.">{{ dataset }}</label>
<select id="selectFile" @change="selectDataSet()">
<option value="HeartC.csv" selected>Heart Disease</option>
<!--<option value="StanceC.csv">Stance in Texts</option>-->
<option value="IrisC.csv">Iris</option>
<option value="local">Upload New File</option>
<option value="IrisC.csv">Iris Flower</option>
<!--<option value="BreastC.csv">Breast Cancer</option>
<option value="DiabetesC.csv">India Diabetes</option>
<option value="VehicleC.csv">Vehicle Silhouettes</option>
<option value="ContraceptiveC.csv">Contraceptive Method</option>
<option value="WineC.csv">Red Wine</option>
<option value="StanceC.csv">Stance in Texts</option>-->
<option value="local">Upload File</option>
</select>
<button class="btn-outline-primary"
@ -39,7 +44,7 @@ export default {
RetrieveValueCSV: 'DiabetesC', // default value for the first data set
value: 'Confirm',
valueReset: 'Reset',
dataset: 'Data set'
dataset: 'Data: '
}
},
methods: {
@ -48,8 +53,8 @@ export default {
this.RetrieveValueCSV = fileName.options[fileName.selectedIndex].value
this.RetrieveValueCSV = this.RetrieveValueCSV.split('.')[0]
if (this.RetrieveValueCSV == "DiabetesC" || this.RetrieveValueCSV == "HeartC" || this.RetrieveValueCSV == "IrisC" || this.RetrieveValueCSV == "StanceC") { // This is a function that handles a new file, which users can upload.
this.dataset = "Data set"
if (this.RetrieveValueCSV == "VehicleC" || this.RetrieveValueCSV == "DiabetesC" || this.RetrieveValueCSV == "HeartC" || this.RetrieveValueCSV == "IrisC" || this.RetrieveValueCSV == "StanceC" || this.RetrieveValueCSV == "ContraceptiveC" || this.RetrieveValueCSV == "BreastC" || this.RetrieveValueCSV == "WineC" || this.RetrieveValueCSV == "BiodegC") { // This is a function that handles a new file, which users can upload.
this.dataset = "Data"
d3.select("#data").select("input").remove(); // Remove the selection field.
EventBus.$emit('SendToServerDataSetConfirmation', this.RetrieveValueCSV)
} else {

@ -30,7 +30,7 @@
<font-awesome-icon icon="eraser" />
{{ removeData }}
</button>
&nbsp;&nbsp;
&nbsp;&nbsp;<br>
History Manager: <button
id="saveID"
v-on:click="save">
@ -76,6 +76,7 @@ export default {
colorsValues: ['#808000','#008080','#bebada','#fccde5','#d9d9d9','#bc80bd','#ccebc5'],
onlyOnce: true,
restylePoints: [],
smallScreenMode: '0px'
}
},
methods: {
@ -128,10 +129,15 @@ export default {
},
scatterPlotDataView () {
Plotly.purge('OverviewDataPlotly')
// responsive visualization
let width = this.responsiveWidthHeight[0]*6.5
let height = this.responsiveWidthHeight[1]*1.1
if (this.smallScreenMode != "370px") {
// responsive visualization
var width = this.responsiveWidthHeight[0]*6.5
var height = this.responsiveWidthHeight[1]*0.85
} else {
var width = this.responsiveWidthHeight[0]*6.5
var height = this.responsiveWidthHeight[1]*0.83
}
var target_names = JSON.parse(this.dataPoints[0])
const XandYCoordinatesMDS = JSON.parse(this.dataPoints[1])
@ -296,12 +302,9 @@ export default {
for (let i = 0; i < result.Xax.length; i++) {
IDs.push(i)
if (this.restylePoints.length != 0) {
console.log('test1')
if (XandYCoordinatesMDS[0].length == this.restylePoints.length) {
console.log('test2')
colorUpdate.push('rgb(0, 0, 0)')
} else {
console.log('test3')
if (this.restylePoints.includes(i)) {
colorUpdate.push('rgb(175, 68, 39)')
} else {
@ -309,7 +312,6 @@ export default {
}
}
} else {
console.log('test')
colorUpdate.push('rgb(0, 0, 0)')
}
}
@ -516,8 +518,8 @@ export default {
// make the view responsive to window changes
EventBus.$on('Responsive', data => {
this.responsiveWidthHeight = data})
EventBus.$on('ResponsiveandChange', data => {
this.responsiveWidthHeight = data})
EventBus.$on('ResponsiveandAdapt', data => { this.smallScreenMode = data })
EventBus.$on('RepresentationSelectionData', data => {this.representationDef = data})
EventBus.$on('RepresentationSelectionData', this.scatterPlotDataView)

@ -1,5 +1,5 @@
<template>
<div id="LinePlot" style="min-height: 363px;"></div>
<div id="LinePlot" style="min-height: 365px;"></div>
</template>
<script>
@ -46,7 +46,8 @@ export default {
Stack_scoresNegative4: [],
xaxis: [],
WH: [],
firstTime: 0
firstTime: 0,
smallScreenMode: '0px',
}
},
methods: {
@ -128,7 +129,7 @@ export default {
mode: "lines+markers",
marker : {
symbol: 'circle' },
name: "Active Accuracy",
name: "Active Acc.",
type: "scatter"
}
@ -140,7 +141,7 @@ export default {
fill: "tozerox",
fillcolor: "rgba(55,126,184,0)",
line: {color: "transparent"},
name: "Active Accuracy",
name: "Active Acc.",
showlegend: false,
type: "scatter"
}
@ -157,7 +158,7 @@ export default {
mode: "lines+markers",
marker : {
symbol: 'square' },
name: "Active Precision",
name: "Active Pre.",
type: "scatter"
}
@ -169,7 +170,7 @@ export default {
fill: "tozerox",
fillcolor: "rgba(55,126,184,0)",
line: {color: "transparent"},
name: "Active Precision",
name: "Active Pre.",
showlegend: false,
type: "scatter"
}
@ -184,7 +185,7 @@ export default {
mode: "lines+markers",
marker : {
symbol: 'triangle-up' },
name: "Active Recall",
name: "Active Rec.",
type: "scatter"
}
@ -196,7 +197,7 @@ export default {
fill: "tozerox",
fillcolor: "rgba(55,126,184,0)",
line: {color: "transparent"},
name: "Active Recall",
name: "Active Rec.",
showlegend: false,
type: "scatter"
}
@ -211,7 +212,7 @@ export default {
mode: "lines+markers",
marker : {
symbol: 'diamond' },
name: "Active F1 Score",
name: "Active F1",
type: "scatter"
}
@ -223,7 +224,7 @@ export default {
fill: "tozerox",
fillcolor: "rgba(55,126,184,0)",
line: {color: "transparent"},
name: "Active F1 Score",
name: "Active F1",
showlegend: false,
type: "scatter"
}
@ -240,7 +241,7 @@ export default {
mode: "lines+markers",
marker : {
symbol: 'x' },
name: "Stack Accuracy",
name: "Stack Acc.",
type: "scatter"
}
@ -252,7 +253,7 @@ export default {
fill: "tozerox",
fillcolor: "rgba(228,26,28,0)",
line: {color: "transparent"},
name: "Stack Accuracy",
name: "Stack Acc.",
showlegend: false,
type: "scatter"
}
@ -267,7 +268,7 @@ export default {
mode: "lines+markers",
marker : {
symbol: 'cross' },
name: "Stack Precision",
name: "Stack Pre.",
type: "scatter"
}
@ -279,7 +280,7 @@ export default {
fill: "tozerox",
fillcolor: "rgba(228,26,28,0)",
line: {color: "transparent"},
name: "Stack Precision",
name: "Stack Pre.",
showlegend: false,
type: "scatter"
}
@ -294,7 +295,7 @@ export default {
mode: "lines+markers",
marker : {
symbol: 'triangle-down' },
name: "Stack Recall",
name: "Stack Rec.",
type: "scatter"
}
@ -306,7 +307,7 @@ export default {
fill: "tozerox",
fillcolor: "rgba(228,26,28,0)",
line: {color: "transparent"},
name: "Stack Recall",
name: "Stack Rec.",
showlegend: false,
type: "scatter"
}
@ -321,7 +322,7 @@ export default {
mode: "lines+markers",
marker : {
symbol: 'hexagram' },
name: "Stack F1 Score",
name: "Stack F1",
type: "scatter"
}
@ -333,15 +334,19 @@ export default {
fill: "tozerox",
fillcolor: "rgba(228,26,28,0)",
line: {color: "transparent"},
name: "Stack F1 Score",
name: "Stack F1",
showlegend: false,
type: "scatter"
}
const DataforLinePlot = [trace1, trace2, trace3, trace4, trace5, trace6, trace7, trace8, trace9, trace10, trace11, trace12, trace13, trace14, trace15, trace16]
var width = this.WH[0]*3.18 // interactive visualization
var height = this.WH[1]*0.765 // interactive visualization
if (this.smallScreenMode != "370px") {
var width = 583.0000000000001
} else {
var width = 400
}
var height = 353.685
var layout = {
font: { family: 'Helvetica', size: 14, color: '#000000' },
@ -398,8 +403,8 @@ export default {
EventBus.$on('Responsive', data => {
this.WH = data})
EventBus.$on('ResponsiveandChange', data => {
this.WH = data})
EventBus.$on('ResponsiveandAdapt', data => { this.smallScreenMode = data })
// reset the views
EventBus.$on('resetViews', this.reset)

@ -36,6 +36,7 @@ export default {
keyLocal: 0,
activeModels: 0,
flagLocal: false,
smallScreenMode: '0px'
}
},
methods: {
@ -228,9 +229,20 @@ export default {
})
//==================================================
var viewerWidth = this.responsiveWidthHeight[0]*6.5
var viewerHeight = this.responsiveWidthHeight[1]*1.415
var viewerPosTop = viewerHeight * 0.1;
if (this.smallScreenMode != "370px") {
var viewerWidth = this.responsiveWidthHeight[0]*6.5
var viewerHeight = this.responsiveWidthHeight[1]*1.25
var widthHeatmap = viewerWidth/2
} else {
var viewerWidth = this.responsiveWidthHeight[0]*6.5
var viewerHeight = this.responsiveWidthHeight[1]*1.14
var widthHeatmap = 600
}
var viewerPosTop = viewerHeight * 0.05;
var viewerPosTopHeat = viewerHeight * 0.15;
var viewerPosLeft = viewerWidth*0.1;
var legendElementWidth = cellSize * 3;
@ -256,7 +268,7 @@ export default {
.call(zoom)
//.call(zoom.transform, d3.zoomIdentity.translate(200, 20).scale(0.25)) //initial size
.append('svg:g')
.attr("transform", "translate(" + viewerPosLeft + "," + viewerPosTop + ")");
.attr("transform", "translate(" + viewerPosLeft + "," + viewerPosTopHeat + ")");
svg.append('defs')
.append('pattern')
@ -351,7 +363,7 @@ export default {
})
.attr("class", "row");
svg.append("text").attr("x", 220).attr("y", -50).text("Models").style("font-size", "16px").attr("alignment-baseline","top")
svg.append("text").attr("transform", "rotate(-90)").attr("x", -130).attr("y", -45).style("text-anchor", "middle").style("font-size", "16px").text("Data Features"); // -130 before for HeartC
svg.append("text").attr("transform", "rotate(-90)").attr("x", -45).attr("y", -45).style("text-anchor", "middle").style("font-size", "16px").text("Data Features"); // -130 before for HeartC
var heatMap = row.selectAll(".cell")
.data(function(d) {
return d;
@ -445,7 +457,7 @@ export default {
svgLeg.selectAll("*").remove();
var svgLeg = d3.select("#LegendHeat").append("svg")
.attr("width", viewerWidth/2)
.attr("width", widthHeatmap)
.attr("height", viewerHeight*0.13)
var legend = svgLeg.append('g')
@ -478,7 +490,7 @@ export default {
})
.attr("y", viewerPosTop + cellSize);
svgLeg.append("text").attr("x", 220).attr("y", 50).text("Importance (Normalized)").style("font-size", "16px").attr("alignment-baseline","top")
svgLeg.append("text").attr("x", 220).attr("y", 15).text("Importance (Normalized)").style("font-size", "16px").attr("alignment-baseline","top")
//==================================================
// Change ordering of cells
@ -651,13 +663,12 @@ export default {
EventBus.$on('SendSelectedPointsToBrushHeatmap', data => { this.highlighted = data; })
EventBus.$on('SendSelectedPointsToBrushHeatmap', this.brush)
EventBus.$on('Responsive', data => {
this.responsiveWidthHeight = data})
EventBus.$on('ResponsiveandChange', data => {
this.responsiveWidthHeight = data})
EventBus.$on('Responsive', data => {
this.responsiveWidthHeight = data})
// reset the views
EventBus.$on('resetViews', this.reset)
EventBus.$on('ResponsiveandAdapt', data => { this.smallScreenMode = data })
}
}
</script>

@ -4,10 +4,10 @@
<body>
<b-container fluid class="bv-example-row">
<b-row class="md-3">
<b-col cols="3" >
<b-col cols="3">
<mdb-card>
<mdb-card-header color="primary-color" tag="h5" class="text-center" style="background-color: #C0C0C0;">Data Sets and Performance Metrics Manager</mdb-card-header>
<mdb-card-body>
<mdb-card-header color="primary-color" tag="h5" class="text-center collapsible" style="background-color: #C0C0C0;">Data Sets and Perform. Metrics Manager</mdb-card-header>
<mdb-card-body class="content">
<mdb-card-text class="text-left" style="font-size: 18.5px;">
<DataSetExecController/>
<SlidersController/>
@ -17,16 +17,16 @@
</b-col>
<b-col cols="6">
<mdb-card>
<mdb-card-header color="primary-color" tag="h5" class="text-center" style="background-color: #C0C0C0;">History of the Stacking Ensemble<small class="float-right"><knowledge/></small></mdb-card-header>
<mdb-card-body>
<mdb-card-header color="primary-color" tag="h5" class="text-center collapsible" style="background-color: #C0C0C0;">{{ historyVar }}<small class="float-left"><mode/></small><small class="float-right"><knowledge/></small></mdb-card-header>
<mdb-card-body class="content">
<Provenance/>
</mdb-card-body>
</mdb-card>
</b-col>
<b-col cols="3">
<mdb-card>
<mdb-card-header color="primary-color" tag="h5" class="text-center" style="background-color: #C0C0C0;"><small class="float-left" style="padding-top: 3px;"><font-awesome-icon class="fa-lg" icon="dice-four"/>&nbsp;Metrics Support: [M1, M3-M5 (W)]</small>Metamodel's Performance</mdb-card-header>
<mdb-card-body>
<mdb-card-header color="primary-color" tag="h5" class="text-center collapsible" style="background-color: #C0C0C0;"><small class="float-left" style="padding-top: 3px;"><font-awesome-icon class="fa-lg" icon="dice-four"/>&nbsp;[M1, M3-M5 (W)]</small>Metamodel's Perform.</mdb-card-header>
<mdb-card-body class="content">
<FinalResultsLinePlot/>
</mdb-card-body>
</mdb-card>
@ -67,7 +67,7 @@
<b-row class="md-3">
<b-col cols="3">
<mdb-card style="margin-top: 15px">
<mdb-card-header color="primary-color" tag="h5" class="text-center"><small class="float-left" style="padding-top: 3px;">Metrics Support: [All]</small>Parameters Manipulation for Each Algorithm</mdb-card-header>
<mdb-card-header color="primary-color" tag="h5" class="text-center"><small class="float-left" style="padding-top: 3px;">[All]</small>Parameters Manipulation for Each Alg.</mdb-card-header>
<mdb-card-body>
<AlgorithmHyperParam/>
</mdb-card-body>
@ -89,7 +89,7 @@
<mdb-card style="margin-top: 15px;">
<mdb-card-header color="primary-color" tag="h5" class="text-center">Data Space<small class="float-right"><saveStack/></small></mdb-card-header>
<mdb-card-body>
<mdb-card-text class="text-center" style="min-height: 822px">
<mdb-card-text class="text-center" style="min-height: 710px">
<DataSpace/>
<PCPData/>
</mdb-card-text>
@ -100,7 +100,7 @@
<mdb-card style="margin-top: 15px;">
<mdb-card-header color="primary-color" tag="h5" class="text-center">Features Selection for Each Model<small class="float-right"><active/></small></mdb-card-header>
<mdb-card-body>
<mdb-card-text class="text-center" style="min-height: 822px">
<mdb-card-text class="text-center" style="min-height: 711px">
<ToggleSelection/>
<br/>
<Heatmap/>
@ -118,7 +118,7 @@
[Sel: {{OverSelLength}} / All: {{OverAllLength}}]<small class="float-right"><active-scatter/></small>
</mdb-card-header>
<mdb-card-body>
<mdb-card-text class="text-center" style="min-height: 822px">
<mdb-card-text class="text-center" style="min-height: 710px">
<ScatterPlot/>
<PerMetricBarChart/>
</mdb-card-text>
@ -129,7 +129,7 @@
<mdb-card style="margin-top: 15px;">
<mdb-card-header color="primary-color" tag="h5" class="text-center">Predictions' Space</mdb-card-header>
<mdb-card-body>
<mdb-card-text class="text-center" style="min-height: 822px">
<mdb-card-text class="text-center" style="min-height: 711px">
<PredictionsSpace/>
<BalancePredictions/>
</mdb-card-text>
@ -139,12 +139,21 @@
</b-row>
</div>
</div>
<div class="footer" style="margin-top: 0px">
<hr>
<p class="text-muted credit no-top-margin no-bottom-margin">
&copy; ISOVIS group 2020&ndash;2021
</p>
<p class="text-muted credit no-top-margin no-bottom-margin">
Last updated: February 26, 2021
</p>
</div>
</b-container>
<div class="w3-container">
<div id="myModal" class="w3-modal" style="position: fixed;">
<div class="w3-modal-content w3-card-4 w3-animate-zoom">
<header class="w3-container w3-blue">
<h3 style="display:inline-block; font-size: 16px; margin-top: 15px; margin-bottom:15px">Serialized Data and Stacking Ensemble Learning Models using Cryo</h3>
<h3 style="display:inline-block; font-size: 16px; margin-top: 15px; margin-bottom:15px">Serialized Data and Models using Cryo</h3>
</header>
<Export/>
<div class="w3-container w3-light-grey w3-padding">
@ -170,6 +179,7 @@ import AlgorithmHyperParam from './AlgorithmHyperParam.vue'
import Controller from './Controller.vue'
import ResetClass from './ResetClass.vue'
import Knowledge from './Knowledge.vue'
import Mode from './Mode.vue'
import Active from './Active.vue'
import ActiveScatter from './ActiveScatter.vue'
import saveStack from './saveStack.vue'
@ -211,6 +221,7 @@ export default Vue.extend({
Controller,
ResetClass,
Knowledge,
Mode,
Active,
ActiveScatter,
SlidersController,
@ -234,6 +245,8 @@ export default Vue.extend({
},
data () {
return {
defaultModeMain: 'stack',
historyVar: 'History of the Stacking Ensemble',
valuePickled: 'Close',
Collection: 0,
OverviewResults: 0,
@ -972,8 +985,35 @@ export default Vue.extend({
}, delayInMilliseconds);
})
},
statusMode () {
if (this.defaultModeMain == 'stack') {
this.historyVar = 'History of the Stacking Ensemble'
} else {
this.historyVar = 'History of the Blending Ensemble'
}
const path = `http://127.0.0.1:5000/data/EnsembleMode`
const postData = {
defaultModeMain: this.defaultModeMain
}
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('Send active ensemble method!')
})
.catch(error => {
console.log(error)
})
}
},
created () {
// does the browser support the Navigation Timing API?
if (window.performance) {
console.info("window.performance is supported");
@ -986,6 +1026,35 @@ export default Vue.extend({
window.addEventListener('resize', this.change)
},
mounted() {
var coll = document.getElementsByClassName("collapsible");
var i;
var flagLocalMounted = true
var flagLocalSkip = true
EventBus.$on('ChangeOfMode', data =>{ flagLocalSkip = false })
EventBus.$on('OpenModal', data =>{ flagLocalSkip = false })
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
if (flagLocalSkip) {
var content = document.getElementsByClassName("content")
var value = "370px"
for (let j = 0; j < content.length; j++) {
if (content[j].style.display === "block") {
content[j].style.display = "none";
} else {
content[j].style.display = "block";
if (flagLocalMounted) {
content[j].style.display = "none";
}
}
}
flagLocalMounted = false
var combineWH = []
combineWH.push(this.width)
combineWH.push(this.height - 100)
}
flagLocalSkip = true
});
}
this.Alg()
var modal = document.getElementById('myModal')
@ -1065,6 +1134,9 @@ export default Vue.extend({
EventBus.$on('toggleDeep', data => {this.toggleDeepMain = data})
EventBus.$on('ChangeOfMode', data => { this.defaultModeMain = data })
EventBus.$on('ChangeOfMode', this.statusMode)
//Prevent double click to search for a word.
document.addEventListener('mousedown', function (event) {
if (event.detail > 1) {
@ -1118,5 +1190,14 @@ hr {
border-top: 1px solid rgba(0, 0, 0, 0.1);
}
.collapsible {
cursor: pointer;
}
.content {
display: block;
overflow: hidden;
}
@import './../assets/w3.css';
</style>

@ -0,0 +1,34 @@
<template>
<div>
<label id="modeSel" for="param-dataset" data-toggle="tooltip" data-placement="right">{{ valueMode }}</label>
<select id="selectMode" @click="clickMode()" @change="changeMode()">
<option value="stack" selected>Stacking</option>
<option value="blend">Blending</option>
</select>
</div>
</template>
<script>
import { EventBus } from '../main.js'
export default {
name: 'Mode',
data () {
return {
valueMode: 'Method: ',
defaultMode: 'stack'
}
},
methods: {
clickMode () {
EventBus.$emit('ChangeOfMode', this.defaultMode)
},
changeMode () {
var methodRetrieved = document.getElementById('selectMode')
this.defaultMode = methodRetrieved.options[methodRetrieved.selectedIndex].value
EventBus.$emit('ChangeOfMode', this.defaultMode)
}
}
}
</script>

@ -20,6 +20,7 @@ export default {
colorsValues: ['#808000','#008080','#bebada','#fccde5','#d9d9d9','#bc80bd','#ccebc5'],
ClassifierIDsListClearedData: [],
RetrieveDataSet: 'HeartC',
smallScreenMode: '0px'
}
},
methods: {
@ -33,6 +34,14 @@ export default {
const target_names = JSON.parse(this.PCPDataReceived[3])
const target_names_original = JSON.parse(this.PCPDataReceived[4])
if (this.smallScreenMode != "370px") {
var width = 1200
var height = 248
} else {
var width = 800
var height = 251
}
var extraction = []
for (let i = 0; i < DataSetParse.length; i++) {
if (this.RetrieveDataSet == 'IrisC') {
@ -55,8 +64,8 @@ export default {
if (DataSetParse.length == this.ClassifierIDsListClearedData.length || this.ClassifierIDsListClearedData.length == 0) {
var pc = ParCoords()("#PCPDataView")
.data(DataSetParse)
.width(1200)
.height(272)
.width(width)
.height(height)
.hideAxis(["Outcome","ID"])
.color(function(d, i) { return colors[d.Outcome] })
.bundlingStrength(0) // set bundling strength
@ -70,8 +79,8 @@ export default {
else {
var pc = ParCoords()("#PCPDataView")
.data(DataSetParse)
.width(1200)
.height(272)
.width(width)
.height(height)
.hideAxis(["Outcome","ID"])
.color(function(d, i) { return colors[d.Outcome] })
.bundlingStrength(0) // set bundling strength
@ -107,6 +116,8 @@ export default {
EventBus.$on('resetViews', this.reset)
EventBus.$on('SendToServerDataSetConfirmation', data => { this.RetrieveDataSet = data })
EventBus.$on('ResponsiveandAdapt', data => { this.smallScreenMode = data })
}
}
</script>

@ -93,7 +93,7 @@ export default {
legendPosition: {x: 20, y: 20}, // the position of the legend, from the top-left corner of the svg
levels: 3, //How many levels or inner circles should there be drawn
maxValue: 0, //What is the value that the biggest circle will represent
labelFactor: 1.25, //How much farther than the radius of the outer circle should the labels be placed
labelFactor: 1.32, //How much farther than the radius of the outer circle should the labels be placed
wrapWidth: 60, //The number of pixels after which a label needs to be given a new line
opacityArea: 0.35, //The opacity of the area of the blob
dotRadius: 2, //The size of the colored circles of each blog
@ -634,8 +634,8 @@ export default {
//////////////////////////////////////////////////////////////
var margin = {top: 50, right: 120, bottom: 55, left: 65},
legendPosition = {x: 425, y: 25},
width = Math.min(520, window.innerWidth - 10) - margin.left - margin.right,
legendPosition = {x: 320, y: 25},
width = Math.min(406, window.innerWidth - 10) - margin.left - margin.right,
height = Math.min(width + 12, window.innerHeight + 12 - margin.top - margin.bottom);
//////////////////////////////////////////////////////////////
@ -752,8 +752,10 @@ export default {
EventBus.$on('Responsive', data => {
this.WH = data})
EventBus.$on('ResponsiveandChange', data => {
this.WH = data})
EventBus.$on('ResponsiveandAdapt', data => {
document.getElementById('overview').style.height = data
document.getElementById('overview').style.marginTop = "35px"
})
// reset the views
EventBus.$on('resetViews', this.reset)
@ -841,6 +843,6 @@ export default {
}
#overview {
min-height: 450px;
min-height: 336px;
}
</style>

@ -21,6 +21,7 @@ export default {
,0,0,1,0,0
,0,1,1,1
],
smallScreenMode: '0px',
}
},
methods: {
@ -84,90 +85,98 @@ export default {
}
}
}
var width = this.WH[0]*6.5 // interactive visualization
var height = this.WH[1]*0.482 // interactive visualization
var trace1 = {
x: x,
y: perModelAllClear,
name: 'All Points',
type: 'box',
boxmean: true,
marker: {
color: 'rgb(0,0,0)'
if (this.smallScreenMode != "370px") {
var width = this.WH[0]*6.5 // interactive visualization
var height = this.WH[1]*0.482 // interactive visualization
} else {
var width = this.WH[0]*6.8
var height = this.WH[1]*0.38
}
var trace1 = {
x: x,
y: perModelAllClear,
name: 'All Points',
type: 'box',
boxmean: true,
marker: {
color: 'rgb(0,0,0)'
}
};
var trace2 = {
x: x,
y: perModelSelectedClear,
name: 'Selected Points',
type: 'box',
boxmean: true,
marker: {
color: 'rgb(211,211,211)'
}
};
var data = [trace1, trace2];
var layout = {
font: { family: 'Helvetica', size: 14, color: '#000000' },
boxmode: 'group',
autosize: true,
width: width,
height: height,
hovermode: 'x',
margin: {
l: 50,
r: 0,
b: 35,
t: 40,
pad: 0
},
xaxis: {
title: 'Performance Metrics',
titlefont: {
size: 16,
color: 'black'
}},
yaxis: {
title: '# Performance (%) #',
titlefont: {
size: 16,
color: 'black'
}}};
var boxPlot = document.getElementById('PerMetricBar');
var config = {displayModeBar: false, scrollZoom: true, displaylogo: false, showLink: false, showSendToCloud: false, modeBarButtonsToRemove: ['toImage'], responsive: true}
Plotly.newPlot(boxPlot, data, layout, config);
boxPlot.on('plotly_click', (eventData) => {
var xAxisHovered
xAxisHovered = eventData.points[0].x
var index
if (xAxisHovered == 'Accuracy') {
index = 0
}
};
var trace2 = {
x: x,
y: perModelSelectedClear,
name: 'Selected Points',
type: 'box',
boxmean: true,
marker: {
color: 'rgb(211,211,211)'
else if (xAxisHovered == 'G-Mean') {
index = 1
}
};
var data = [trace1, trace2];
var layout = {
font: { family: 'Helvetica', size: 14, color: '#000000' },
boxmode: 'group',
autosize: true,
width: width,
height: height,
hovermode: 'x',
margin: {
l: 50,
r: 0,
b: 35,
t: 40,
pad: 0
},
xaxis: {
title: 'Performance Metrics',
titlefont: {
size: 16,
color: 'black'
}},
yaxis: {
title: '# Performance (%) #',
titlefont: {
size: 16,
color: 'black'
}}};
var boxPlot = document.getElementById('PerMetricBar');
var config = {displayModeBar: false, scrollZoom: true, displaylogo: false, showLink: false, showSendToCloud: false, modeBarButtonsToRemove: ['toImage'], responsive: true}
Plotly.newPlot(boxPlot, data, layout, config);
boxPlot.on('plotly_click', (eventData) => {
var xAxisHovered
xAxisHovered = eventData.points[0].x
var index
if (xAxisHovered == 'Accuracy') {
index = 0
}
else if (xAxisHovered == 'G-Mean') {
index = 1
}
else if (xAxisHovered == 'Precision') {
index = 2
}
else if (xAxisHovered == 'Recall') {
index = 3
}
else if (xAxisHovered == 'F-Beta Score') {
index = 4
}
else if (xAxisHovered == 'MCC') {
index = 5
}
else if (xAxisHovered == 'ROC AUC') {
index = 6
}
else {
index = 7
}
EventBus.$emit('updateBold', xAxisHovered)
EventBus.$emit('updateMetricsScatter', resultsColors[index])
});
else if (xAxisHovered == 'Precision') {
index = 2
}
else if (xAxisHovered == 'Recall') {
index = 3
}
else if (xAxisHovered == 'F-Beta Score') {
index = 4
}
else if (xAxisHovered == 'MCC') {
index = 5
}
else if (xAxisHovered == 'ROC AUC') {
index = 6
}
else {
index = 7
}
EventBus.$emit('updateBold', xAxisHovered)
EventBus.$emit('updateMetricsScatter', resultsColors[index])
});
},
reset () {
Plotly.purge('PerMetricBar')
@ -186,8 +195,8 @@ export default {
EventBus.$on('Responsive', data => {
this.WH = data})
EventBus.$on('ResponsiveandChange', data => {
this.WH = data})
EventBus.$on('ResponsiveandAdapt', data => { this.smallScreenMode = data })
EventBus.$on('UpdateBarChartperMetric', data => {
this.SelBarChartMetrics = data})

@ -30,6 +30,7 @@ export default {
colorsValues: ['#808000','#008080','#bebada','#fccde5','#d9d9d9','#bc80bd','#ccebc5'],
WH: [],
onlyOnce: true,
smallScreenMode: '0px',
}
},
methods: {
@ -53,9 +54,14 @@ export default {
ScatterPlotPredView () {
Plotly.purge('OverviewPredPlotly')
// responsive visualization
var width = this.WH[0]*6.5 // interactive visualization
var height = this.WH[1]*1.185 // interactive visualization
if (this.smallScreenMode != "370px") {
var width = this.WH[0]*6.5 // interactive visualization
var height = this.WH[1]*0.98 // interactive visualization
} else {
var width = this.WH[0]*6.6 // interactive visualization
var height = this.WH[1]*0.95 // interactive visualization
}
var XandYCoordinatesMDS
var target_names = JSON.parse(this.PredictionsData[4])
if (this.UpdatedData.length != 0) {
@ -74,7 +80,6 @@ export default {
stringParameters.push(JSON.stringify(DataSetParse[i]).replace(/,/gi, '<br>'))
}
const XandYCoordinatesTSNE = JSON.parse(this.PredictionsData[18])
console.log(XandYCoordinatesTSNE)
const XandYCoordinatesUMAP= JSON.parse(this.PredictionsData[19])
var result = [];
@ -330,7 +335,6 @@ export default {
OverviewPlotly.on('plotly_selected', function (evt) {
if (typeof evt !== 'undefined') {
const DataPoints = []
console.log(evt)
for (let i = 0; evt.points.length; i++) {
if (evt.points[i] === undefined) {
break
@ -339,7 +343,6 @@ export default {
DataPoints.push(OnlyId[3])
}
}
console.log(DataPoints)
if (DataPoints != '') {
EventBus.$emit('SendSelectedDataPointsToServerEvent', DataPoints)
} else {
@ -358,8 +361,8 @@ export default {
EventBus.$on('emittedEventCallingPredictionsSpacePlotView', this.ScatterPlotPredView)
EventBus.$on('Responsive', data => {
this.WH = data})
EventBus.$on('ResponsiveandChange', data => {
this.WH = data})
EventBus.$on('ResponsiveandAdapt', data => { this.smallScreenMode = data })
EventBus.$on('RepresentationSelectionPred', data => {this.representationDef = data})
EventBus.$on('RepresentationSelectionPred', this.ScatterPlotPredView)

@ -78,8 +78,8 @@ export default {
},
provenance () {
var canvas = document.getElementById("main-canvas");
var width = this.WH[0]*6.52 // interactive visualization
var height = this.WH[1]*0.375 // interactive visualization
var width = 1195.3333333333333
var height = 173.375
var flagKNN = 0
var flagSVC = 0
@ -526,8 +526,6 @@ export default {
EventBus.$on('Responsive', data => {
this.WH = data})
EventBus.$on('ResponsiveandChange', data => {
this.WH = data})
// reset the views
EventBus.$on('resetViews', this.reset)

@ -63,7 +63,8 @@ export default {
keyLocal: 0,
activeModels: 0,
pushModelsRemaining: [],
onlyOnce: true
onlyOnce: true,
smallScreenMode: '0px',
}
},
methods: {
@ -234,7 +235,6 @@ export default {
//this.TSNEStore.push(TSNEData)
this.modelIDStore.push(modelId)
this.UMAPStore.push(UMAPData)
console.log('mpike5')
colorsforScatterPlot = this.colorsStore.slice(this.activeModels,this.activeModels+1)[0]
MDSData = this.MDSStore.slice(this.activeModels,this.activeModels+1)[0]
parameters = this.parametersStore.slice(this.activeModels,this.activeModels+1)[0]
@ -251,8 +251,6 @@ export default {
EventBus.$emit('NewHeatmapAccordingtoNewStack', modelId)
}
console.log(this.colorsStore)
console.log(this.MDSStore)
var DataGeneral
var maxX
@ -260,8 +258,13 @@ export default {
var maxY
var minY
var width = this.WH[0]*6.5 // interactive visualization
var height = this.WH[1]*1.192 // interactive visualization
if (this.smallScreenMode != "370px") {
var width = this.WH[0]*6.6 // interactive visualization
var height = this.WH[1]*0.98 // interactive visualization
} else {
var width = this.WH[0]*7 // interactive visualization
var height = this.WH[1]*0.95 // interactive visualization
}
var layout
if (this.representationDef == 'mds') {
@ -548,10 +551,11 @@ export default {
EventBus.$on('emittedEventCallingScatterPlot', this.ScatterPlotView)
EventBus.$on('getColors', data => {
this.colorsforOver = data})
EventBus.$on('Responsive', data => {
this.WH = data})
EventBus.$on('ResponsiveandChange', data => {
this.WH = data})
EventBus.$on('ResponsiveandAdapt', data => { this.smallScreenMode = data })
EventBus.$on('ParametersAll', data => { this.parametersAll = data })
EventBus.$on('getColors', this.UpdateScatter)
EventBus.$on('RepresentationSelection', data => {this.representationDef = data})

@ -54,14 +54,14 @@
</b-row>
<b-row>
<b-col cols="6">
<p>(*) Average: <select id="selectFilterAverage" @change="selectAppliedFilterAverage()">
<option value="weighted" selected>Weighted (W)</option>
<p>(*) Aver.: <select id="selectFilterAverage" @change="selectAppliedFilterAverage()">
<option value="weighted" selected>Weighted</option>
<option value="micro">Micro</option>
<option value="macro">Macro</option>
</select></p>
</b-col>
<b-col cols="6">
<p>Detailed Feature Search: <input type="checkbox" id="toggleDeepID" data-toggle="toggle" checked="checked" data-on="Enabled" data-off="Disabled" data-size="small"></p>
<p>Feat. Search: <input type="checkbox" id="toggleDeepID" data-toggle="toggle" checked="checked" data-on="Enabled" data-off="Disabled" data-size="small"></p>
</b-col>
</b-row>
</div>
@ -243,6 +243,21 @@
},
},
mounted () {
EventBus.$on('Responsive', data => {
this.WH = data
var myClasses = document.getElementsByClassName('slider slider-horizontal')
for(var i = 0; i < myClasses.length; i++){
if (this.WH[0] > 125) {
myClasses[i].style.width = "260px"; // or
}
else {
myClasses[i].style.width = "60px"; // depending on what you're doing
}
}
})
$('#toggleDeepID').bootstrapToggle({
on: 'On',
off: 'Off',
@ -266,8 +281,12 @@ p {
padding: 0 !important;
}
.slider.slider-horizontal{
width:260px; /* sample value - set it as you like*/
.toggle-on.btn-sm {
padding-right: 20px
}
.toggle-off.btn-sm {
padding-right: 0px
}
.slider-handle {

@ -1,8 +1,8 @@
<template>
<div id="toggles" style="visibility:hidden">
Univariate Feature Selection:&nbsp;<input type="checkbox" id="toggle-uni" data-toggle="toggle" checked="checked" data-on="Enabled" data-off="Disabled" data-size="small">&nbsp;&nbsp;&nbsp;
Permutation Feature Importance:&nbsp;<input type="checkbox" id="toggle-per" data-toggle="toggle" checked="checked" data-on="Enabled" data-off="Disabled" data-size="small">&nbsp;&nbsp;&nbsp;
Accuracy Feature Importance:&nbsp;<input type="checkbox" id="toggle-fi" data-toggle="toggle" checked="checked" data-on="Enabled" data-off="Disabled" data-size="small">
Univariate FS:&nbsp;<input type="checkbox" id="toggle-uni" data-toggle="toggle" checked="checked" data-on="Enabled" data-off="Disabled" data-size="small">&nbsp;&nbsp;&nbsp;
Permutation FI:&nbsp;<input type="checkbox" id="toggle-per" data-toggle="toggle" checked="checked" data-on="Enabled" data-off="Disabled" data-size="small">&nbsp;&nbsp;&nbsp;
Accuracy FI:&nbsp;<input type="checkbox" id="toggle-fi" data-toggle="toggle" checked="checked" data-on="Enabled" data-off="Disabled" data-size="small">
</div>
</template>
@ -40,8 +40,8 @@ export default {
EventBus.$on('resetToggles', this.ResetPosition)
$('#toggle-uni').bootstrapToggle({
on: 'Enabled',
off: 'Disabled',
on: 'On',
off: 'Off',
width: '8%',
});
$('#toggle-uni').change(function() {
@ -55,8 +55,8 @@ export default {
}
})
$('#toggle-per').bootstrapToggle({
on: 'Enabled',
off: 'Disabled',
on: 'On',
off: 'Off',
width: '8%',
});
$('#toggle-per').change(function() {
@ -70,8 +70,8 @@ export default {
}
})
$('#toggle-fi').bootstrapToggle({
on: 'Enabled',
off: 'Disabled',
on: 'On',
off: 'Off',
width: '8%',
});
$('#toggle-fi').change(function() {

@ -16,8 +16,8 @@ def import_content(filepath):
data = pd.read_csv(file_res)
data_json = json.loads(data.to_json(orient='records'))
db_cm.remove()
db_cm.insert(data_json)
db_cm.drop()
db_cm.insert_many(data_json)
if __name__ == "__main__":
filepath = './data/heart.csv'

@ -1,7 +1,12 @@
Flask-PyMongo
flask_cors
scikit-learn
numpy
pandas
joblib
scikit-learn
scikit-learn-extra
sk-dist
mlxtend
umap-learn
eli5
pymongo
imblearn

171
run.py

@ -14,6 +14,7 @@ import copy
from joblib import Memory
from itertools import chain
import ast
import timeit
from sklearn.neighbors import KNeighborsClassifier # 1 neighbors
from sklearn.svm import SVC # 1 svm
@ -51,6 +52,7 @@ from mlxtend.classifier import StackingCVClassifier
from mlxtend.feature_selection import ColumnSelector
from sklearn.model_selection import GridSearchCV
from sklearn.model_selection import ShuffleSplit
from scipy.spatial import procrustes
@ -85,12 +87,12 @@ def Reset():
global previousStateActive
previousStateActive = []
global RANDOM_SEED
RANDOM_SEED = 42
global StanceTest
StanceTest = False
global status
status = True
global factors
factors = [1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,1,1,1]
@ -220,6 +222,9 @@ def RetrieveFileName():
global previousStateActive
previousStateActive = []
global status
status = True
global yData
yData = []
@ -255,9 +260,6 @@ def RetrieveFileName():
global all_classifiers
all_classifiers = []
global crossValidation
crossValidation = 5
global scoring
scoring = {'accuracy': 'accuracy', 'precision_micro': 'precision_micro', 'precision_macro': 'precision_macro', 'precision_weighted': 'precision_weighted', 'recall_micro': 'recall_micro', 'recall_macro': 'recall_macro', 'recall_weighted': 'recall_weighted', 'roc_auc_ovo_weighted': 'roc_auc_ovo_weighted'}
@ -320,7 +322,19 @@ def RetrieveFileName():
CollectionDB = mongo.db.StanceC.find()
CollectionDBTest = mongo.db.StanceCTest.find()
elif data['fileName'] == 'DiabetesC':
CollectionDB = mongo.db.DiabetesC.find()
CollectionDB = mongo.db.diabetesC.find()
elif data['fileName'] == 'BreastC':
CollectionDB = mongo.db.breastC.find()
elif data['fileName'] == 'WineC':
CollectionDB = mongo.db.WineC.find()
elif data['fileName'] == 'ContraceptiveC':
CollectionDB = mongo.db.ContraceptiveC.find()
elif data['fileName'] == 'VehicleC':
CollectionDB = mongo.db.VehicleC.find()
elif data['fileName'] == 'BiodegC':
StanceTest = True
CollectionDB = mongo.db.biodegC.find()
CollectionDBTest = mongo.db.biodegCTest.find()
else:
CollectionDB = mongo.db.IrisC.find()
DataResultsRaw = []
@ -567,6 +581,26 @@ def class_feature_importance(X, Y, feature_importances):
return out
@cross_origin(origin='localhost',headers=['Content-Type','Authorization'])
@app.route('/data/EnsembleMode', methods=["GET", "POST"])
def EnsembleMethod():
global crossValidation
global RANDOM_SEED
global XData
RANDOM_SEED = 42
RetrievedStatus = request.get_data().decode('utf8').replace("'", '"')
RetrievedStatus = json.loads(RetrievedStatus)
modeMethod = RetrievedStatus['defaultModeMain']
if (modeMethod == 'blend'):
crossValidation = ShuffleSplit(n_splits=1, test_size=.20, random_state=RANDOM_SEED)
else:
crossValidation = 5
return 'Okay'
# Initialize every model for each algorithm
@cross_origin(origin='localhost',headers=['Content-Type','Authorization'])
@app.route('/data/ServerRequestSelParameters', methods=["GET", "POST"])
@ -579,7 +613,8 @@ def RetrieveModel():
global algorithms
algorithms = RetrievedModel['Algorithms']
toggle = RetrievedModel['Toggle']
global crossValidation
global XData
global yData
global SVCModelsCount
@ -595,6 +630,8 @@ def RetrieveModel():
# loop through the algorithms
global allParametersPerformancePerModel
start = timeit.default_timer()
print('CVorTT', crossValidation)
for eachAlgor in algorithms:
if (eachAlgor) == 'KNN':
clf = KNeighborsClassifier()
@ -640,8 +677,76 @@ def RetrieveModel():
clf = GradientBoostingClassifier(random_state=RANDOM_SEED)
params = {'n_estimators': list(range(85, 115)), 'learning_rate': list(np.arange(0.01,0.23,0.11)), 'criterion': ['friedman_mse', 'mse', 'mae']}
AlgorithmsIDsEnd = GradBModelsCount
allParametersPerformancePerModel = GridSearchForModels(XData, yData, clf, params, eachAlgor, AlgorithmsIDsEnd, toggle)
allParametersPerformancePerModel = GridSearchForModels(XData, yData, clf, params, eachAlgor, AlgorithmsIDsEnd, toggle, crossValidation)
# New visualization - model space
# header = "model_id,algorithm_id,mean_test_accuracy,mean_test_precision_micro,mean_test_precision_macro,mean_test_precision_weighted,mean_test_recall_micro,mean_test_recall_macro,mean_test_recall_weighted,mean_test_roc_auc_ovo_weighted,geometric_mean_score_micro,geometric_mean_score_macro,geometric_mean_score_weighted,matthews_corrcoef,f5_micro,f5_macro,f5_weighted,f1_micro,f1_macro,f1_weighted,f2_micro,f2_macro,f2_weighted,log_loss\n"
# dataReceived = []
# counter = 0
# for indx, el in enumerate(allParametersPerformancePerModel):
# dictFR = json.loads(el)
# frame = pd.DataFrame.from_dict(dictFR)
# for ind, elInside in frame.iterrows():
# counter = counter + 1
# dataReceived.append(str(counter))
# dataReceived.append(',')
# dataReceived.append(str(indx+1))
# dataReceived.append(',')
# dataReceived.append(str(elInside['mean_test_accuracy']))
# dataReceived.append(',')
# dataReceived.append(str(elInside['mean_test_precision_micro']))
# dataReceived.append(',')
# dataReceived.append(str(elInside['mean_test_precision_macro']))
# dataReceived.append(',')
# dataReceived.append(str(elInside['mean_test_precision_weighted']))
# dataReceived.append(',')
# dataReceived.append(str(elInside['mean_test_recall_micro']))
# dataReceived.append(',')
# dataReceived.append(str(elInside['mean_test_recall_macro']))
# dataReceived.append(',')
# dataReceived.append(str(elInside['mean_test_recall_weighted']))
# dataReceived.append(',')
# dataReceived.append(str(elInside['mean_test_roc_auc_ovo_weighted']))
# dataReceived.append(',')
# dataReceived.append(str(elInside['geometric_mean_score_micro']))
# dataReceived.append(',')
# dataReceived.append(str(elInside['geometric_mean_score_macro']))
# dataReceived.append(',')
# dataReceived.append(str(elInside['geometric_mean_score_weighted']))
# dataReceived.append(',')
# dataReceived.append(str(elInside['matthews_corrcoef']))
# dataReceived.append(',')
# dataReceived.append(str(elInside['f5_micro']))
# dataReceived.append(',')
# dataReceived.append(str(elInside['f5_macro']))
# dataReceived.append(',')
# dataReceived.append(str(elInside['f5_weighted']))
# dataReceived.append(',')
# dataReceived.append(str(elInside['f1_micro']))
# dataReceived.append(',')
# dataReceived.append(str(elInside['f1_macro']))
# dataReceived.append(',')
# dataReceived.append(str(elInside['f1_weighted']))
# dataReceived.append(',')
# dataReceived.append(str(elInside['f2_micro']))
# dataReceived.append(',')
# dataReceived.append(str(elInside['f2_macro']))
# dataReceived.append(',')
# dataReceived.append(str(elInside['f2_weighted']))
# dataReceived.append(',')
# dataReceived.append(str(elInside['log_loss']))
# dataReceived.append("\n")
# dataReceivedItems = ''.join(dataReceived)
# csvString = header + dataReceivedItems
# fw = open ("modelSpace.csv","w+",encoding="utf-8")
# fw.write(csvString)
# fw.close()
# call the function that sends the results to the frontend
stop = timeit.default_timer()
print('Time GridSearch: ', stop - start)
SendEachClassifiersPerformanceToVisualize()
return 'Everything Okay'
@ -651,13 +756,13 @@ memory = Memory(location, verbose=0)
# calculating for all algorithms and models the performance and other results
@memory.cache
def GridSearchForModels(XData, yData, clf, params, eachAlgor, AlgorithmsIDsEnd, toggle):
print('loop here')
def GridSearchForModels(XData, yData, clf, params, eachAlgor, AlgorithmsIDsEnd, toggle, crossVal):
print('loop')
# this is the grid we use to train the models
grid = GridSearchCV(
estimator=clf, param_grid=params,
cv=crossValidation, refit='accuracy', scoring=scoring,
cv=crossVal, refit='accuracy', scoring=scoring,
verbose=0, n_jobs=-1)
# fit and extract the probabilities
@ -742,7 +847,7 @@ def GridSearchForModels(XData, yData, clf, params, eachAlgor, AlgorithmsIDsEnd,
n_feats = XData.shape[1]
PerFeatureAccuracy = []
for i in range(n_feats):
scores = model_selection.cross_val_score(clf, XData.values[:, i].reshape(-1, 1), yData, cv=crossValidation)
scores = model_selection.cross_val_score(clf, XData.values[:, i].reshape(-1, 1), yData, cv=5)
PerFeatureAccuracy.append(scores.mean())
PerFeatureAccuracyAll.append(PerFeatureAccuracy)
else:
@ -2074,7 +2179,7 @@ def RetrieveSelDataPoints():
clf = GradientBoostingClassifier(random_state=RANDOM_SEED)
params = RetrieveParamsClearedListGradB
AlgorithmsIDsEnd = GradBModelsCount
metricsSelList = GridSearchSel(clf, params, factors, AlgorithmsIDsEnd, listofDataPoints)
metricsSelList = GridSearchSel(clf, params, factors, AlgorithmsIDsEnd, listofDataPoints, crossValidation)
if (len(metricsSelList[0]) != 0 and len(metricsSelList[1]) != 0 and len(metricsSelList[2]) != 0 and len(metricsSelList[3]) != 0 and len(metricsSelList[4]) != 0 and len(metricsSelList[5]) != 0 and len(metricsSelList[6]) != 0 and len(metricsSelList[7]) != 0 and len(metricsSelList[8]) != 0 and len(metricsSelList[9]) != 0 and len(metricsSelList[10]) != 0):
dicKNN = json.loads(metricsSelList[0])
@ -2339,7 +2444,7 @@ def RetrieveSelDataPoints():
return 'Everything Okay'
def GridSearchSel(clf, params, factors, AlgorithmsIDsEnd, DataPointsSel):
def GridSearchSel(clf, params, factors, AlgorithmsIDsEnd, DataPointsSel, crossVal):
global XData
global yData
if (len(params) == 0):
@ -2354,7 +2459,7 @@ def GridSearchSel(clf, params, factors, AlgorithmsIDsEnd, DataPointsSel):
# this is the grid we use to train the models
grid = GridSearchCV(
estimator=clf, param_grid=params,
cv=crossValidation, refit='accuracy', scoring=scoring,
cv=crossVal, refit='accuracy', scoring=scoring,
verbose=0, n_jobs=-1)
# fit and extract the probabilities
@ -2948,10 +3053,22 @@ def EnsembleModel(Models, keyRetrieved):
if (keySpec == 0 or keySpec == 1):
num_cores = multiprocessing.cpu_count()
inputsSc = ['accuracy','precision_weighted','recall_weighted','f1_weighted']
flat_results = Parallel(n_jobs=num_cores)(delayed(solve)(sclf,keyData,keySpec,keySpecInternal,previousState,previousStateActive,XData,yData,crossValidation,item,index) for index, item in enumerate(inputsSc))
if (crossValidation == 5):
CVDepends = 5
XDataStack = XData.copy()
yDataStack = yData
else:
CVDepends = crossValidation
for train_index, test_index in crossValidation.split(XData):
XDataStack = XData[XData.index.isin(test_index)]
yDataStack = [yData[i] for i in test_index]
print('XDataShort', XDataStack)
print('yDataShort', yDataStack)
start = timeit.default_timer()
flat_results = Parallel(n_jobs=num_cores)(delayed(solve)(sclf,keyData,keySpec,keySpecInternal,previousState,previousStateActive,XDataStack,yDataStack,CVDepends,item,index) for index, item in enumerate(inputsSc))
scores = [item for sublist in flat_results for item in sublist]
stop = timeit.default_timer()
print('Time Stack: ', stop - start)
if (keySpec == 0):
previousState = []
previousState.append(scores[2])
@ -3028,10 +3145,10 @@ def EnsembleModel(Models, keyRetrieved):
scores.append(previousStateActive[7])
previousState.append(previousStateActive[6])
previousState.append(previousStateActive[7])
# print(scores)
print('Final Scores',scores)
global StanceTest
if (StanceTest):
sclf.fit(XData, yData)
sclf.fit(XDataStack, yDataStack)
y_pred = sclf.predict(XDataTest)
# print(accuracy_score(yDataTest, y_pred))
@ -3044,14 +3161,12 @@ def EnsembleModel(Models, keyRetrieved):
print(recall_score(yDataTest, y_pred, pos_label=0, average='weighted'))
print(f1_score(yDataTest, y_pred, pos_label=0, average='weighted'))
print(report)
return 'Okay'
def solve(sclf,keyData,keySpec,keySpecInternal,previousStateLoc,previousStateActiveLoc,XData,yData,crossValidation,scoringIn,loop):
def solve(sclf,keyData,keySpec,keySpecInternal,previousStateLoc,previousStateActiveLoc,XDataLocalIns,yDataLocalIns,crossValidation,scoringIn,loop):
scoresLoc = []
if (keySpec == 0):
temp = model_selection.cross_val_score(sclf, XData, yData, cv=crossValidation, scoring=scoringIn, n_jobs=-1)
temp = model_selection.cross_val_score(sclf, XDataLocalIns, yDataLocalIns, cv=crossValidation, scoring=scoringIn, n_jobs=-1)
scoresLoc.append(temp.mean())
scoresLoc.append(temp.std())
if (keyData == 1):
@ -3072,7 +3187,7 @@ def solve(sclf,keyData,keySpec,keySpecInternal,previousStateLoc,previousStateAct
scoresLoc.append(temp.std())
else:
if (keySpecInternal == 1):
temp = model_selection.cross_val_score(sclf, XData, yData, cv=crossValidation, scoring=scoringIn, n_jobs=-1)
temp = model_selection.cross_val_score(sclf, XDataLocalIns, yDataLocalIns, cv=crossValidation, scoring=scoringIn, n_jobs=-1)
scoresLoc.append(temp.mean())
scoresLoc.append(temp.std())
if (loop == 0):
@ -3088,7 +3203,7 @@ def solve(sclf,keyData,keySpec,keySpecInternal,previousStateLoc,previousStateAct
scoresLoc.append(previousStateLoc[6])
scoresLoc.append(previousStateLoc[7])
else:
temp = model_selection.cross_val_score(sclf, XData, yData, cv=crossValidation, scoring=scoringIn, n_jobs=-1)
temp = model_selection.cross_val_score(sclf, XDataLocalIns, yDataLocalIns, cv=crossValidation, scoring=scoringIn, n_jobs=-1)
scoresLoc.append(temp.mean())
scoresLoc.append(temp.std())
scoresLoc.append(temp.mean())

Loading…
Cancel
Save