microbit-foundation/cctd-ml-machine

(Main) Type error in KNNModelGraphController

Closed this issue · 1 comments

Happens the Main branch.

Reproduce 1:

  1. On the data page: Make two classes with 3 samples in each
  2. Go to training page

Reproduce 2:

  1. Go to training page without any data

The error does not appear with the example dataset.

Uncaught (in promise) TypeError: Reduce of empty array with no initial value
    at Array.reduce (<anonymous>)
    at new KNNModelGraphController (KNNModelGraphController.ts:60:8)
    at initSingle (KnnModelGraph.svelte:51:21)
    at KnnModelGraph.svelte:71:18
    at run (chunk-2WHOEU5V.js?v=39cc4ada:30:10)
    at Array.map (<anonymous>)
    at chunk-2WHOEU5V.js?v=39cc4ada:2136:50
    at flush (chunk-2WHOEU5V.js?v=39cc4ada:1333:9)
r59q commented

Added check to ensure the minimum number of values required are present