News for hackers. Stuff that matters.

palmy

Re:Open source and self hostable/private file converter on Saturday April 12, 2025 @09:50AM (#43664347)
The reality is also that not everyone isn't technical enough to deal with `ffmpeg` directly. At some point I basically hosted hacked-together website which simply used `ffmpeg` under the hood so that my dad, who's not as technically literate, could easily convert his files. Now I don't have to do this anymore because I can just host a vert.sh instance:)
Re:CuPy: NumPy and SciPy for GPU on Friday September 20, 2024 @11:05AM (#41602693)
cupy came out a long time before Jax; remember using it in a project for my BSc around 2015-2016.

Cool to see that it's still kicking!

This is great!

Also made some minor modifications: replaced `xsel` with `xclip` and added truncated version of the copied text to the `notify-send`:

  #!/bin/bash 
  # Dependencies: tesseract-ocr imagemagick 
  # on gnome: gnome-screenshot 
  # on kde: spectacle
  # on x11: xsel
  # on wayland: wl-clipboard

  die(){
    notify-send "$1"
    exit 1
  }
  cleanup(){
    [[ -n $1 ]] && rm -r "$1"
  }

  SCR_IMG=$(mktemp -d) || die "failed to take screenshot"

  # shellcheck disable=SC2064
  trap "cleanup '$SCR_IMG'" EXIT

  #notify-send "Select the area of the text" 
  if  which "spectacle" &> /dev/null
  then
    spectacle -n -b -r -o "$SCR_IMG/scr.png" || die "failed to take screenshot"
  else
    gnome-screenshot -a -f "$SCR_IMG/scr.png" || die "failed to take screenshot"
  fi

  # increase image quality with option -q from default 75 to 100
  mogrify -modulate 100,0 -resize 400% "$SCR_IMG/scr.png"  || die "failed to convert image"
  #should increase detection rate

  tesseract "$SCR_IMG/scr.png" "$SCR_IMG/scr" &> /dev/null || die "failed to extract text"
  if [ "$XDG_SESSION_TYPE" == "wayland" ]
  then 
    wl-copy < "$SCR_IMG/scr.txt" || die "failed to copy text to clipboard"
  else
    # xsel -b -i  < "$SCR_IMG/scr.txt" || die "failed to copy text to clipboard"
    xclip -selection clipboard -i < "$SCR_IMG/scr.txt" || die "failed to copy text to clipboard"  
  fi
  # Notify the user what was copied but truncate the text to 100 characters
  notify-send "Text extracted from image" "$(head -c 100 "$SCR_IMG/scr.txt")" || die "failed to send notification"
  exit
Though I see what you're saying, using a PPL for VAEs just seems like overkill given the simplistic nature of VAEs.

PPLs are useful when the data generation process is not easily represented by something like a simple multivariate Gaussian, etc. You find many good examples academic research, e.g. epidemiology.

I work on one of these PPLs, and I personally find Bayesian inference to be useful in a few cases:

1. When your main objective is not prediction but understanding the effect of some underlying / unobserved random variable.

2. When you don't have tons data + you have very clear ideas of the data generation process.

(1) is mainly relevant for science rather than private companies, e.g. if you're an epidemiologist, you're generally speaking interested in determining the effect of certain underlying factors, e.g. effect of mobility patterns, rather than just predicting the number of infected people tomorrow since the hidden variables are often someting you can directly control, e.g. impose travel restrictions.

(2) can occur either in academic settings or in private sector in applications such as revenue optimization. In these scenarios, it's also very useful to have a notion of the "risk" you're taking by optimizing according to this model. Such a notion of risk is in the Bayesian framework completely straight-forward, while less so in the frequentist scenarios.

I've been involved in the above scenarios and have seen clear advantages of using Bayesian inference, both in academia and private sector.

With that being said, I don't think ever Bayesian inference, and thus even less so PPLs, are going to "take off" in a similar fashion to many other machine learning techniques. The reason for this are fairly simple:

1. It's difficult. Applying these techniques efficiently and correctly is way more difficult than standard frequentist methods (even interpeting the results is often non-trivial).

2. The applicability of Bayesian inference (and thus PPLs) is just so much more limited due to the computational complexity + reduction in utility of the methods as data increases (which, for private companies, is more and more the case).

PPLs mainly try to address (1), and we do have examples of very successful examples of this, e.g. PyMC3 (they also have a bunch of nice examples of applying Bayesian inference in private sector context), and Stan (maybe more heavily used in academia).

Re:Emacs GUI Library on Tuesday July 11, 2023 @01:33PM (#36684375)
This post just made me check out XWidget support in Emacs, and oh my bejebus is this amazing.

Yes, it's not like running an actual browser, but this is so much better than anything I expected.

https://macowners.club/posts/using-xwidgets-on-macos/ gave me a quick and nice overview of how it looked.

Re:What’s New in Thunderbird 115 on Monday July 10, 2023 @06:54AM (#36664561)
I have accounts with both gmail (personal) and outlook (work), and so using an external email client let's me have all those in one place.
Re:Anki-Fy Your Life on Saturday March 18, 2023 @12:20PM (#35210347)
Anki is free on anything but iOS. Don't know why the iOS app is the only one with a fee.
Re:Norway Is the Only Country with Public Tax Returns (2018) on Saturday January 08, 2022 @10:00AM (#29852240)
In addition, you will be notified if anyone accesses your records. This defers most sane people from looking up the records of family members, friends and neighbors.
The issue is that Germany is testing ferociously while in the US this is not the case. It's therefore likely that the US numbers are severely underestimated, while Germany's are much closer to their true value.

Worth noting that Germany not having any deaths despite such a large number of cases can also indicate that they discover the infection very early, and similarly the number of US deaths can indicate late discovery.

Re:A blogging style guide on Friday December 07, 2018 @09:24AM (#18627862)
Cheers :) Autocorrect got me real goof!
Re:A blogging style guide on Friday December 07, 2018 @06:39AM (#18626839)
If time allows it and I want to ensure I understand some concept, explaining it to someone tend to be very useful. Writing a blog post is then a great way to do so without requiring one of my friends to listen!

I do this without even publishing the posts. As mentioned in one of the other comments, I am vary of making these accessible for the public due to lack of "oversight". I feel like there's a responsibility when sharing information, and if I'm not 100% sure what I've written is correct, I don't want to mislead people. And even if correct, one should really ask themselves if it actually adds something to the topic which is otherwise not easily accessible. I think this is especially important to ask today when there is so much information already available.

Hence I actually think writing blog posts as means of understanding is a really goof approach; whether or not the piece should be made public is something that should then be judged case-by-case.

Re:Deriving the Normal Distribution on Sunday October 21, 2018 @06:42PM (#18270789)
Most certainly. I did not intend to question the usefulness of maxent models. I just find myself a bit uneasy with maxent as a derivation of and/or explanation of the ubiquity of the normal distribution, given the two issues mentioned above when we're talking about the continuous case. I was wondering if you might have some insight into the issue which could remedy this feeling of uneasiness :)

And regarding the moments, it's just that the normal distribution is the only distribution with a finite number of non-zero moments. Therefore, constraining higher order moments is not so straight forward.

Also might be worth noting that technically, if one was sufficiently UNreasonable, one could constrain the target distribution to take on specific values given specific inputs. This would not be very useful in any real-world applications. Then choosing between constraining only the first moment ("minimal" constraints), or constraining each point you've observed to take on the normalized frequency ("maximal" constraints) becomes entirely up to you. Therefore I don't see quite how maxent models give us the tools for deciding between complexity and accuracy, as the maxent models can be on either end of the spectrum depending on what constraints we choose.

(Unsure if you were implying that it did, but nonetheless it might be something to note.)

Re:Deriving the Normal Distribution on Sunday October 21, 2018 @06:22PM (#18270695)
Thank you, I really appreciate the response. This was useful.

I do see the reasoning for choosing the normal due to it being the only distribution with finite non-zero moments, and thus, as you nicely pointed out, constraints on a finite number of higher order moments will not give a unique distribution.

But, due to the issues we've now mentioned, I find myself a bit uneasy wrt. maxent as a derivation of and/or as an explanation of the ubiquity of the normal distribution. Thus I find myself more comfortable with some of the other derivations demonstrated by Jaynes.

And thank you for the paper reference; will have a proper look at it sometime. It might be related to

Re:Deriving the Normal Distribution on Saturday October 20, 2018 @07:39PM (#18266046)
Thank you for the link to Jaynes' book! Really nice to see the different approaches.

I'm intrigued by your comment on maximum entropy, as I personally struggle with the maximum entropy derivation due to the fact that we're using differential entropy ("continuous" entropy) to derive the Gaussian under constraints on the first and second moment. The differential entropy does not satisfy the same properties as entropy for a discrete distribution, some of which are the very properties that motivated entropy as a measure of information. Jaynes himself wrote a paper on this topic of continuous entropy in the 60s (can dig out the reference in the morning). Even ignoring this, I also struggle a bit with "we're only constraining the two first and second moment". Why exactly one the first two? Why not the three first, etc.? One could say it's motivate by the fact that the Gaussian is the only distribution with finite nonzero moments, but that seems a bit handwavey?

Would genuinely appreciate some input here, as the concept of Principle of Maximum Entropy is something I have a bit of trouble coming to terms with for the reasons described above (in general, mainly because choice of constraints is abritrary).

Re:Ask HN: How to organize personal knowledge? on Saturday September 01, 2018 @03:28PM (#17893520)
Just to add to this, if you take a lot of mathematics notes, you can embed latex fragments in Org-mode. Making use of the yasnippet package, writing latex is actually quite efficient.

On top of this, if you read a fair bit of papers, check out org-ref [1]. Referencing and notetaking of papers becomes a breeze.

Finally, you can also export your notes to a bunch of different formats (e.g. html, pdf).

[1] https://github.com/jkitchin/org-ref

Re:Ask HN: What is your favorite way of taking notes? on Tuesday June 12, 2018 @05:14AM (#17291807)
The flexibility you get with pen and paper, e.g. draw arrows between arbitrary words / equations, you can't really beat.

But for the specific use-cases you mentioned:

- Org-mode allows you to integrate code into the document, hence to draw a function you could easily write a small snippet of code outputting a plot, which will be embedded in the document.

- I actually do this sometimes too! For the color-coding, Org-mode allows you to embedd arbitrary LaTeX such as "\textcolor{red}{\alpha}". I've set up a Yasnippet which lets me type "color + [TAB]" and expands to "\textcolor{}{}" with my cursor inside the curly brackets. I type "red" and hit TAB again, and then type whatever I want to be coded in red. For descriptions, I'm unsure why you couldn't as easily do this in a document. In my documents I usually have a larger body of text deriving/explaining the equation, and then I simply put the equation into a definition-block for further reference. Then I know that I can jump to its definition, and I'll find a more thorough explanation of it.

Re:Ask HN: What is your favorite way of taking notes? on Sunday June 10, 2018 @03:22PM (#17279741)
Then I will! I've always preferred taking notes on a computer due to how much easier it is to

- edit

- organize (heck, you can even search!)

But I'm a maths student and I never came across anything where I can efficiently write equations and formulas, before Emacs + Org-mode.

I have now been using Emacs + Org-mode + Yasnippet for a year, and it's bloody amazing. When it comes to efficiently including latex-expressions in my org-notes, Yasnippet is an absolute must.

And because this is Org-mode, I can export all my notes to HTML, PDF, etc. Adding a bit of customization, you get something like this http://www.retiredparkingguard.com/notes/. If you go to one of the note-pages with a bit of maths on it, e.g. mathematics/geometry.html, you should see a bar on the right displaying the notation used in each section. This requires javascript.

I also make heavy use of customized named blocks in my note-taking, e.g.

#+name: def:schrodinger-equation

#+begin_definition

...

#+end_definition

And then, using org-ref, I can do a `M-x org-ref-insert-ref-link` anywhere in the document and I can search through all these definitions, theorems, etc.

These blocks, when exported to HTML, are also given CSS classes, hence you can easily give these styling, making the reading experience into whatever you want.

Finally, I would also suggest org-ref by John Kitchin (https://github.com/jkitchin/org-ref); it makes organizing papers and the corresponding notes so incredibly easy.

All together this makes note-taking such a breeze and lowers the barrier for me to re-read and edit my notes significantly, compared to handwritten notes.

This is the part of his explanation I find confusing too, though I do agree with his general argument: the results aren't really useful when they haven't been tested on a dataset representative of the real distribution.

From what I can gather he's basically saying that the "probability of a random face being classified as homosexual" is 0.5. This isn't REALLY true (would have to run the classifier on all possible faces to find this), but that is in fact the "environment" the classifier has been trained within.