Giter VIP home page Giter VIP logo

Comments (10)

jmbuhr avatar jmbuhr commented on June 2, 2024

Some more insights:

If I replace the id function used in join_keys with somewhat heavier dplyr machinery, it works:
https://github.com/jmbuhr/ggplot2/blob/2e4206d99036e62c615da8a69e124832da94716c/R/compat-plyr.R#L128-L140

id_like <- function(.variables, drop = FALSE) {
  unique_rows <- dplyr::distinct(.variables) |>
    dplyr::mutate(id = dplyr::row_number())
  n  <- nrow(unique_rows)
  res <- .variables |>
    dplyr::left_join(unique_rows) |>
    dplyr::pull(id)
  attr(res, "n") <- n
  res
}

This would of course break other usecases of the id function, so it's not a fix, but it further isolates the problem.

from ggplot2.

teunbrand avatar teunbrand commented on June 2, 2024

I've run the example in the repo you linked to, but I'm not confronted with this error on Win11.
If you think something is wrong with ggplot2:::join_keys(), you might be able to show what kind of inputs give faulty outputs directly using that function.

from ggplot2.

jmbuhr avatar jmbuhr commented on June 2, 2024

It's stranger than that. The same input sometimes works and sometimes fails. I expanded https://github.com/jmbuhr/ggplot-na-issue and rendered it on the workstation on which I observe the issue: http://jmbuhr.de/ggplot-na-issue/
And what happens is that when I execute the same function with the same inputs I sometimes get different outputs.

from ggplot2.

jmbuhr avatar jmbuhr commented on June 2, 2024

Narrowed it down the the matrix multiplication in id

    res <- c((mat - 1L) %*% combs + 1L)

Both inputs stay the same, but the output varies on one machine...

from ggplot2.

teunbrand avatar teunbrand commented on June 2, 2024

Non deterministic output of matrix multiplications sounds like a recipe for disaster. I am clueless as to why that would happen on some machines.

from ggplot2.

jmbuhr avatar jmbuhr commented on June 2, 2024

So it's definitely the matrix multiplication... and the problem happens with options(matprod = "default"), but vanishes with options(matprod = "internal"): http://jmbuhr.de/ggplot-na-issue/minimal.html

Any idea what could make BLAS behave in such a way? The input matrices don't have any NA, NaN or Infs.

from ggplot2.

jmbuhr avatar jmbuhr commented on June 2, 2024

I will close this here, as it is certainly not a ggplot issue, but I hope you don't mind if I leave this open just a couple of days in the hopes that someone happens to have an idea.

from ggplot2.

teunbrand avatar teunbrand commented on June 2, 2024

I think I'd help to post this on stackoverflow or posit community to reach a wider audience than just those people that read ggplot2 issues.

from ggplot2.

jmbuhr avatar jmbuhr commented on June 2, 2024

Solved! sessionInfo() revealed that the machine in question was using intel's math libraries libmkl while all the others are using openblas.
For future reference, switching can be done globally under linux with
sudo update-alternatives --config libblas.so.3-x86_64-linux-gnu (for blas) and
sudo update-alternatives --config liblapack.so.3-x86_64-linux-gnu (for lapack).
I still don't know, why intel's libraries produced the issue, but I'm just happy it works now.

from ggplot2.

jmbuhr avatar jmbuhr commented on June 2, 2024

Thank you for your hints :)

from ggplot2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.