HNHacker News
TopNewBestAskShowJobs

imurray

1,578 karma · joined November 22, 2009

https://iainmurray.net/

https://imurray.bsky.social/

https://mastodon.social/@imurray / @imurray@mastodon.social

https://twitter.com/driainmurray

Research interests include statistics and machine learning.

submissionscomments
imurray··on Python 3.12.0 is to remove long-deprecated items
Thanks. I did ctrl-f cgi as I knew its removal was coming and missed the heading. So one more point release of grace, but it's still coming soon.
imurray··on Python 3.12.0 is to remove long-deprecated items
Thank you!
imurray··on Python 3.12.0 is to remove long-deprecated items
While it's been coming for a long time, it's still frustrating to see the cgi module go. It's going to create a load of busy work to rewrite some low-traffic scripts.

Modules being removed [edit: in 3.13]: https://docs.python.org/dev/whatsnew/3.12.html#pending-remov...

Updating CGI scripts will be a bit fiddly: https://peps.python.org/pep-0594/#cgi

imurray··on Mastodon – Simplified Federation
I've made a bookmarklet to toggle between the website for the instance you use and the one the post/user used:

https://homepages.inf.ed.ac.uk/imurray2/code/mastodon.html

It's maybe easier to just use a separate app though, and avoid the faff of separate webpages entirely.

imurray··on Essential Climbing Knots
This is a great video. A summary for those who don't want to wade through it:

The main message is that if the knot is slightly loose, or messy, the strands pinch unevenly in a fall, and it can be really hard to untie (depending on the rope). Most of the video is experiments to show that. The knot only had to be slightly loose to cause problems.

The part that surprised me is that there are two different ways to tie the knot that basically look the same. They only differ in which of the two outgoing strands is the one that's loaded. They're both perfectly safe, but one can be a lot harder to untie than the other after a fall. I actually find it hard to end up with the "wrong" version of the knot, but I might just be lucky with what my muscle memory has latched on to. I certainly wasn't taught to watch out for the difference.

The difference between the two knots is shown at 13m 24s: https://www.youtube.com/watch?v=QAr-uHd8h8o#t=13m24s

His demo of one way to get the knot the right way around is at 7m 41s of another long video: https://www.youtube.com/watch?v=PJkCaUUhqgs#t=7m41s

imurray··on Miniexpect – A very simple expect-like library
I used to use `unbuffer` which comes with expect, and might be what you used too. I now use the following hack, which works faster:

Create isatty.so like this:

    echo "int isatty(int fd) { return 1; }" | gcc -O2 -fpic -shared -ldl -o isatty.so -xc -
Then to make `some_program` think it's in a tty:

    LD_PRELOAD=./isatty.so some_programe
Source and more: https://unix.stackexchange.com/questions/249723/how-to-trick...
imurray··on Tiny Core Linux 13.0 is a full Linux desktop in 22 MB
There's a bunch of nostalgia about what small meant to mean, so I'll leave some links to the QNX 1.44MB demo floppy:

http://toastytech.com/guis/qnxdemo.html

https://news.ycombinator.com/item?id=10483653

imurray··on Python-patterns – A collection of design patterns/idioms in Python
> apparently you can't pickle a module object

Not with the standard library pickle, but "dill extends python’s pickle module for serializing and de-serializing python objects to the majority of the built-in python types".

— https://pypi.org/project/dill/

imurray··on Siteswap
There's also math-inclined partner juggling. See the "social siteswaps" DVD, and https://passist.org/ for example. Oh, and of course: https://www.juggle.me.uk/passing/ (RIP Aidan Burns)
imurray··on Siteswap
This website http://www.prechacthis.org/ is driven by Prolog https://github.com/prechac/prechacthis/tree/master/src/pl

I believe this juggle-dance routine https://vimeo.com/23958929 was put together using this tool. Neat use of prolog.

imurray··on The Fundamental Axiom of Floating Point Arithmetic
> Kahan’s summation algorithm

