mljs / matrix

Matrix manipulation and computation library
https://mljs.github.io/matrix/
MIT License
353 stars 54 forks source link

null values are converted to 0 without warning #148

Closed chrispahm closed 2 years ago

chrispahm commented 2 years ago

When playing with the following dataset (https://archive.ics.uci.edu/ml/datasets/seeds#), I realised that the column means calculated by ml-matrix were different (wrong) when compared to R. It turns out that Float64Array.from(arrayData[i]) silently converts null values to 0 without any warning/error. Any idea on how to improve here?

stropitek commented 2 years ago

We can't have the same behavior as R since we use typed arrays

My suggestion would be to throw an error if a matrix is initialized with anything which is not a number (PR welcome)

chrispahm commented 2 years ago

Alright, see #149 for a suggestion