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

+10 -10
View File
@@ -845,15 +845,6 @@
"fileName": "LearningSystem.js",
"folderName": "Learning-Bot/Low-Frequency-Learning"
}
],
"algorithmModules": [
{
"name": "Time Series Forcasting Tensor Flow JS",
"propertyName": "timeSeriesForcastingTensorFlowJS",
"functionName": "newSuperalgosAlgorithmModulesTimeSeriesForcastingTensorFlowJS",
"fileName": "LearningAlgorithm.js",
"folderName": "Learning-Bot/Low-Frequency-Learning/Time-Series-Forcasting/Tensor-Flow-JS"
}
]
},
"CL": {}
@@ -927,7 +918,16 @@
"TS": {
"globals":[],
"functionLibraries": [],
"utilities": []
"utilities": [],
"botModules": [
{
"name": "TensorFlow Library",
"propertyName": "tensorFlowLibrary",
"functionName": "newTensorFlowBotModulesTensorFlowLibrary",
"fileName": "TensorFlowLibrary.js",
"folderName": "Learning-Bot/Low-Frequency-Learning"
}
]
}
}
]
@@ -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) {
@@ -62,16 +62,28 @@ function newSuperalgosFunctionLibraryLearningSessionFunctions() {
let lightingPath = '' +
'Learning System->' +
'Tensor Flow Library->' +
'TensorFlow Library->' +
'Execution Environmnet->Supervised Learning->Unsupervised Learning->Self Learning->Reinforcement Learning->' +
'WebGL Backend->NodeJS Backend->WASM Backend->CPU Backend->' +
'Environment Flags->Debug Mode->Production Mode'
'Environment Flags->Debug Mode->Production Mode->' +
'Supervised Learning->Unsupervised Learning->Self Learning->Reinforcement Learning->' +
'Artificial Neural Network->Model->' +
'Layers API->Code API->' +
'Secuential Model->Functional Model->' +
'Input Layer->Secuential Layer->Output Layer->'+
'Input Shape->Batch Input Shape->Input Features->Feature->Feature Formula->' +
'Advanced Activation Layers->Basic Layers->Convolutional Layers->' +
'Conv 1D Layer->Conv 2D Layer->Conv 2D Transpose Layer->Conv 3D Layer->Cropping 2D Layer->Depthwise Convo 2D Layer->Separable Convo 2D Layer->Up Sampling 2D Layer->' +
'Activation Layer->Dense Layer->Dropout Layer->Embedding Layer->Flatten Layer->Permutable Layer->Rrepeat Vector Layer->Reshape Layer->Spatial Dropout 1D Layer->' +
'Elu Layer->Leaky Relu Layer->Prelu Layer->Relu Layer->Softmax Layer->Thresholded Relu Layer->'+
'Dimensionality Units->Activation Functions->Batch Size->Dtype->Trainable->Weights->Tensor->Kernel->Bias->' +
'Kernel Initializer->Kernel Contraint->Kernel Regularizer->' +
'Bias Initializer->Bias Contraint->Bias Regularizer->'
let learningSystem = UI.projects.superalgos.functionLibraries.protocolNode.getProtocolNode(node.learningSystemReference.payload.referenceParent, false, true, true, false, false, lightingPath)
lightingPath = '' +
'Learning Engine->' +
'Dynamic Indicators->Indicator Function->' +
'Learning Current->Learning Last->Previous->' +
'Learning Episode->' +
'Episode Base Asset->Episode Quoted Asset->Learning Episode Counters->Learning Episode Statistics->' +
+1 -1
View File
@@ -525,7 +525,7 @@
"action": "Add UI Object",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "layerType",
"label": "Add Advanced Activation Layers",
"label": "Add Activation Layers",
"relatedUiObject": "Advanced Activation Layers",
"actionFunction": "payload.executeAction"
},
@@ -1,10 +1,5 @@
exports.newSuperalgosAlgorithmModulesTimeSeriesForcastingTensorFlowJS = function (processIndex) {
/*
This module implements a learning algorithm based on Time Series Forcasting with Tensor Flow js,
as described at the folliwing web page:
exports.newTensorFlowBotModulesTensorFlowLibrary = function (processIndex) {
https://jinglescode.github.io/time-series-forecasting-tensorflowjs/
*/
const MODULE_NAME = 'Time Series Forcasting Tensor Flow JS Learning Algorithm'
let thisObject = {
updateChart: updateChart,
-12
View File
@@ -30,7 +30,6 @@ exports.newMultiProject = function () {
projectInstance.taskModules = {}
projectInstance.processModules = {}
projectInstance.botModules = {}
projectInstance.algorithmModules = {}
/* Set up Utilities of this Project */
if (projectDefinition.TS.utilities !== undefined) {
@@ -100,17 +99,6 @@ exports.newMultiProject = function () {
projectInstance.botModules[botModuleDefinition.propertyName] = requiredObject
}
}
/* Set up Algorithm Modules for this Project */
if (projectDefinition.TS.algorithmModules !== undefined) {
for (let j = 0; j < projectDefinition.TS.algorithmModules.length; j++) {
let algorithmModuleDefinition = projectDefinition.TS.algorithmModules[j]
let path = global.env.PATH_TO_PROJECTS_REQUIRED + '/' + projectDefinition.name + '/' + 'TS' + '/' + 'Bot-Modules' + '/' + algorithmModuleDefinition.folderName + '/' + algorithmModuleDefinition.fileName
let requiredObject = require(path)
projectInstance.algorithmModules[algorithmModuleDefinition.propertyName] = requiredObject
}
}
}
TS.projects.superalgos.globals.taskConstants.PROJECTS_SCHEMA = PROJECTS_SCHEMA