Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Goes in infitie loop with some data #10

Open
exebetche opened this issue Apr 8, 2024 · 2 comments
Open

Goes in infitie loop with some data #10

exebetche opened this issue Apr 8, 2024 · 2 comments

Comments

@exebetche
Copy link

It's all in the title, with this simple data the script never stops. Am I missing something her e?

import Loess from "loess";

const data = {
  x: [
    19815, 19810, 19809, 19805, 19801, 19798, 19785, 19782, 19780, 19760, 19760,
    19760, 19725,
  ],
  y: [0.5, 1, 1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5],
  w: [
    2265025, 3904576, 2253001, 4108729, 1236544, 4511376, 138532900, 1234321,
    1806336, 1838736, 1838736, 1838736, 1188100,
  ],
};

const loessOptions = {};
const model = new Loess(data, loessOptions);
const fit = model.predict();
@mmarkell
Copy link

mmarkell commented Sep 21, 2024

I've figured this one out @exebetche --

Math.js median operation hangs on NaN inputs: josdejong/mathjs#1214

I just stepped through the repo and verified this is what is triggered in your case.

One solution is to upgrade the dependency of math.js, but I don't have enough time to debug why exactly they're nan in the first place...

Adding a patch here #11

@mmarkell
Copy link

(but really the solution should be to make mathjs a peer dependency with version > 5.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants