As I was explaining Morse Code to a young mind, I started thinking. It is fine to explain the encoding and uses, but experiencing the audial component makes the lessons stick better. Enter F#. Yes, I know I could use any of a hundred phone apps or websites that produce sound, but what’s the fun in that? For me, this is the perfect opportunity to hack out a quick text to morse code translator.
My recent post about Dynamic Time Warping used an external library. It inspired me to implement the algorithm in F#. This is mostly just to see it in F#. My last implementation was in Racket, and I’m interested in the different language implementations. I use a pretty basic Algorithm, nothing fancy. As part of this process I’ll be doing comparisons between NDtw and my code. To be upfront, its not a perfect comparison. NDtw has additional options and tracking that will reduce it’s max performance capabilities. But for hacking around, the implementations will be close enough for alittle fun. For anyone interested, unless otherwise specified, all of my results will be from the REPL in VS Code + Ionide using Mono version 4.6.2.
Today I look at using F# with the NDtw package. This is so I can play with some dynamic time warping. In case you’re not familar with DTW, the TLDR version is that it is a method to compare timeseries data that can differ in frequency. This allows for a more nuanced data comparison that can capture shifted, compressed, and extended patterns. It’s a fun little algorithm to use and worth reading more about.
First things first, the data. Rebrickable has downloadable datasets for Lego sets and pieces. I’ll use the
sets.csv file as the primary dataset driver, but will grab information from
colors.csv for feature creation. The files are not in an format appropriate for a decision tree, so some transformations will need to happen first. I don’t want the post to get too long, so this project will be broken into two components. Part 1 will be building the feature file and getting the data into the desired comsumable format, Part 2 will actually use the file to get to the end goal.