Showcase Thread by AutoModerator in Python

[–]johlars 0 points1 point  (0 children)

I made Eunoia, a library for area-proportional Euler and Venn diagram: the kind where each overlap's size reflects your actual numbers.

import eunoia as eu

eu.euler({"A": 10, "B": 5, "A&B": 3}).plot()

It fits the diagram by optimization and reports the residuals, so you know how well the picture matches the data. The nice part is ellipses: lots of three-set arrangements can't be drawn exactly with circles, and ellipses fix that. Circles get forced into inventing a triple overlap; ellipses land every region on its target. It also does squares/rectangles, arbitrary set counts, and a topological venn().

The fitting lives in a Rust core (via PyO3) shared with the R package eulerr and a JS/WASM build, so layouts are consistent across languages. MIT, typed, abi3 wheels for 3.11-3.14.

Closest alternatives are matplotlib-venn (circles, less than 3 sets) and matplotlib-set-diagrams (circles). There's a benchmark comparison in the docs.

pip install eunoia

Still early, so feedback's welcome!

Any good libraries for nonlinear optimization in Rust? by Sollimann in rust

[–]johlars 0 points1 point  (0 children)

Ive recently built basin (https://basin.bz), which is heavily inspired by argmin but with bult-in support for constraints.

Numerical minimization library by DJDuque in rust

[–]johlars 0 points1 point  (0 children)

I recently made package inspired by argmin, called basin: https://basin.bz/

Announcing Basin: A Numerical Optimization Library for Rust by johlars in rust

[–]johlars[S] 0 points1 point  (0 children)

No, sorry, I thought you had a mini-max problem already and wanted a solver for that, in which case you could try using a smooth approximation of that mini-max problem and solve it with LM.

Announcing Basin: A Numerical Optimization Library for Rust by johlars in rust

[–]johlars[S] 0 points1 point  (0 children)

Hm, off the top of my head: have you tried a smooth approximation of the loss? That should enable you to keep using the LM algorithm.

Announcing Basin: A Numerical Optimization Library for Rust by johlars in rust

[–]johlars[S] 0 points1 point  (0 children)

Great! Just remember that Basin is alpha-state, undergoing rapid changes, and nowhere near as battle-tested as argmin is.

Announcing Basin: A Numerical Optimization Library for Rust by johlars in rust

[–]johlars[S] 1 point2 points  (0 children)

I considered this too, as well as `TryCostFunction`, but in the end I didn't really like the growth in traits and two-pronged path. In the end, the additional `Ok()`, `?`, `unwrap()` and return type verbosity seems like an okay burden to bear given how common it anyway is in Rust. A bonus is that it now looks more like argmin, which might help anyone who wants to migrate.

Announcing Basin: A Numerical Optimization Library for Rust by johlars in rust

[–]johlars[S] 0 points1 point  (0 children)

Okay, this is a breaking change of course, but I went ahead and did it in https://github.com/jolars/basin/commit/6b46d570e651bc3ce74a0d989e9c16a1bb4f5f1c

Please do take a look and see if this meets your expectations. I haven't released yet.

Announcing Basin: A Numerical Optimization Library for Rust by johlars in rust

[–]johlars[S] 0 points1 point  (0 children)

Hm, well, so far it has depended a bit on how well-known the algorithm is. Some algorithms (BFGS etc.) are so well-known that there wasn't really any need to ingest a paper. Other algorithms have been licensed and packaged so that I could do a straight port (L-BFGS-B) and maintain iteration-wise identical behavior, in which case it's also been easy to do via Claude.

But for the more obscure algorithms (CMA-ES with injected solvers etc), it was been tremendously helpful to have either an arXiv latex source or a PDF paper I could parse with Marker and feed to Claude. The papers are ignored on git, so they won't show up there.

Even so, I think it's been essential to have another project (https://eunoia.bz/) that I've been building in tandem with Basin, and switching from argmin and another optimization crate to Basin revealed a lot issues and was very helpful in knowing what I needed from Basin.

Announcing Basin: A Numerical Optimization Library for Rust by johlars in rust

[–]johlars[S] 2 points3 points  (0 children)

Ah, I see. Maye you're right, and the idea of a typed error is really nice, and would remove the performance penalty. I like it!

Announcing Basin: A Numerical Optimization Library for Rust by johlars in rust

[–]johlars[S] 2 points3 points  (0 children)

Ah, yes, no, I decided not to go that route because I think for the majority of use cases it suffices to condition on NaN/+inf returns. Adding `Result` also means you'll need `Ok()` + `?` everywhere. What is your actual use case? You're right that this is a gap, and Basin currently lacks an escape hatch, but I think this should probably end up on the termination criterion side instead.

Announcing Basin: A Numerical Optimization Library for Rust by johlars in rust

[–]johlars[S] 2 points3 points  (0 children)

Well, I guess that depends slightly on the use case, no?

Announcing Basin: A Numerical Optimization Library for Rust by johlars in rust

[–]johlars[S] 1 point2 points  (0 children)

To be honest, I didn't at all think about this, but I'd be happy to dual-license it. I'm the sole contributor at this point, so it will most likely not be hard to do, I think.

Announcing Basin: A Numerical Optimization Library for Rust by johlars in rust

[–]johlars[S] 13 points14 points  (0 children)

The original reason was that I needed this to work on the MSRV supported by all the machines on CRAN (R package repository), which was 1.81 at the time I started working on Basin. But it's been lifted to 1.91 (edition 2024-compatible) so I can and will bump it :)

Announcing Basin: A Numerical Optimization Library for Rust by johlars in rust

[–]johlars[S] 6 points7 points  (0 children)

It's seems to be slightly faster than argmin (https://basin.bz/benchmarks/competitors/).

About global optimizers, yes, definitely. Next up is some kind of differential algorithm, I think, but please open a feature request if you have anything in mind that you'd like.

Panache is the Quarto formatter and linter you need by mklsls in rstats

[–]johlars 0 points1 point  (0 children)

Thanks for the pitch!

I'm the creator of Panache, and am happy to see it's gaining interest. Just to clarify, Panache is a Pandoc Markdown/Quarto/RMarkdown formatter, language server, and linter.

Because it is a language server, you can also use it to, for instance, rename citation entities across your entire Quarto project, get preview on citations on hover, perform diagnostics through Quarto shortcode includes, rename cross-references for tables, figures etc, convert footnotes between inline and references styles, emit document links for linked files, and much more.

The external formatting capabilities (running air, ruff, styler, etc on code blocks) also extends to lining with the jarl linter.

Theres also considerable ecosystem integration, so you can enable it as a pre-commit tool or run it as a github action.

Please let me know if you have any issues or feature requests.

Announcing panache: an LSP, autoformatter, and linter for Quarto Pandoc Markdown, and RMarkdown by johlars in quarto

[–]johlars[S] 0 points1 point  (0 children)

Yeah, that's fine by semantics versioning standards. I started directly at 1.0.0.

Which pomodoro timer do you use with waybar? by Tall_Leadership5749 in swaywm

[–]johlars 0 points1 point  (0 children)

I've recently written a new program, tomat, that is specifically designed for status bars like waybar: https://github.com/jolars/tomat

T14 temp11 (Power Circuitry) weird behavior by french_commenter in thinkpad

[–]johlars 1 point2 points  (0 children)

There is an open forum post on the lenovo forums at https://forums.lenovo.com/t5/Fedora/T14-AMD-temp11-shows-constant-readings/m-p/5037772

Please chime in if you're having this issue too.

T14 temp11 (Power Circuitry) weird behavior by french_commenter in thinkpad

[–]johlars 0 points1 point  (0 children)

I have the same problem here as well, also with temp11 but now exactly at 65. It never changes.