Radford Neal (2015) has an approach to computing sums exactly (to the correct rounded floating point number) in less than twice the time to do it naively. In some situations it can do work in parallel and saturate memory bandwidth, so takes roughly the same time: http://www.cs.toronto.edu/~radford/xsum.abstract.html

"Kahan’s (1965) method for reducing summation error (but without producing the exact result) was also tested on all systems. On modern 64-bit processors, computing the exact sum with the large superaccumulator method was faster than Kahan’s method for summations of more than about 1000 terms. Kahan’s method was significantly faster than the small superaccumulator method only for summations of less than about 100 terms."

imurray··on Entr: Rerun your build when files change
Commands like this are super-useful, and I use them all the time when editing LaTeX papers.

I used atchange for a long time:

http://jeffreycopeland.com/work/PDF/1996-03-atchange.pdf http://users.fred.net/tds/lab/atchange.html

And now, out of habit, my own wrapper around inotify. But more polished solutions like entr do seem the place to start now.

imurray··on Klutz Press: books built for learning stuff
For juggling in particular, it's also my experience that teaching complete novices is easier. People who've juggled a bit often listen less, and get frustrated with breaking things down, and just go back to doing what they know.

At the British Juggling Convention I taught a workshop for absolute beginners to pass 5 clubs following http://passingpedagogy.com/ . Most of those who'd never picked up a club got on pretty well. Whereas some people who'd passed clubs in a different way were skeptical; you could tell their heart wasn't in it, and then unsurprisingly some of them didn't get it.

I do understand the resistance to going back to basics to fix things though. I can hoop (as in "hula-hoop") fairly well, and know some tricks. But I mostly hoop in one direction (counter-clockwise). If I try to do a trick clockwise, it's frustrating and I don't feel like carrying on, so I tend to give up, or go back to hooping counter-clockwise (fortunately one of my favorite tricks involves reversing the direction of the hoop). This weakness of mine was actually really useful (back when I still hooped with people). If I was showing someone else a trick, I could try it clockwise, which was an excellent reminder of how hard the trick really is, and to understand how/where it goes wrong.

imurray··on Klutz Press: books built for learning stuff
I originally learned to 3 balls from the Klutz juggling book as a kid, and still have largely fond memories of it.

I have a slight sour taste from the very end of the book, which discourages people from trying to go to higher numbers such as 5 balls. So after learning 3 balls, I set juggling aside. Much later, after meeting jugglers and seeing what people could do in videos online, I was inspired to learn a lot more... including 5 balls.

If you want people to excel, don't tell them they shouldn't expect to be able to do things, and that it's not worth the effort.

imurray··on JPEG Committee releases a call for evidence for image compression based on AI
A relevant NeurIPS 2019 paper for lossless compression (for e.g., medical imaging):

https://papers.nips.cc/paper/9383-integer-discrete-flows-and...

imurray··on Get Me Off Your Fucking Mailing List (2005) [pdf]
Should have used pdflatex with

   \usepackage{microtype}
in the preamble. The hyphenation would have been much nicer.
imurray··on Berlin Key
The other names are already on the German wikipedia page: https://de.wikipedia.org/wiki/Durchsteckschl%C3%BCssel
imurray··on Introduction to Applied Linear Algebra Vectors, Matrices, and Least Squares [pdf]
Please don't deep link to PDFs when there is a sensible contents page that has more information and other links.

https://web.stanford.edu/~boyd/vmls/

imurray··on Twelve LaTeX packages to get your paper accepted (2017)
A tool that did something like #1:

https://web.archive.org/web/20080705135647/http://www.jmlg.o...

A small number of old NIPS (now NeurIPS) papers may even have used it.

imurray··on Temperature Conversion: Mental Calculation (2014)
Numerical implementations of functions often use look-up tables, and there's sometimes a trade-off between number of operations and memory access. (Large look-up tables aren't cache-friendly.)

This blog-post is from someone who prefers to do less mental arithmetic, but remember a few numbers: http://www.theexclusive.org/2012/08/converting-fahrenheit-in...

imurray··on Argdown
http://docopt.org/ — turns help text in a Python doc string into an argument parser.

After a doc string put:

    import docopt
    args = docopt.docopt(__doc__, version='0.0.1')
