Coreboot update
It seems that I’ve taken quite a long time since the last post to return here. Such a long pause is mainly explained by my work on the thesis and participation in the Discrete Choice Analysis (DCA) school organised at EPFL. Probably I should make some posts with a more academic content, but it’s something for future projects.
Today I wanted to document the procedure for updating a Coreboot firmware on my X220. To give some context I should say that after I bought the laptop the summer of 2021, I nearly immediately swapped the proprietary Lenovo BIOS for the Coreboot. At that time it was done mostly for testing purposes, but as it worked pretty fine I started to use the X220 as my main laptop. Now I’ve decided to explore the procedure a little more.
Metaprogramming in R
While reworking the DCE Simulation package for my Thesis, I’ve discovered one more interesting topic to speak about. We have already seen how to create a package, write documentation and implement OOP in R. Now it comes the time of Metaprogramming. But don’t be afraid of this unfamiliar term, we are going to see that the concepts behind it are fairly simple.
Most of the materials presented are adopted from this mazing book about advanced R. My task here is mostly the vulgarisation of the material.
OOP in R
In previous publications we have seen how to create a package with R: (1) the project’s structure generation, (2) the unit tests and their automation and (3) the documentation management. Now its time to dive deeper into programming with R. Today we are going to explore how one can use Object Oriented Programming (OOP) paradigm in R.
There exist multiple object types and programming conventions, each with a particular idea behind it. In this post we are going to explore their differences and see when each of them is more appropriate.
Package documentation in R
Previously we have seen how to create a package: how to structure your code, what files to include and how to test your code.
The next step in package creation is the documentation.
We have spoken about its existence, but only briefly.
Now we have some more time to describe the documentation mantainace procedure more in detail.
For this we are going to use the roxygen2 package, which is included in devtool suite.
Tests in R
Following the previous post about the package creation in R we are going to dive into some details about how to work with packages. The first thing of interest for us is the possibility to perform tests on the package’s contents in order to control the result. Such possibility greatly facilitates the workflow while creating a package and ensures its functionality.
What is testthat?
Focusing our attention on the devtools meta-package’s contents we encounter rather quickly a great number of tools to test packages.
One of the key element here is the testthat package, which has a number of functions to perform tests.
Among the advantages listed on the project’s official webpage we discover testthat is, as it:
Python alongside R
While working on my PhD thesis I’m usually facing the situation when I need to use both R and Python programming languages.
R offers me the possibility to render neat scientific supports with rmarkdown package, which bring .Rmd support.
Obviously, Python has similar format (pymarkdown and the .Pmd) available, it is not as well developed as the R counterpart.
Moreover, I’m far more familiar with R statistical libraries, tidyverse suite and coding practices.
However, at the same time I need Python dependencies: the most developed neural network (NN) libraries are written in Python or have their main interface in Python.
For example, the well known TensorFlow has a Python based backend.
LaTeX and R
Today I’ve had to complete one of the course deliverables with some indications about how to compile the .Rmd files.
The courses I’m giving (partially) at Grenoble INP Génie Industriel (GI) are mostly oriented for the first and second year students on the engineering track.
This means that the level of heterogeneity in the knowledge across the groups is extreme and while some of them are more than capable to use R for document compilation, others encounter difficulties with this task.
ThinkPad X220 and PWM
Continuing the posts’ streak, today we are going to see how to eliminate the PWM flickering problem that arises on some of the ThinkPad laptops of early 2010-th. The proposed solution is specific for the laptops equipped with Intel GPU’s (Intel i915 only) running Linux.
This summer I’ve acquired a second laptop, an old ThinkPad X220, to have something more portable at hand in complement to my main ThinkPad T430. Today I’ve decided to finally patch my X220, because with time the eye strain has become more and more noticeable. Both of the machines encounter the same screen flickering issue even after the upgrade of their screens to the IPS versions. And even though I already corrected the problem on my T430 about 2 years ago, I’ve completely forgot how to do it by now. After some search on the Internet, I’ve found the solution and this post serves mostly to keep it by hand, just in case.
Financial market analysis with R
Recently I’ve became obsessed with the idea of getting into stock exchange (for testing purposes and not for actual investment). One of the main reasons is the desire to start putting something aside for long-term perspective, but in short perspective this project gives me quite a lot of things to play with. Among them - the possibility to explore the predictive financial oriented models, neural networks (NN) testing for stock predictions and many more.