Programming Leftovers
-
Trie in Python
A post about Haskell vs. Python readability came onto my radar the other day. It compares the implementation of a trie structure, and after looking upon the Python version I wanted to make my own attempt. I didn't make it to necessarily compare or "battle" against the other solutions, it's more of an exercise in the vein of "how would I do it".
-
Learn Python: 7 of my favorite resources
I made a decision recently that I wanted to learn more Python so I could improve my instructional skills and broaden the horizons of my students. In the process, I have discovered these excellent resources that have me learning new code and improving my understanding of Python in general.
-
Pi without borders
As you may know, American English and British English have some differences. Not only in terms of just outright different words, but also in how they’re used – Matt Richardson, Community Engagement Manager at Raspberry Pi, informs us that, for robots that are remote-controlled and not autonomous, it’s much more proper to call them rovers in the US. Which makes sense!
While visiting Maker Faire Tokyo a few years back, the style of projects on display was very different than those in the UK or US. Here, folks’ creativity was on show, with weird and wonderful robots and contraptions that wouldn’t look out of place in a Rube Goldberg machine. In comparison, Westerners seemed to be making stuff with practicality and usefulness in mind.
Neither way is better, however it would be cool to see people here experiment with more artistic projects just for the fun of it.
-
A GC-Friendly Go Interning Cache
I’ve seen a little gem pass by in a Go cryptography code review and I want to share it because I think it’s a pattern that can be reused.
Let’s start with a problem statement: crypto/x509 Certificate values take a bunch of memory, and for every open TLS connection you end up with a copy of the leaf and intermediate certificate, and sometimes of the root too.[1] That’s kind of a waste of memory, a big one if you open a lot of connections to the same endpoint or to endpoints that use the same roots.
-
Which Gender is associated with this Name? R to the R-escue! - Learning Machines
When addressing somebody unknown to you with an uncommon name e.g. in an email you might not know whether this person is male or female. In this post, we make it a little fun project to let R help us with that, so read on!
Of course, R cannot figure out the gender just by looking at the names, we need some data! A very impressive dataset can be found here: Gender by Name Data Set.
-
Dirichlet Regression with PyMC | Joshua Cook
Below, I provide a simple example of a Dirichlet regression in PyMC. This form of generalized linear model is appropriate when modeling proportions of multiple groups, that is, when modeling a collection of positive values that must sum to a constant. Some common examples include ratios and percentages.
For this example, I used a simplified case that was the original impetus for me looking in this form of model. I have measured a protein’s expression in two groups, a control and experimental, across $10$ tissues. I have measured the expression in $6$ replicates for each condition across all $10$ tissues. Therefore, I have $10 \times 6 \times 2$ measurements. The values are all greater than or equal to $0$ (i.e. 0 or positive) and the sum of the values for each replicate sum to $1$.
I want to know if the expression of the protein is different between control and experiment in each tissue.
-
Building a TidyModels classification model from scratch and deploying with Vetiver - Hutsons-hacks
The awesome TidyModels team have been working hard to populate the tidymodels package and make it even easier to get your foot in the door when it comes to development of models in R.
I have been planning this workshop for a long time with my good old colleagues at the NHS-R Community, and we thought it apt to do this workshop in the run up to the awesome NHS-R Conference 2022, which sadly I cannot make this year due to work commitments.
-
Seeing through hardware counters: a journey to threefold performance increase
We tend to think of modern JVMs as highly optimized runtime environments, in many cases rivaling more “performance-oriented” languages like C++. While it holds true for the majority of workloads, we were reminded that performance of certain workloads running within JVMs can be affected not only by the design and implementation of the application code, but also by the implementation of the JVM itself. In this blogpost we described how we were able to leverage PMCs in order to find a bottleneck in the JVM’s native code, patch it, and subsequently realize better than a threefold increase in throughput for the workload in question. When it comes to this class of performance issues, the ability to introspect the execution at the level of CPU microarchitecture proved to be the only solution. Intel vTune provides valuable insight even with the core set of PMCs, such as those exposed by m5.12xl instance type. Exposing a more comprehensive set of PMCs along with PEBS across all instance types and sizes in the cloud environment would pave the way for deeper performance analysis and potentially even larger performance gains.