Edit: krapht points out there is now support for multiple languages: https://github.com/docopt
imurray··on Google relents slightly on blocking ad-blockers for enterprise Chrome users
If you're on linux you could try moving out your ~/.fonts to see if it's a fontconfig problem

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=909818

(I've seen variants of this problem on Ubuntu 18.04 LTS.)

imurray··on Natural Gradient Descent (2018)
I wouldn't recommend this to someone wanting to use the currently most practical tools. But I'm glad some people want to know about this stuff.

Sometimes the natural gradient turns out to be easier to compute than the gradient, and then it has made it in to applications.

Variational Inference: A Review for Statisticians (Blei et al., 2016) https://arxiv.org/abs/1601.00670

In this case, the gradient (51) has the Fisher Information in it and the natural gradient gets rid of that hard-to-compute term. This stuff has been used in a bunch of applications (section 5.1, p23).

You could argue that someone pragmatic might have tossed that positive definite term anyway (without knowing about natural gradients). Or come up with the same algorithm, as a heuristic improvement of existing algorithms. But the connection is quite neat.

Another example of links to natural gradients helping to make an algorithm cheaper: https://arxiv.org/abs/1712.01038 (Two related papers appeared at ICML 2018.)

imurray··on Essentials of Metaheuristics (2015) [pdf]
Parent page with metadata: https://cs.gmu.edu/~sean/book/metaheuristics/

(Please don't link to PDFs where a sensible parent html page exists. We can click from html to pdf but not vice-versa.)

imurray··on A History of the Sentence "Buffalo buffalo buffalo buffalo buffalo." (1999-2015)
But you have such nice stories in German!

https://www.youtube.com/watch?v=gG62zay3kck

imurray··on Reading with a pencil
I love Frixion pens and use them every day when writing notes, and annotating drafts. They're also great for writing under a document camera when teaching. Although I wish there was an intermediate thickness between the thin ball-points and the really fat felt-tips.

That said, I wouldn't use Frixion pens to write in books that I wasn't prepared to write in using normal pens. The ink doesn't completely disappear. The color also comes back (to some extent) if you put the paper in a freezer.

imurray··on Richard Feynman's Integral Trick
Finally, IIRC, how to do integration of algebraic expressions in closed form has long been a solved problem and long ago was coded up in some software -- IIRC, the software will report the result or state that no closed form solution exists.

Are you thinking of indefinite integrals? https://en.wikipedia.org/wiki/Risch_algorithm

This article is about a trick for definite integrals. If you can do the indefinite integral you can do a definite one, but not necessarily vice versa.

imurray··on How to write efficient matrix multiplication
This code:

    #define CSR_FLUSH_TO_ZERO         (1 << 15)
    unsigned csr = __builtin_ia32_stmxcsr();
    csr |= CSR_FLUSH_TO_ZERO;
    __builtin_ia32_ldmxcsr(csr);
from https://stackoverflow.com/a/8217313/ seems to work for me with gcc. I don't know how widely supported it would be.
imurray··on How to write efficient matrix multiplication
Dense matrix algebra has the benefit that besides the matrix dimensions, the data itself has no impact on performance

I was very surprised when I first learned that's not strictly true, because of denormal numbers[1]. Here's a session in ipython --pylab (with MKL), demonstrating a 200x slow-down for matrix multiplication with tiny numbers. Crazy!

    In [1]: A = randn(1000, 1000)
    
    In [2]: %timeit A @ A
    25.9 ms ± 199 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
    
    In [3]: A *= 1e-160
    
    In [4]: %timeit A @ A
    5.52 s ± 21.2 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
You hit denormal numbers more quickly with single-precision floats. I have been bitten by this issue in the wild a couple of times now, and seen a couple of other people with it too. Sometimes denormals are created internally in algorithms, when you didn't think your input matrices were that small.

[1] https://en.wikipedia.org/wiki/Denormal_number#Performance_is...

imurray··on Project Gutenberg blocks access from Germany
"Verlag" is just the German word for publishing house.
← PreviousPage 3 of 13Next →