features and labels calculated

This commit is contained in:
Luis Fernando Molina committed 2021-02-19 08:37:28 +01:00
1 parent a98aec38e0
commit a4050f6c8d
5 files changed
+74 -16

No files matched your search

@@ -280,7 +280,7 @@ exports.newSuperalgosBotModulesLearningSystem = function (processIndex) {
}
/* Here we check if there is a formula to be evaluated */
if ((node.type === 'Formula' || node.type === 'Announcement Formula') && evaluating === 'Formulas') {
if ((node.type === 'Feature Formula' || node.type === 'Label Formula') && evaluating === 'Formulas') {
if (node.code !== undefined) {
/* We will eval this formula */
if (isDescendent === true) {
@@ -405,7 +405,7 @@ exports.newSuperalgosBotModulesLearningSystem = function (processIndex) {
return
} else {
if (value !== undefined) {
if (node.type === 'Formula' && isNaN(value)) {
if ((node.type === 'Feature Formula' || node.type === 'Label Formula') && isNaN(value)) {
docs = {
project: 'Superalgos',
@@ -43,7 +43,7 @@ function newSuperalgosFunctionLibraryDependenciesFilter() {
return filters
function recursiveFilter(node) {
if (node.type === 'Javascript Code' || node.type === 'Formula' || node.type === 'Feature Formula') {
if (node.type === 'Javascript Code' || node.type === 'Formula' || node.type === 'Feature Formula' || node.type === 'Data Formula') {
filter(node.code)
}
@@ -72,7 +72,8 @@ function newSuperalgosFunctionLibraryLearningSessionFunctions() {
'Layers API->Code API->' +
'Secuential Model->Functional Model->' +
'Input Layer->Secuential Layer->Output Layer->'+
'Input Shape->Batch Input Shape->Input Features->Feature->Feature Formula->' +
'Input Shape->Batch Input Shape->Input Features->Data Feature->Feature Formula->' +
'Output Labels->Data Label->Label 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->' +
+7 -7
View File
@@ -2915,9 +2915,9 @@
{
"action": "Add UI Object",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "dataLabelFormula",
"label": "Add Data Label Formula",
"relatedUiObject": "Data Label Formula",
"propertyToCheckFor": "labelFormula",
"label": "Add Label Formula",
"relatedUiObject": "Label Formula",
"actionFunction": "payload.executeAction"
},
{
@@ -2938,16 +2938,16 @@
"propertyNameAtParent": "dataLabels",
"childrenNodesProperties": [
{
"name": "dataLabelFormula",
"name": "labelFormula",
"type": "node",
"childType": "Data Label Formula",
"childType": "Label Formula",
"autoAdd": true
}
],
"icon": "tensorflow"
},
{
"type": "Data Label Formula",
"type": "Label Formula",
"menuItems": [
{
"action": "Edit",
@@ -2977,7 +2977,7 @@
"attachingRules": {
"compatibleTypes": "->Data Label->"
},
"propertyNameAtParent": "dataLabelFormula",
"propertyNameAtParent": "labelFormula",
"childrenNodesProperties": [],
"icon": "tensorflow"
},
@@ -25,6 +25,9 @@ exports.newTensorFlowBotModulesTensorFlowLibrary = function (processIndex) {
let tensorFlowBackend
let tensorFlowAPI
let tensorFlowModel
let tensorFlowData
let features = []
let labels = []
return thisObject
@@ -279,6 +282,14 @@ exports.newTensorFlowBotModulesTensorFlowLibrary = function (processIndex) {
chart = undefined
exchange = undefined
market = undefined
tensorFlowBackend = undefined
tensorFlowAPI = undefined
tensorFlowModel = undefined
tensorFlowData = undefined
features = []
labels = []
}
function updateChart(pChart, pExchange, pMarket) {
@@ -299,14 +310,60 @@ exports.newTensorFlowBotModulesTensorFlowLibrary = function (processIndex) {
}
function run(callbackFunction) {
/*
Do your magic here...
*/
let layersModel = learningSystem.machineLearningLibrary.typeOfLearning.typeOfModel.model.api.layersModel
/*
if all is good, return this...
Building the Features Tensor
*/
callbackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE)
if (layersModel.inputLayer === undefined) {
// TODO
}
if (layersModel.inputLayer.inputFeatures === undefined) {
// TODO
}
learningSystem.evalFormulas(layersModel.inputLayer.inputFeatures, layersModel.inputLayer.inputFeatures.type)
for (let i = 0; i < layersModel.inputLayer.inputFeatures.dataFeatures.length; i++) {
let dataFeature = layersModel.inputLayer.inputFeatures.dataFeatures[i]
if (dataFeature.featureFormula === undefined) { continue }
let featureValue = learningSystem.formulas.get(dataFeature.featureFormula.id)
features.push(featureValue)
}
/*
Building the Labels Tensor
*/
if (layersModel.outputLayer === undefined) {
// TODO
}
if (layersModel.outputLayer.outputLabels === undefined) {
// TODO
}
learningSystem.evalFormulas(layersModel.outputLayer.outputLabels, layersModel.outputLayer.outputLabels.type)
for (let i = 0; i < layersModel.outputLayer.outputLabels.dataLabels.length; i++) {
let dataLabel = layersModel.outputLayer.outputLabels.dataLabels[i]
if (dataLabel.labelFormula === undefined) { continue }
let labelValue = learningSystem.formulas.get(dataLabel.labelFormula.id)
labels.push(labelValue)
}
tensorFlowData = require("@tensorflow/tfjs-data")
let dataset = tensorFlowData.array([features, labels])
tensorFlowModel.fitDataset(dataset, { epochs: 5 }).then(info => {
console.log('Accuracy', info.history.acc);
/*
if all is good, return this...
*/
callbackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE)
});
/*
if something is bad, return this...