From 94b9cf4820ed8b00a4dc1eb3ade643fe4c6ce48a Mon Sep 17 00:00:00 2001 From: Hiroyuki Eguchi Date: Tue, 31 Jan 2017 14:44:28 +0900 Subject: [PATCH] Improved model creation dialog Modal parameters differs depending on the prediction model. Modify a model creation dialog so that only necessary parameters are showing up when selecting prediction model. --- .../models/create/model-model.js | 34 ++++ .../models/create/spec/spec.html | 156 +++++++++++++++++- 2 files changed, 184 insertions(+), 6 deletions(-) diff --git a/meteos_ui/static/dashboard/machine_learning/models/create/model-model.js b/meteos_ui/static/dashboard/machine_learning/models/create/model-model.js index db7c0e9..12b54df 100644 --- a/meteos_ui/static/dashboard/machine_learning/models/create/model-model.js +++ b/meteos_ui/static/dashboard/machine_learning/models/create/model-model.js @@ -27,6 +27,7 @@ var model = { newModelSpec: {}, newCommonDataset: {}, + newParamsSpec: {}, // API methods init: init, @@ -58,6 +59,23 @@ swift_username: null, swift_password: null }; + + model.newParamsSpec = { + numIterations: null, + numClasses: null, + runs: null, + mode: null, + rank: null, + step: null, + impurity: null, + maxDepth: null, + maxBins:null, + learningRate: null, + minCount: null, + minSupport: null, + limits:null + }; + } function init() { @@ -68,8 +86,13 @@ function createModel() { var finalSpec = angular.copy(model.newModelSpec); var commonDataset = angular.copy(model.newCommonDataset); + var finalParams = angular.copy(model.newParamsSpec); var url = ""; + cleanNullProperties(finalParams); + + finalSpec.model_params = JSON.stringify(finalParams); + if(commonDataset.location == 'swift'){ url = 'swift://' + commonDataset.container_name + '/' + @@ -87,6 +110,17 @@ return meteos.createModel(finalSpec); } + + function cleanNullProperties(finalParams) { + // Initially clean fields that don't have any value. + // Not only "null", blank too. + for (var key in finalParams) { + if (finalParams[key] === null || finalParams[key] === "") { + delete finalParams[key]; + } + } + } + return model; } })(); diff --git a/meteos_ui/static/dashboard/machine_learning/models/create/spec/spec.html b/meteos_ui/static/dashboard/machine_learning/models/create/spec/spec.html index f2ce43d..d38000b 100644 --- a/meteos_ui/static/dashboard/machine_learning/models/create/spec/spec.html +++ b/meteos_ui/static/dashboard/machine_learning/models/create/spec/spec.html @@ -10,17 +10,161 @@ ng-model="model.newModelSpec.model_type" ng-options="item for item in ctrl.modelTypeOptions"> - -
+
-
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ +