How should I decide the precision value?
Tzikas opened this issue · 1 comments
Tzikas commented
I'm graphing large numbers (Date.now()) and I've noticed that it doesn't work well unless I increase the precision level, and then it works great unless I increase it too far. 100 seems to work well. Is there a way to pick the optimal precision value?
const result = regression.polynomial(this.props.data, { order: 2, precision:100 });
Tom-Alexander commented
It would depend on how sparse the data was, but offsetting the timestamps by the minimum might be sufficient. Otherwise you would need to scale the entire data set (e.g into weeks).
const min = Math.min(...this.props.data);
const data = this.props.data.map(value => [item[0] - min, value[1]]);
const result = regression.polynomial(data, { order: 2 });