diff --git a/meteos_ui/static/dashboard/machine_learning/model_evaluations/details/drawer.html b/meteos_ui/static/dashboard/machine_learning/model_evaluations/details/drawer.html
index db600c2..38faf25 100644
--- a/meteos_ui/static/dashboard/machine_learning/model_evaluations/details/drawer.html
+++ b/meteos_ui/static/dashboard/machine_learning/model_evaluations/details/drawer.html
@@ -7,4 +7,39 @@
+
+
+
+ - Result
+
+
+ {$ key $} |
+ {$ value $} |
+
+
+
+
+
+
+
+
+ - Confusion Matrix
+
+
+ {$ key $} |
+
+ {$ value $}
+ |
+
+
+ |
+
+ {$ key $}
+ |
+
+
+
+
+
diff --git a/meteos_ui/static/dashboard/machine_learning/model_evaluations/model_evaluations.module.js b/meteos_ui/static/dashboard/machine_learning/model_evaluations/model_evaluations.module.js
index c21c7a2..fd29c10 100644
--- a/meteos_ui/static/dashboard/machine_learning/model_evaluations/model_evaluations.module.js
+++ b/meteos_ui/static/dashboard/machine_learning/model_evaluations/model_evaluations.module.js
@@ -76,9 +76,6 @@
.setProperty('source_dataset_url', {
label: gettext('Source Dataset URL')
})
- .setProperty('stdout', {
- label: gettext('Result')
- })
.setListFunction(listFunction)
.tableColumns
.append({
@@ -108,10 +105,6 @@
id: 'source_dataset_url',
priority: 2
})
- .append({
- id: 'stdout',
- priority: 2
- })
// for magic-search
registry.getResourceType(resourceType).filterFacets
.append({
@@ -138,23 +131,50 @@
'label': gettext('Source Dataset URL'),
'name': 'source_dataset_url',
'singleton': true
- })
- .append({
- 'label': gettext('Result'),
- 'name': 'stdout',
- 'singleton': true
});
function listFunction(params) {
return meteos.getModelEvaluations(params).then(modifyResponse);
function modifyResponse(response) {
- return {data: {items: response.data.items.map(addTrackBy)}};
+ return {data: {items: response.data.items.map(parseItems)}};
- function addTrackBy(item) {
+ function parseItems(item) {
item.trackBy = item.id;
+
+ if (item.stdout) {
+ item.result = angular.fromJson(item.stdout.replace(/'/g, '"'));
+
+ if (item.result.Matrix) {
+ item.matrix = createMatrix(item.result.Matrix);
+ delete item.result["Matrix"];
+ }
+ }
return item;
}
+
+ function sum(i) {
+ return i.reduce(function(x, y) { return x + y; });
+ }
+
+ function createMatrix(matrix){
+
+ var table = [];
+ var row = [];
+ var sum_row;
+
+ angular.forEach(matrix, function(record, i) {
+ sum_row = sum(record);
+
+ angular.forEach(record, function(num, i) {
+ row[i] = num + ' (' + Math.round(num/sum_row*1000)/10 + '%)';
+ });
+
+ table[i] = row.concat();
+ });
+
+ return table;
+ }
}
}