Underwater groundwater device that allows you to determine where there is groundwater using everyday equipment. Useful for digging for wells in your backyard. Project from Science Hack Day 2014
The Levenshtein Distance problem, also known as the edit distance problem, is to find the lowest cost path to turn one string to another string. It is commonly used in spell checking, Google search results for ādid you meanā¦ā, and DNA sequencing (Bioinformatics).
An easy example is if you misspelled āwordā for āwirdā, there would need to be one replacement to get from āwirdā to āwordā (change the letter āiā to āoā). There is one algorithm that answers this problem efficiently, as we now of right now. This algorithm compares one letter of the first string to all of the characters to the other strings and gives it a ranking or a score. There are three ways you can modify a character, by inserting another character, deleting, or replacing that character. Each of these modifications cost one value.
Typically, you will see this as a matrix, as shown above. The first row and first column show the length of the strings. The rest of the matrix is filled out following that you do a nested for loop, taking one letter at a time for the first string and go through the rest of the letters in the second string. Hereās a quick look with Ruby:
(1..second.length).each do |i| (1..first.length).each do |j| # Do your logic here endend
We traverse this matrix starting at [1][1] (one square diagonal of the top left square), and move to our right until we get to the end of the matrix. Then we continue to the next row and go back to 1 (matrix [2][1]). We place a conditional in our code. If the letters we are comparing are the same, then there is no cost penalty and we take the same value as the diagonal on the squareās top left. However, if it is different, we take the minimum cost to each of our modification choices.
Insertion: When we insert a letter in our first string, that shifts our word column, so we take the same value as to the square to its top, plus 1 for an additional modification cost.
Deletion: Same as insertion, but we take the value of the square to its left
Replace: We take the value of the upper left to the square and add 1 to it.
The result is at the bottom right corner, which will tell you the minimum cost of changing one string to another. If the score threshold is low enough, Google will ask you, ādid you meanā¦ā if the search ran through the algorithm and could match a more common search term.
A side note
My coding club looked at this algorithm with no prior knowledge of this problem and tried to understand it. Now that Iāve taken the time to review this, I have a much deeper understanding of this now.
Resources
Levenshtein distance implementation in different programming languages
MIT course on Algorithms: Levenshtein distance problem explained with dynamic programming
Iāve reached the end of my DBC experience and am currently going through career week right now. Iām glad, and yet sad, my nine week experience here in Chicago DBC is over.
Itās still a bit too early to see the outcome of this program on me, which may take months, and even past my first job. But here are some takeaways I learned about myself while doing this program.
I really enjoy leading a team
Thereās always lots to learn on the āsoft skillsā
Taking feedback isnāt easy work, but that doesnāt mean you should ignore it. Embrace it and act rationally.
Itās perfectly fine to cry in a room of adults, even if youāre the only one doing it.
As adults, we forget all too often that we really try hard to hide embarrassment in front of others. Stop worrying about that. If they talk about you, whatās the worst that could happen?
Iām by far not the first person to blog about my experiences at DBC, and I can not do it justice in one blog posts. As I learn more about myself and what has really been the most telling things that I should have been working on all along, Iāll share it.
Remembrance is the final project of Dev Bootcamp Chicago students Simon Gondeck, Francisco Scala, Jeremy Wong and Jonathan Young. It is a web application that enables one to create a memorial for a loved one who has passed on. You can invite friends and family to come together here and share memories, whether they be stories or pictures.
Hi! This is week 2 of my harrowing escape to bootcamp at Dev Bootcamp (DBC). Itās around this time where my cohort and I are finding our standing after mock assessments. The hardest part is to really catch up to the material because so much is thrown at you everyday. However, thatās also a blessing in disguise because this is training my brain for more difficult challenges ahead. Because of the enormity of work over the past two weeks, Iāll cut it short here. Hope everyoneās had a happy fourth of July.
After a tiring day, I can find humor with that man giving a hand to the bird while Cinnamon Toast Crunch sprinkles from above
This week completes my first week at Dev Bootcamp. Itās been a whirlwind of emotions, from the very beginning on Monday morning to my very frustrated work solo yesterday. Here are some takeaways that I had.
Pair programming is a lot better in person than remotely
When youāre frustrated with what youāre doing while your pair gets it, you have yourself a teacher
Vice versa also works because you become the teacher when you get it and your pair doesnāt
Remember to pseudocode: too much effort was wasted not planning how the code will look like because you can waste time with an approach in your head that actually wonāt work
The energy at the place is just exhilarating. Literally, I think Iāve hugged more people in this past week than in any other time frame of my life. At the end of the engineering empathy sessions and sharing whatās going on in your life in a comfort circle has brought me to confront my emotions.
That frustration will pass, even though that inner voice mother fucker canāt shut up when youāre in it
The science behind cramming takes a look at how memory works. Iāve talked long and hard about this topic before, but I never really made this explanation easy. I still will probably fail, but not as hard, as explaining how we learn.
Memory
You can break down the process of sensory input and memory in this linear fashion: sensory input -> sensory memory -> short-term memory -> long-term memory. The image below describes in verbs whatās going on. The last box, retrieval, talks about how we bring back up a memory.
With encoding, weāre looking at the things that weāve decided to turn into a memory. This has a high importance because this will determine if we retain information or not. If we donāt encode it correctly, we will screw our efforts in learning something. This encoding method is constrained by working memory, which is 7 +/- 2 chunks. This means in our attention span, weāre only going to be juggling only this many chunks at a time. We can think of our attention span as RAM. Chunks here does not mean 7 characters and can take many forms that we can manipulate. For example, one chunk can be a phone number, it can be a word or a phrase, it can be a pneumonic.
With working memory as our constraint, we consider this a drawback from learning faster. This means weāre not going to process more information without properly going through the rest of the memory process beforehand. However, methodology is important here about how to space each session of this working memory. For example, each chunk of information can be mixed and combined with each other using association and serial position effects. Association with existing knowledge in your long term memory could save you time in remembering something, which is important when learning concepts and ideas, especially something that begins abstract. For example, remembering someoneās name is difficult because you havenāt placed it further that your sensory memory. A name is difficult to recall after the first meeting because itās an abstract construct in our mind. If you try to associate it with another friend who has the same name, it will be easier since that name is already encoded in your mind. You donāt have to necessarily associate it with another person either; it can be an inanimate object or a koan. Serial position effects will allow you to group things in the order you received the information. For example, youāll have a better time remember the items of a list in the first and last positions than the middle. If the list items are closely related to each other in the beginning and the end, youāll have an easier time associating these words and merging chunks together. Thereās other effects you can try to pull with lists as well, like the Von Restorff Effect in which you place a unique signifier in the middle of the list, like a curse word or something that doesnāt sound right.
Thereās a time constraint with encoding, which is about a minute, before you forget this information. Thatās why proper spacing in terms of attention span and new information is critical. The best methods out there for this is the Anki method, which uses this data of how often weāll forget something and make you recall it afterwards. This is best for things you can put on flash cards because you can recall them anytime after using a timer. Many applications are built around this method. My personal favorite is Memrise on Android that really helps with language learning vocabulary. Other ways of approaching the time constraint is utilizing breaks, which is why coding marathons are not as effective as someone taking breaks in between coding sessions because of fatigue and attention span. What really utilizes this well is the Pomodoro Technique, which introduces breaks in your sessions of work properly.
Not everything is a flash card though. Sometimes the abstract needs remembering, and flip side answers in flash cards just wonāt do. This is when you take different approaches, like R-mode first followed by a switch to L-mode activity. I mention R-mode here, but this does not mean right brain. If you split the brain in two different processes, thereās L-mode and R-mode and has been given other names by other scientists in different fields. For example, Daniel Kahneman thinks these as system 1 and system 2. I wonāt go in heavy discussion about this because thereās a letter I wrote over a year ago explaining this in full detail. Now that we have that down, this activity that you do pairing each process with an activity is important. One activity is something Iām currently doing with you, which is recalling all of this information and trying to teach it to you. Other ways include doing the operations if your learning something that involves motor skills (e.g. just climbing before you get climbing lessons from an instructor), using metaphors to describe what you learned (really neat way of pairing two things that donāt seem to mesh well, pair programming, and a general exposure to a foreign language spoken to you in a dark room (see Lozanov Seance).
The conditions in which we learn is also critical. Your well-being can influence the efficiency on how you learn. This is heavily tied with the amount of rest you receive each night (duration and the number of REM cycles are really important here) and physical and emotional fatigue.
Then we arrive at storage. Our brain is not an efficient storage system, so weāll issue lags in memory for certain things we think are easy to recall, like birthdates, names, that title of the song you heard earlier. Your R-mode side of your brain will run this tasks with your unconscious riffling through each thing until it finds what itās looking for. This is the effect experienced when your in the shower and you finally figured out the name of that song you heard.
One way memory athletes have approached this issue is by the Method of Loci, also known as memory palaces. This is where you take a familiar room or space in your mind and fill it with things to remember by using unique signifying objects. This technique is really powerful and can help you remember a deck of cards (which is correlated with counting cards in a casino) and in general skill acquisition operations. You have to go back a step and re-encode your memories, but having this visual memory palace could remain as one chunk and youāll be able to recall things a lot easier in a class (using the programming analogy here).
Lastly is retrieval. Iāve talked extensively about skill acquisition, heuristics, and snap judgments before. As aforementioned, there are two ways of approaching retrieval, which is the slow process and fast process. The fast process are heuristics, or snap judgments. The slow process takes longer and you start to stretch your mind looking for more credible answers. Fast processes are stimulated by the external inputs, which can lead to some nasty outcomes (Read: Blink by Malcolm Gladwell). Whatās important here is that if you slow down that reactive side of thinking, youāll be able to think more clearly about certain decision points in the learning curve a lot better. And yes, go back to the letter about learning curves if you want to hear me talk more about that as well.
So to the question at the beginning, how much can you cram in one day? This depends on your method of cramming. For myself, Iām working on taking breaks and using other methods to properly encode it in my brain.
From studying philosophy last year, I thought this may actually be important, since it helps create a foundation of who I am and what I do. I previously thought that philosophy majors were different, and belonged to the Starbucks barista clan who may eventually become academics, or something. I couldnāt imagine there would be some practical work in this field; I thought philosophers historically would stand around in a long robe pondering questions. This image, for example, doesnāt help me visualize what they do besides loft around and think.
The School of Athens by Raphael
The School of Athens by Raphael, Courtesy of Wikicomons
This is āThe School of Athensā fresco somewhere in Rome (or Vatican City). If you look at the center two people, you already know who they are. On the left is Plato, and the right is Aristotle. Because they just look like street bums having a discussion in their robes, I just assume theyāre āphilosophizing.ā This doesnāt paint a good picture of what philosophy is to me.
It wasnāt until I started to look into this BBC series by Alain de Botton called āPhilosophy: A Guide to Happiness.ā If you want to check it out, the whole series is on youtube, and this link will direct you to episode one. I thought of this as philosophy thatās practical because we can relate these concepts back in our lives and realize itās all just a game of self-help over the last two millennium. Well, thatās an over-simplification, as well as my explanation of why Iām so interested in philosophy, but these simpler wordage will have to suffice.
Now you must be wondering why I took an interest in this after I took a philosophy class at Cal Poly. Well, thatās because the teacher was dry and I thought Socrates was crazy after reading the Republic (oh come on, philosopher kings?). As well as you know, I dove deep in this realm for two weeks and came to a much better understanding of myself. After finishing this BBC series, as well as doing a āGreat Coursesā course on the history of philosophy, I figured Iād take the best parts of what Iāve learned and integrate it into my own philosophy I can follow. Itās scattered, like when Conner (Chad) came up with his own religion during our Freshman year.
Iāll keep it short: The way I want to answer my own question is by asking myself āHow do I want to live?ā or āWhat is required for me to have a good life? I abide my my own rules, which is just stolen or āwell-adaptedā from our great thinkers. I value in my own personal philosophy the following things: critical thought, kindness and care to others, respect, finding meaningful purpose in what I do, as well as what I say, keeping myself balanced, and to expand my knowledge. These elements should allow me to answer some of those prickly problems addressed by many philosophers: knowledge, conduct and governance. In the end, itās about what is a good life, and many philosophers had so many ways of answering this. And I think from what I said before, and to continue doing those things in the future, I have, and will continue to have, a good life.
Every so often, I read too many books in a short amount of time. I thought it would be beneficial for folks to hear me out and see what they think of the books Iāve read.
The Cuckooās Calling, by Robert Galbraith
This is the latest novel by J.K. Rowling under the pseudonym Robert Galbraith. This is a fiction crime novel set in modern day London following private detective Comoran Strike. The novel is about the murder of a young, rich model who dies in the middle of a winter night. At first, the press went head over heels that it was a suicide, but the private detective is brought to the case when the brother of the murder victim wants it re-investigated because he thinks it is a murder. This is supposed to be the first book in a series, and unlike Rowlingās Harry Potter series, is a lot more adult. Thereās crime, violence, sex, and a whole lot more cussing than youāll hear from one of the students at Hogwarts. Thereās also themes of how the rich operate and enjoy their lives, and Rowling really shows how they are disgusting in their own right. Worth an airplane read, though itās nothing groundbreaking. The book kept me in my seat, making me think who the killer was.
The Willpower Instinct by Kelly McGonigal
This is my self-help book of the quarter. Itās about how our willpower works and itās a practical guide in changing habits and really utilizing willpower without being drained. Itās highly interesting and brings on a ten-week plan. Itās been used by the bookās author, Kelly McGonigal, and the class she teaches undergrads and others at Stanford. Iām going to review it later and see if I can actually change one of my habits through this program. Iāve tried some of her suggestions before, but now I know more of the science behind it. If you want a primer to this, I recommend her talk @Google.
Foodist: Using Real Food and Real Science to Lose Weight Without Dieting by Darya Pino Rose
I donāt need to diet. But I do enjoy reading about a good, healthy living style. Some deviations from other diet books is that this book doesnāt actually talk about which diet to take. Instead, it uses science to back itself up that we should all have a good food foundation because diets tend to be shortcoming success, but relapse rates are quite high. Instead, this book raves about eating healthy from the beginning of your food adventure through more vegetables and try to gain the habit of cooking for yourself or making better food choices. Youāve probably seen me reading this book before, but now Iāve actually finished the darn thing. I didnāt learn too much except the author calls this new diet, which isnāt a diet, healthstyle. I think I like this neologism.
Kitchen Confidential by Anthony Bourdain
If you enjoy eating at restaurants, donāt read this book before you eat at one. It may make you feel bad. But this book is really important to my understanding of the fame around Anthony Bourdain, particularly why heās so goddamn famous. The Food Network loved this book so much, they gave Bourdain his own show called āNo Reservationsā where he went around the word to eat at various locations. The reason heās so famous now is that he gets the lifestyle everyone wants; he gets paid to eat and critique. Hereās the thing though, this book is before that era and describes his upbringing, his hardships in the restaurant gig, and heās eventual success in that domain. It describes someone in their craft and love for their job and how they grow into that role, which was not innate but from shear brute force over years of being on the line. Thereās another book I highly recommend called āLife, on the Lineā by Grant Achatz who describes his time being a line cook as well. Thereās this common thread where you work your ass off being in the position that you get to as head chef, and itās horrifically difficult. But I want to adopt this drive and try and figure out how that can apply to my life. If it wasnāt for this period in my life, I probably wouldnāt be as fascinated at this. But I love someone who has their craft down and can still learn something, as when Bourdain describes his first time eating in Tokyo by the end of this book. A film I highly recommend about food craft is āJiro Dream of Sushi.ā
The Wonderful Wizard of Oz by L. Frank Baum
Iām surprised this book is over 100 years old. Iāll be honest. I had no reason to read this childrenās novel except that Audible has it for quite a cheap, low price. And it was narrated by Anne Hathaway, actress of āThe Princess Diaries,ā āThe Devil Wears Prada,ā and āBrokeback Mountain.ā Itās interesting to notice the little differences from the film, even though I donāt think I ever saw the film all the way to the end. Also, I donāt think I actually read the book before, but know the story pretty much by heart. Itās still a delightful read and itās incredibly short, but long for a child. This actually brings up whether I should actually read Wicked about the Wicked witch of the west that is killed pretty early in this book. This also may be the first mention of munchkins. I may read āThe Hobbitā next because Audible has daily deals. Or else Iāll just finished the fucking bible first. When I do finish the bible, Iāll definitely give you the low down and we can snap at all of those fundamentalists.