Error running Python’s GLMnet implementation `glmnet_py` (missing libgfortran.so.3)

For machine learning tasks with not a lot of instances (n) but a lot of features, the ElasticNet by Zou and Hastie, 2005 in my experience often works well in practice.

Missing libgfortran.so.3

To use the ElasticNet in Python, there are various packages on PiPy. I used glmnet_py/glmnet-py since it is referred to by the glmnet_python wrapper published on GitHub which is in turn linked by the original authors.

However, when I installed glmnet_py from PyPi via “pip install glmnet_py” (as recommended by the documentation), I get an error about a missing library file, namely libgfortran.so.3:

To solve this, I had compile and install glmnet_py manually from the code on GitHub:

This happened to my on a Fedora 29 with Python 3.7.2.

To track this issue, please see here.

Different versions of the same thing

The glmnet_py situation seems to be a little strange at first glance since there are two very similar PiPy repositories, namely glmnet_py and glmnet_python.

However, the latter seems to have been removed since a) its project description also refers to glmnet_py and b) pip seems not to be able to install the latter (at least for me).

Similarly, there are two GitHub repositories: one (by bbalasub1) linked by the original authors and one (by hanfang) that claims to have modified the former. However, the one by hanfang seems outdated. In contrast the one by bbalasub1 has actually seen some updates as of the time of writing this note.

Other ElasticNet implementations in Python

Of course, there are other ElasticNet implementations in Python. I have simply opted for the one above since it seems to be closely related to the original authors as well as the R code used by my colleagues. Here are some other examples of Python implementations:

SVGs are inline elements

So, I just found out that SVG elements are displayed inline by default. This has the “strange” effect that you get an overflow (which is not apparent, e.g., from the output of the Chrome debugging view) when you try to fill a parent element with a SVG. The following code shows how a scroll bar shows up for “no reason”:

To solve this issue all you have to do is to change the display  attribute of the SVG, e.g., to  block :

Try it yourself here: https://jsfiddle.net/mgbckr/ebvso38v/

The reason for this is nicely explained in a StackOverflow post like this:

inline or inline-block elements are called “inline” because they are intended to be laid out amongst lines of text. So, wherever they appear, space is reserved for the “descent”, which is the area underneath a line of text where the dangly parts of lowercase g’s, j’s, and y’s go.