diff --git a/Projects/Superalgos/UI/Function-Libraries/LearningSessionFunctions.js b/Projects/Superalgos/UI/Function-Libraries/LearningSessionFunctions.js index e86f6f658..86046f20e 100644 --- a/Projects/Superalgos/UI/Function-Libraries/LearningSessionFunctions.js +++ b/Projects/Superalgos/UI/Function-Libraries/LearningSessionFunctions.js @@ -68,6 +68,7 @@ function newSuperalgosFunctionLibraryLearningSessionFunctions() { 'Environment Flags->Debug Mode->Production Mode->' + 'Supervised Learning->Unsupervised Learning->Self Learning->Reinforcement Learning->' + 'Artificial Neural Network->Model->' + + 'Optimizer->Loss Function->Metrics->' + 'Layers API->Code API->' + 'Secuential Model->Functional Model->' + 'Input Layer->Secuential Layer->Output Layer->'+ diff --git a/Projects/TensorFlow/Schemas/AppSchema.json b/Projects/TensorFlow/Schemas/AppSchema.json index 8ae91039e..6a46c152b 100644 --- a/Projects/TensorFlow/Schemas/AppSchema.json +++ b/Projects/TensorFlow/Schemas/AppSchema.json @@ -351,6 +351,30 @@ "relatedUiObject": "Core API", "actionFunction": "payload.executeAction" }, + { + "action": "Add UI Object", + "disableIfPropertyIsDefined": true, + "propertyToCheckFor": "optimizer", + "label": "Add Optimizer", + "relatedUiObject": "Optimizer", + "actionFunction": "payload.executeAction" + }, + { + "action": "Add UI Object", + "disableIfPropertyIsDefined": true, + "propertyToCheckFor": "lossFunction", + "label": "Add Loss Function", + "relatedUiObject": "Loss Function", + "actionFunction": "payload.executeAction" + }, + { + "action": "Add UI Object", + "disableIfPropertyIsDefined": true, + "propertyToCheckFor": "metrics", + "label": "Add Metrics", + "relatedUiObject": "Metrics", + "actionFunction": "payload.executeAction" + }, { "action": "Delete UI Object", "askConfirmation": true, @@ -383,10 +407,130 @@ "name": "api", "type": "node", "childType": "Core API" + }, + { + "name": "optimizer", + "type": "node", + "childType": "Optimizer" + }, + { + "name": "lossFunction", + "type": "node", + "childType": "Loss Function" + }, + { + "name": "metrics", + "type": "node", + "childType": "Metrics" } ], "icon": "tensorflow" }, + { + "type": "Optimizer", + "menuItems": [ + { + "action": "Configure", + "label": "Configure", + "iconPathOn": "configuration", + "iconPathOff": "configuration", + "actionFunction": "uiObject.configEditor.activate" + }, + { + "action": "Delete UI Object", + "askConfirmation": true, + "confirmationLabel": "Confirm to Delete", + "label": "Delete", + "iconPathOn": "delete-entity", + "iconPathOff": "delete-entity", + "actionFunction": "payload.executeAction" + } + ], + "editors": { + "config": true + }, + "initialValues": { + "config": "{ \n \"value\": \"sgd\"\n}" + }, + "addLeftIcons": true, + "level": 3, + "attachingRules": { + "compatibleTypes": "->Model->" + }, + "propertyNameAtParent": "optimizer", + "childrenNodesProperties": [], + "icon": "tensorflow" + }, + { + "type": "Loss Function", + "menuItems": [ + { + "action": "Configure", + "label": "Configure", + "iconPathOn": "configuration", + "iconPathOff": "configuration", + "actionFunction": "uiObject.configEditor.activate" + }, + { + "action": "Delete UI Object", + "askConfirmation": true, + "confirmationLabel": "Confirm to Delete", + "label": "Delete", + "iconPathOn": "delete-entity", + "iconPathOff": "delete-entity", + "actionFunction": "payload.executeAction" + } + ], + "editors": { + "config": true + }, + "initialValues": { + "config": "{ \n \"value\": \"categoricalCrossentropy\"\n}" + }, + "addLeftIcons": true, + "level": 3, + "attachingRules": { + "compatibleTypes": "->Model->" + }, + "propertyNameAtParent": "lossFunction", + "childrenNodesProperties": [], + "icon": "tensorflow" + }, + { + "type": "Metrics", + "menuItems": [ + { + "action": "Configure", + "label": "Configure", + "iconPathOn": "configuration", + "iconPathOff": "configuration", + "actionFunction": "uiObject.configEditor.activate" + }, + { + "action": "Delete UI Object", + "askConfirmation": true, + "confirmationLabel": "Confirm to Delete", + "label": "Delete", + "iconPathOn": "delete-entity", + "iconPathOff": "delete-entity", + "actionFunction": "payload.executeAction" + } + ], + "editors": { + "config": true + }, + "initialValues": { + "config": "{ \n \"value\": [\"accuracy\"]\n}" + }, + "addLeftIcons": true, + "level": 3, + "attachingRules": { + "compatibleTypes": "->Model->" + }, + "propertyNameAtParent": "metrics", + "childrenNodesProperties": [], + "icon": "tensorflow" + }, { "type": "Layers API", "menuItems": [ diff --git a/Projects/TensorFlow/TS/Bot-Modules/Learning-Bot/Low-Frequency-Learning/TensorFlowLibrary.js b/Projects/TensorFlow/TS/Bot-Modules/Learning-Bot/Low-Frequency-Learning/TensorFlowLibrary.js index 317d9d25b..0d281d448 100644 --- a/Projects/TensorFlow/TS/Bot-Modules/Learning-Bot/Low-Frequency-Learning/TensorFlowLibrary.js +++ b/Projects/TensorFlow/TS/Bot-Modules/Learning-Bot/Low-Frequency-Learning/TensorFlowLibrary.js @@ -37,6 +37,7 @@ exports.newTensorFlowBotModulesTensorFlowLibrary = function (processIndex) { setupBackend() setupEnvironmentFlags() setupModel() + compileModel() callbackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE) @@ -235,6 +236,40 @@ exports.newTensorFlowBotModulesTensorFlowLibrary = function (processIndex) { } } } + + function compileModel() { + if (learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.optimizer === undefined) { + //TODO + return + } + if (learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.optimizer.config.value === undefined) { + //TODO + return + } + if (learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.lossFunction === undefined) { + //TODO + return + } + if (learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.lossFunction.config.value === undefined) { + //TODO + return + } + if (learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.metrics === undefined) { + //TODO + return + } + if (learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.metrics.config.value === undefined) { + //TODO + return + } + let compileArgs = { + optimizer: learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.optimizer.config.value, + loss: learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.lossFunction.config.value, + metrics: [learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.metrics.config.value] + } + + tensorFlowModel.compile(compileArgs) + } } function finalize() {