* _write expects data to be in the form of a datum. ie. {input: {a: 1 b: 0}, output: {z: 0}} * @param chunk * @param enc * @param next * @returns {*} * @private
(chunk, enc, next)
| 59 | * @private |
| 60 | */ |
| 61 | _write(chunk, enc, next) { |
| 62 | if (!chunk) { |
| 63 | // check for the end of one iteration of the stream |
| 64 | this.emit('finish'); |
| 65 | return next(); |
| 66 | } |
| 67 | |
| 68 | if (!this.dataFormatDetermined) { |
| 69 | this.size++; |
| 70 | this.inputKeys = uniques(this.inputKeys.slice(0).concat(Object.keys(chunk.input))); |
| 71 | this.outputKeys = uniques(this.outputKeys.slice(0).concat(Object.keys(chunk.output))); |
| 72 | this.firstDatum = this.firstDatum || chunk; |
| 73 | return next(); |
| 74 | } |
| 75 | |
| 76 | this.count++; |
| 77 | |
| 78 | let data = this.neuralNetwork._formatData(chunk); |
| 79 | this.trainDatum(data[0]); |
| 80 | |
| 81 | // tell the Readable Stream that we are ready for more data |
| 82 | next(); |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * |
no test coverage detected