palmy
Joined 9 years ago
Joined 9 years ago
Cool to see that it's still kicking!
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"
exitPPLs 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.
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).
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.
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.
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.
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.)
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
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).