A story of 2 years of making (many) mistakes, and about learning (some)
After reading about J.H. Holland’s LCS algorithm in Melanie Mitchell’s book on “Complexity”…
THE BEST INTRO to the LCS Algorithm out-there (hands down!) (12’ video)
How it started
Already, the thing “worked”.
A few months later, it was my first R package. The first LCS implementation in R (AFAICT, anyway…)
It’s all here: https://github.com/kaizen-R/RLCS
Visualizing the model (iris - simplified)
It had some simplifications. 2 years later, some of these persist and make it wrong (and in some ways better at the same time!).
In the 80’s, “AI” was approached as “Expert Systems”: Humans would write rules to define some behaviour. A difficulty was how to come up with the best rules a good model would need. ~1976, John H. Holland proposed the “Learning Classifier System”, leveraging his Genetic Algorithms.
A “model”, a population of rules could look a bit like this:
| Rule | Interpretation |
|---|---|
| ###1 -> Y | if D (and the rest doesn’t matter) then Class=Y |
| 10## -> X | if A & NOT(B) then Class=X |
An LCS tries to evolve the best possible rules using stochastic processes (i.e. the result is not “the” guaranteed best), using a mix of covering, genetic crossing & mutation, and selection with pressure towards general but accurate rules. This is automated search of solutions, “ML”.
An LCS model is traditionally a population of “human-readable” rules, which is good for mitigating bias(es) (in training data, at least) and increased trust (justifying decisions).
Variants of LCS have been applied to Reinforcement (notably XCS) and Supervised Learning (e.g. UCS).
And I kept going, nights and weekends (mostly weekends :D)…
No particular objective in the beginning, and yet after almost 2 years of:
working on a slow ML algorithm, with a (rather) slow language (yes, I said it)
thinking about S shapes of technological progress, different approaches, coming up with ideas
mixing languages and HW (C++, Rust, but also Torch),
and mostly (way too many) wrong approximations, and repeating again, and again, and again, night-long parallel-processing training runs… (a bit of an obsession…)
I was officially accepted at URJC ~ October 8th, 2026.
Joyful time.
If you fancy having even less spare time. But we’ll get back to this later.
Let’s talk about R a bit
I didn’t buy a fresher Mac (Maybe I should have..)
Long running multi-Core process in passive cooled Macbook Air M1
(EDIT: Now this is false, but that changed literally two weeks ago…)
First version used all lists. It made conceptual sense. It worked. It was (especially) slow.
In the end I got rid of the lists altogether. Scary refactoring, but it worked out ok…
AFTER trying everything else… Try C++ (Rcpp)…
Packages: Run Cmd+Shift+T (testthat) often.
browser() is your best friend in the whole-wide-world


When you run several simulations (37h+…)
Parallel execution becomes a great ally. And I’ve tried a few combinations. I currently settle on {foreach}-{doParallel}. Sometimes, even {plumbeR}!
You could use {future.apply} or {mirai}. I also want to look into {mizu}, the new kid in town.
Save runtimes through parallel processing (beautiful!)
Not as “functional”, but, like it or not, in some cases, faster. Much.
Passing references (environment()) instead of large variables…
Breaking the input data. Kinda works. Much faster. Not a great idea.
Bad idea, per Papert & Minsky’s “Perceptrons”…
Moving calls around for speed
LLM can model proteins
Coding (and reading) == “additional ponder time”
E.g. I came up, over two years, independently, with many ideas that (doing things “right”) prove not crazy as others came up with them too! (Also: Dopamine!)
At these very conferences: “AI could write my thesis”. Well, “AI” can write papers, indeed! But why do a PhD then?
Naive (and idealistic, and romantic) take:
It is about becoming an expert through thinking & making some scientific progress (even something minuscule). And maybe it’s one way to direct learning efforts.
Also I now get excellent feedback from experts (my Thesis Supervisors). I’m not alone anymore!
And my wife wouldn’t let me study another MSc. 😅
Not for any code of RLCS. I didn’t have a time pressure. Coding is a satisfying experience.
I did not use them that much for learning…
I prioritized books. And (later) papers.
Which possibly was a mistake (as long as you check the sources)
Maybe not using AI is really a privilege?
Note: Ensure Authorship is clear. It’s a tool, yes, and you don’t need to mention Excel. But the code you push with an Agent, is not your thinking alone. So you’re not the (only) author of it.
I have a critical stance on the (incorrect) use of LLMs. Yet I study Machine Learning?
Yes. I think LLMs and agentic AI is extremly powerful. But I believe that they are over-used, for the wrong reasons, given the (mentioned) issues.
One big focus for me is how to use the machine to help me make choices/decisions.
I want ML and computers to help us. I want eXplainable/Interpretable AI. I chose the LCS algorithm in big part because of that, while I realize it’s no competition for a 200+ billion parameters transformer…
We shouldn’t aim to replace ourselves, but to improve & elevate ourselves.
Use Agentic AI to make important progress. Fight cancer, climate change. Of course! Go right ahead.
But given the trade-offs, maybe hold off on generating “AI Slop” videos?
It was never about the syntax. It was (and still is) about thinking through (programmatic) approaches to solving problems. And coding in R is just as good an option as any other for that.
We should still read books. We should still code (even if only from time to time and for fun). We should still make time to think, get bored. Maybe not at our day job, “because competition”. But this is precisely why we must make an effort to reserve space for our own “mental gym”.
But isn’t learning fun in-and-of-itself?
Taking our time to learn and understand is becoming a luxury.
The Package per-se (github for now) (and some more info!)
It turns out, others think a bit like me (but I’m just a student) about learning and genAI (published on Youtube Nov. 19th), from the recent “R+AI” conference!
General lines…
| Working on… | Status |
|---|---|
| State of the art (my code doesn’t respect preceding algorithms…), literature review | Ongoing |
| train/validation/test, stratified 5-fold | Coded |
| Fix issues (data leakage in encoding…) | Done |
| Better ML metrics for (SL) evaluations | Done |
| Repeatability (datasets, seeds, etc.) | Done |
| Run (thousands?) configs & iterations in grid search of several algorithms? | Next up. |
Secret Sauce! This is quite possibly my first original (as far as I can tell) contribution. It’s not a secret either & I can show I have “priority” ;) (Until proven wrong, of course…)
More on this when (if? Nah, when!) I publish my first PhD Paper ;)
Draft generated in R / Quarto :)
Don’t encode data points, encode information!
Better Encodings, regularization and its effects…
E.g. Gini/entropy to change encoding length? Things like that, there is a lot to be considered! Trees encoding, etc. Or maybe discard variables? Markov Blankets…
Note: PCA & al. might make the model less interpretable


That’s how I came to know my then-future-Thesis-Supervisors.
After discovering the concept, I thought I could come up with new data complexity measures, specific to RLCS.
Then I could leverage those metrics for “active learning”
exposing (in training) to fewer overall samples
while maintaining classification quality
and hence reduce runtimes
Hopefully anyway :D
While inherently interpretable, the rule-set (RLCS Model) gets complex quickly.
For Reinforcement Learning settings, I believe there is a way to leverage subsumption steps during training to distill information (“consolidate”) into a separate hierarchy of RLCS models, for shorter input strings (faster training/inference) while maintaining learning capacity.
To Be Continued…