Skip to content

Commit

Permalink
labeled data output is the prediction concatenated on the historical
Browse files Browse the repository at this point in the history
  • Loading branch information
jzerbe committed Nov 15, 2020
1 parent 1b6dc6c commit 02ca8d4
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,23 +99,30 @@ const main = async () => {
}

if (featureLabels) {
const inputDataRaw = fs.readFileSync(predictionFileLocation)
const inputData = JSON.parse(inputDataRaw)
const apiDataRaw = fs.readFileSync(apiDataFileLocation)
const apiData = JSON.parse(apiDataRaw)

const outputData = lodash.map(
inputData,
(inputDataBar) => {
const labeledObject = {}
const predictionDataRaw = fs.readFileSync(predictionFileLocation)
const predictionData = JSON.parse(predictionDataRaw)

for (let featureIndex = 0; featureIndex < featureLabels.length; featureIndex += 1) {
labeledObject[featureLabels[featureIndex]] = inputDataBar[featureIndex + 1]
}
const labelData = (inputDataBar) => {
const labeledObject = {}

return [inputDataBar[0], labeledObject]
},
)
for (let featureIndex = 0; featureIndex < featureLabels.length; featureIndex += 1) {
labeledObject[featureLabels[featureIndex]] = inputDataBar[featureIndex + 1]
}

return writeObjectToOutputFile(outputData, labeledFileLocation)
return [inputDataBar[0], labeledObject]
}

const labeledApiData = lodash.map(apiData, labelData)

const labeledPredictionData = lodash.map(predictionData, labelData)

return writeObjectToOutputFile(
labeledApiData.concat(labeledPredictionData),
labeledFileLocation,
)
}

if (stockTicker) {
Expand Down

0 comments on commit 02ca8d4

Please sign in to comment.