(data, label)
| 62 | * Shuffles data and label using Fisher-Yates algorithm. |
| 63 | */ |
| 64 | export async function shuffle(data, label) { |
| 65 | let counter = data.length; |
| 66 | let temp = 0; |
| 67 | let index = 0; |
| 68 | while (counter > 0) { |
| 69 | index = (Math.random() * counter) | 0; |
| 70 | counter--; |
| 71 | // data: |
| 72 | temp = data[counter]; |
| 73 | data[counter] = data[index]; |
| 74 | data[index] = temp; |
| 75 | // label: |
| 76 | temp = label[counter]; |
| 77 | label[counter] = label[index]; |
| 78 | label[index] = temp; |
| 79 | } |
| 80 | }; |
| 81 | |
| 82 | /** |
| 83 | * Calculate the arithmetic mean of a vector. |
nothing calls this directly
no outgoing calls
no test coverage detected