()
| 16 | } |
| 17 | |
| 18 | function mapStringClassesToNumber() { |
| 19 | let names = new Set(); |
| 20 | |
| 21 | trainingSet.forEach(row => { |
| 22 | names.add(row.output[0]); |
| 23 | }); |
| 24 | |
| 25 | names = [...names]; |
| 26 | |
| 27 | trainingSet = trainingSet.map(row=>{ |
| 28 | let index = names.indexOf(row.output[0]); |
| 29 | row.output = [0,0,0]; |
| 30 | row.output[index] = 1; |
| 31 | return row; |
| 32 | }); |
| 33 | } |
| 34 | |
| 35 | dressData(); |
| 36 | mapStringClassesToNumber(); |