TensorFlow library initialized

This commit is contained in:
Luis Fernando Molina committed 2021-02-16 12:37:49 +01:00
1 parent ff9aed7253
commit 7bbd42ea46
6 files changed
+65 -62

No files matched your search

@@ -26,28 +26,6 @@ exports.newSuperalgosBotModulesLearningSystem = function (processIndex) {
let sessionParameters
let dynamicIndicators
let learningAlgorithmName = TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.learningParameters.learningAlgorithm.config.codeName
let learningAlgorithmModuleObject
/*
We will scan the project schema until we find the module that will run the algorithm
defined by the user at the UI / Session Parameters.
*/
for (let i = 0; i < TS.projects.superalgos.globals.taskConstants.PROJECTS_SCHEMA.length; i++) {
let project = TS.projects.superalgos.globals.taskConstants.PROJECTS_SCHEMA[i]
if (project.name !== TS.projects.superalgos.globals.taskConstants.PROJECT_DEFINITION_NODE.config.codeName) { continue }
for (let j = 0; j < project.TS.algorithmModules.length; j++) {
algorithmModuleDefinition = project.TS.algorithmModules[j]
if (algorithmModuleDefinition.name === learningAlgorithmName) {
TS.projects.superalgos.globals.processVariables.TOTAL_PROCESS_INSTANCES_CREATED++
let project = TS.projects[TS.projects.superalgos.globals.taskConstants.PROJECT_DEFINITION_NODE.config.codeName.toLowerCase()]
let botModule = project.algorithmModules[algorithmModuleDefinition.propertyName]
let moduleFunction = botModule[algorithmModuleDefinition.functionName]
learningAlgorithmModuleObject = moduleFunction(processIndex)
}
}
}
return thisObject
function initialize() {
@@ -121,9 +99,39 @@ exports.newSuperalgosBotModulesLearningSystem = function (processIndex) {
}
/*
Initialize the Learning Algorithm
Initialize the Machine Learning Library
*/
learningAlgorithmModuleObject.initialize(onInitializeReady)
let machineLearningLibrary = learningSystem.machineLearningLibrary
let machineLearningLibraryModuleObject
if (machineLearningLibrary === undefined) {
// TODO
}
/*
We will scan the project schema until we find the machine learning library
defined by the user at the UI.
*/
for (let i = 0; i < TS.projects.superalgos.globals.taskConstants.PROJECTS_SCHEMA.length; i++) {
let projectSchemaProject = TS.projects.superalgos.globals.taskConstants.PROJECTS_SCHEMA[i]
if (projectSchemaProject.name !== machineLearningLibrary.project) { continue }
for (let j = 0; j < projectSchemaProject.TS.botModules.length; j++) {
let botModuleDefinition = projectSchemaProject.TS.botModules[j]
/*
We match the type of the machine learning library with the name at the project schema
*/
if (botModuleDefinition.name === machineLearningLibrary.type) {
let project = TS.projects[machineLearningLibrary.project.toLowerCase()]
let botModule = project.botModules[botModuleDefinition.propertyName]
let moduleFunction = botModule[botModuleDefinition.functionName]
machineLearningLibraryModuleObject = moduleFunction(processIndex)
}
}
}
machineLearningLibraryModuleObject.initialize(onInitializeReady)
function onInitializeReady(err) {
if (err.result === TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE.result) {
@@ -150,8 +158,8 @@ exports.newSuperalgosBotModulesLearningSystem = function (processIndex) {
function finalize() {
learningAlgorithmModuleObject.finalize()
learningAlgorithmModuleObject = undefined
machineLearningLibraryModuleObject.finalize()
machineLearningLibraryModuleObject = undefined
chart = undefined
exchange = undefined
@@ -175,11 +183,11 @@ exports.newSuperalgosBotModulesLearningSystem = function (processIndex) {
}
function mantain() {
learningAlgorithmModuleObject.mantain()
machineLearningLibraryModuleObject.mantain()
}
function reset() {
learningAlgorithmModuleObject.reset()
machineLearningLibraryModuleObject.reset()
learningSystem.highlights = []
learningSystem.errors = []
@@ -201,7 +209,7 @@ exports.newSuperalgosBotModulesLearningSystem = function (processIndex) {
exchange = pExchange
market = pMarket
learningAlgorithmModuleObject.updateChart(pChart, pExchange, pMarket)
machineLearningLibraryModuleObject.updateChart(pChart, pExchange, pMarket)
}
function buildDynamicIndicators() {
@@ -227,7 +235,7 @@ exports.newSuperalgosBotModulesLearningSystem = function (processIndex) {
/*
Initialize the Learning Algorithm
*/
learningAlgorithmModuleObject.run(onRun)
machineLearningLibraryModuleObject.run(onRun)
function onRun(err) {
if (err.result === TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE.result) {