I’ve created a short exercise on Markov Models for my students, here’s the story
“You are a valued employee of MegaCorp Inc.
Locked in your basement office you’ve been gathering information about your coworkers Adalbert, Beatrice and Celis. They’re working in shifts on a single machine and you’ve been monitoring and logging their daily routines. Unfortunately they found out, disabled their webcams, removed your Trojan and cut off your access to switches and routers. Even though you are blind now, it’s still mandatory for you to know who is currently working for any, because only Adalbert isn’t vigilant enough to notice when you sneak up to the ground floor to snatch some donuts and cake from their office fridge.
Except… you still got the old logs and you can see the LEDs of their switch blinking. Unfortunately you don’t have physical access, but perhaps you can still try to figure out, who’s shift it is?”
So what’s the task?
- We model this problem using Markov Models (obviously)
- Our Markov states are the activities of a given co-worker
- Each activity produces different LED blinking patterns – so each state/activity emits an observation
- Three iterations:
- Task 1: Markov chain, only modeling states (activities) over time
- Task 2: Markov chain with observations, modeling states (activities) and observations (blinking LEDs) over time, given we have access to both
- Task 3: Hidden Markov model, modeling states (activities) and observations (blinking LEDs) over time, given we have access only to the observations
Let’s look at the data:
- You own logs of daily activities for each of the coworkers A, B and C
- The logs are CSVs in the format: date|sequence of activities
- Activities: Working (0), pause (1), online gaming (2), browsing the internet (3), streaming TV series (4)
- Furthermore you’ve been (independently) gathering data on LED blinking patterns for different activities in the format: activity|pattern
- Pattern: none (0), very low frequency (1), low frequency (2), medium frequency (3), high frequency (4), very high frequency (5)
You can get the Python/Jupyter notebook here:
And check out how the correct plots should look like here:
You can also try it on Google colab:
I’m a notorious parallel reader, jumping between books all the time.
Here I give a couple opinions on the books currently in my pipeline:
- Deep Learning, Ian Goodfellow and Yoshua Bengio and Aaron Courville
- Fluent Python, Luciano Ramalho
- Seven Languages in Seven Weeks, Bruce Tate
- Clojure for the Brave and True, Daniel Higginbotham
- A Tour of C++, Bjarne Stroustrup
- The Rust Programming Language, Steve Klabnik and Carol Nichols
- (Hyperion, Dan Simmons)
I’ve recently answered a question on the German Quora (https://de.quora.com/Warum-sollte-man-in-Java-lieber-auf-die-Rekursion-verzichten/answer/Markus-Toman) that stated: “Why should you refrain from recursion in Java?”.
I think we should avoid recursion by default, except if:
- you are working in a language where recursion is essential and highly-optimized (Haskell, LISP dialects, Erlang/elixir and most other functional languages)
- the recursive version is much easier to maintain and understand AND does not negatively affect performance to an unreasonable degree
- the recursive algorithm is easier parallelizable (typically because of immutability)
In this post we discuss this topic, starting with high-level Python, going over to C++ and finally ending up in assembly.
Disclaimer: this is an opinionated article, flowing directly from brain to keyboard without lots of references and explanations. I know much of its content is debatable and it just reflects my current opinions and mindset, likely to change without notice.
Recently I watched the Design Patterns Coursera course (https://www.coursera.org/learn/design-patterns) and noticed that it’s full of Gang of Four (GoF) design patterns. If you are a programmer reading about programming online, you’ll find that discussions and material on GoF has been very sparse in the recent years, especially with the uprising functional programming hype (if we can call it a hype).
I wondered about this and a bit of investigation led me to (mostly) the following opinions:
- GoF patterns are now common knowledge and therefore nobody talks about it anymore, just like nobody talks about using functions or control structures anymore.
- They were a fail, born in the object-oriented-Java-mindset, made software even more complex and went overboard with useless abstractions.
- They were there to help with programming language shortcomings which are less and less of in issue now, especially with functional features entering existing languages.
So, was OOP a fail? Will functional programming save us? Are strapped-on design patterns useless and replaced by simpler language features? How did we get to the current situation, where will we and up?
This is part 2 of “Examples for performance optimization in C and C++”, you can find part 1 here: Examples for performance optimization in C and C++, Part 1
This brief case report shows an example for performance gains that can be achieved in C and C++ by simple analysis and code restructuring. It does not describe performance optimization in detail.
I’ve recently been implementing the Speech Synthesis SDK on iOS at VocaliD and wanted so share some quick hints on working with the Apple Audio Queue Services. This is no thorough treatise but just a few bullets points that might be helpful.
I’ve recently been reading the article “Coding needs a new youth movement” in which the author proposes that beginner programming courses should focus on “frontend” technologies to motivate students. Instead of “backend” technologies like Java, that is. This lead me to take a look back at the time when I wrote my first lines of code, which was more than 20 years ago. I assume that many creators of said programming courses also started at least back then, probably being the reason why the courses are structured in the way the are.
So here I would like to share (the beginning of) my journey from interested kid to CS PhD. This might end up as some sort of boring, archaeological curiosity but I still hope I can share at least some funny stories, pictures and lots of links (you notice all the highlighted words, right?).