Showing posts with label Learning. Show all posts
Showing posts with label Learning. Show all posts

Friday, October 9, 2009

What You Have You Keep

The second law of thermodynamics states that in an isolated system, entropy is an increasing function. In his book, Do Androids Dream of Electric Sheep, Philip K. Dick talks about fighting entropy, or Kipple, as he calls it:
Kipple is useless objects, like junk mail or match folders after you use the last match or gum wrappers or yesterday's homeopape. When nobody's around, kipple reproduces itself. For instance, if you to go bed leaving any kipple around your apartment, when you wake up there is twice as much of it. It always gets more and more.

No one can win against kipple, except temporarily and maybe in one spot.

I've found that there is much truth in the Kipple Theorem. Just think of your house, which contiguously gets more cluttered over time. The same also happens to source code, if left to its own devices. It is also true of memory, which gets disordered over time. What was once clear and orderly, becomes obscure and messy.

Over the past couple of weeks, I've tried to always put something back in its place whenever I go from one room to another. When I do this with disciple, my house starts to look much better. A couple of days of slacking off, and the house looks once more like a total mess. And I don't ever remember making it a mess. It's just that kipple does multiple while you're asleep. Unless we take active, continuous action to combat it, kipple will always win.

Source code is no different. It grows smelly over time. No matter what your source control's log tells you, changes are constantly taking place. They make the code more unreadable, make methods more incomprehensible, and occasionally even introduced some bugs in unimportant locations.

The same is true when learning things, such as Japanese. I've studies nearly 400 kanji characters over the last couple of weeks. Unless I take active steps to maintain what I've learned, my neurons start getting all bogged down with kipple. That's why I am very fanatical about reviewing the items in my SRS software every day. Left alone, for even a little bit, the kipple raises its ugly head and starts to take over.

Kipple Fighting 101

When you learn chess, you basically have to study three different stages - opening, middle game and end game. For the opening stage, you basically memorize the known openings, which have already been studied thoroughly. During the middle game you need to understand basic principles and how to implement them. The end game part is usually kind of a mixture of the previous stages: memorize principles for different scenarios.

One of the most basic scenarios in the end-game is the one where you have a king and a rook and the opponent has only a king. It is very easy for you to win now. But, to make things explicit, the guiding principle is to always prevent the enemy from returning to territories from which he retreated. When the enemy king moves, you make sure he cannot move back to where he once was. You corner him into closer and closer areas.

In the endless chess game against kipple, the opposite is true:

What I have, I keep!

This means an endless game of maintenance. You've learned a new word - make sure you review it periodically. You finished cleaning the kitchen - make sure it stays clean. Constant vigilance is the key to winning this battle.

Whenever you go over source code, you will encounter kipple. It is your responsibility to engage it immediately. No matter what your current objective is, you must spend some of your time chasing and destroying the kipple. Otherwise, the kipple will take over the code base, and before you know it, no one on your team has a clue what does what.

Tuesday, September 29, 2009

Learning Japanese - Spaced Repetition Software

Note: this article is part of a series on how to memorize
material. You can start at:
The classical method for reviewing items you have already memorized is using flashcards. The basic technique is to create a flashcard with a question on one side of the card and the answer on the other side. Each day, you'd review several cards. For each card, you'd read the question side, try to recall the answer, and then compare your answer with the one written on the backside of the flashcard. However, this method has a major limitation:
After some time, you'll have a large "database" of several hundred and even thousand cards. It is not practical to review all of them at once. How do you know which cards to review?
 Several better techniques have been developed over time. For example, in the 1970s, Sebastien Leitner developed the system now named after him. Using this method, you'd have several numbered decks. Each time you succeed in recalling a flashcard, that card will travel to a deck with a lower priority. On the other hand, if you fail to successfully recall the card, then that card would move to a higher priority deck.

You would now schedule your reviews according to the priorities of the decks. For example. each day you would review cards from the highest priority deck, every other day you'd review cards from the second highest priority deck and so forth. This better optimizes your time - you would spend less time reviewing cards you can easily recall, and more time reviewing cards that are hard for you.

This was no doubt a major improvement. In the computer age, however, we can optimize this method much further. Computer programs which do this are called Spaced Repetition Software (SRS). The first program, of which I'm aware, that pursued this task is SuperMemo.

The basic idea of all the SRS programs are to schedule cards for review at a time in which the review will have an optimal benefit in entrenching the fact in long term memory. When you first learn a card, it is scheduled for review quite often. After each review, the program asks you to rate how easy it was for you to recall the fact. Using this data, the program can optimize the time for the next review.

The theory is that the best time to review a card is just when you're starting to forget it. If you have to sweat a little to recall the card, but you do manage to remember it, then you'll remember the card for a long time. The idea is to always live on the edge. Never have a feeling that life is easy. As in most things, this gives you great benefits - namely, long term recollection.

I've used a couple of SRS programs over the past few months. At first, I used mnemosyne, which is a cross platform, open source program. Overall the program is pretty easy to use and very streamlined. You aren't presented with too many options, and you can begin using it immediately. It also has many plugins and existing decks which you can download. The downside is that it is not very configurable, which I for one actually like. It was also a pain to install on an old PowerPC mac, but for Intel machines the installation is very easy. Finally, adding audio and graphics to the flash cards is pretty annoying.

After spending around a month away from computers, I found it was very difficult to return to using mnemosyne. This is actually a problem with all SRS programs. The algorithm requires you to use it at constant time intervals for best performance. After using it daily, a month of absence will take many weeks for the algorithm to overcome. That's why I decide to start fresh and switch to a competitor - Anki.

Anki has very similar features to mnemosyne. It also has many plugins and existing decks. However, it looks much better visually, everything about it can be configured, sound and graphics are a snap to insert and it has mobile and online versions. It can even let you synchronize your decks across multiple computers. As a final bonus, it is updated much more frequently than mnemosyne.

I've now been using Anki for a couple of weeks. This is definitely not long enough to get a feel of its scheduling algorithm. It takes many weeks of daily usage before you can start to experience the benefits of any SRS algorithm. From what I can tell, it looks like a really solid program so far, and I'm happy with it.

Further Reading
  1. Learning Japanese - Memorization: the openning article in this series.
  2. Learning Japanese - Vocabulary: shows a nifty plugin for Anki that can really help you learn your vocabulary.
  3. Configurability: what I think of configurability.

Thursday, September 24, 2009

Learning Japanese - Memorization

I've been studying the Japanese language for nearly a year now. I didn't learn as much Japanese as I'd liked to have, but I did learn a great deal about learning.

In a previous article, I listed my early attempt at learning how to memorize. I've learned a lot since then, and I'd like to share it with you. It boils down to three main tips:
  1. Use associative memory
  2. Learn in context
  3. Use SRS software
Associative Memory


The Japanese writing system consists of several "alphabets" used simultaneously. The most famous is the kanji writing system, which is made up of thousands of characters. In order to read a newspaper, you need to be familiar with about 2000 different characters. That's quite a lot of letters to remember.

My initial approach was to learn by repetition. I'd write each character dozens of times and then quiz myself. This method not only takes a lot of work, but it's very easy to forget characters after some time without review. I can say that after about 200 characters, it was getting too time intensive to continue.

I recently started using Remembering the Kanji by James Heisig. The book promotes using our imagination to better memorize.

Each character has a keyword attached to it, and the complex characters are made up of combinations of simpler characters. Therefore, in order to remember the complex "letters", you make up some story that connects the keywords of the simpler letters and the keyword of the complex letter.

The keyword of the simpler characters are remembered using the keywords of even simpler characters. This all goes down until the axioms, sorry, the primitive elements.

It is now very easy to remember how to write a new character. For example, to remember how to write "bull's eye" I just image myself throwing a white ladle at a target and hitting the bull's eye. To commit this to memory, I spend several minutes picturing myself standing all tense, with a large audience watching, the fate of the free world resting on my ability to hit the bull's eye with a shining, white ladle. Now, I know that to the letter with the keyword "bull's eye" is made up of the letters for white and lade.

The serious beginning in the story is in direct contrast to the silly image of throwing a ladle, which only helps burn the story into memory. I try to spend a couple of minutes really imagining the story. I also attempt to make the story as interesting and bizarre as possible, preferably involving as many senses as possible.

So far this technique has been working miracles for me. I intend to finish learning all of the basic 2000 characters in half a year, and I really believe its possible!


Free Resources:
  1. The first few lessons of Remembering the Kanji are available for free.
  2. There is a website where you can read the top rated stories people invented.
Further Reading:
  1. Learning in context - to be written
  2. Using SRS software

Sunday, March 15, 2009

Language Verbosity

I recently took a look at the upcoming C++0x specification, and I was annoyed that yet more keywords were introduced into the language. C++ is already a very complicated language, and it takes months and years to truly master. I just didn't think that introducing more keyword would advance the language. In some sense, the size of a language's vocabulary is a measure of the language's complexity.

My concern is that as the technology advances, it will become increasingly difficult to be proficient even in one single language. The learning curve just becomes steeper and steeper with time, which is fine if you're there when they make the curve steeper, but not if you're at point zero. And I know that specialization happens for all sciences as they advance, but programming isn't a science and a programming language is a tool, not a science (from the user's point of view).

Natural languages (such as the one you talk to your mom with, I hope) are not like that, however. Their vocabulary size increases with time, regardless of the language. Unless your language of choice is Newspeak, of course. Another curious fact about human languages is that they allow one to learn the language, using the language. This might not be too clear, so I'll illustrate:

John Robert Jr IV is 6 years old. His parents speak English (not American, mind you). Little Robert can't understand everything his intellectual parents say, but, by the time he starts his studies in a snooty British college, he'll have already mastered the language. How did this happen? Little Robert doesn't know any other languages but English!

The answer is that one can use English to learn English. This happens because you can understand snippets of code, er, words, and understand the rest from the context and the non-verbal information (intonation, body language, ...). In addition, there are always several ways of saying anything, at different levels of complexity. There are synonyms for nearly all words, some down-to-earth, others only for people with a PhD. in Literature. This is how Robbert will slowly learn new words which better articulate what he wants to say.

Sorry, but we really need to get back to programming languages.

Programming languages are like that as well. C++0x may introduce many new constructs, but you don't really need to use them. When I started programming in C++, I simply changed the file extension to .cpp and continued programming in C. I eventually started using the object-oriented facilities, and after that started learning what the STL really has to offer. So I think there's room for hope. Having different ways of saying the same thing, some concise, some verbose, is actually a good thing.

This is one of the clashing points of two of my favorite languages - Perl and Python. The Perl philosophy is that there should be many ways to perform the same task. Python believes there should be one (see The Zen of Python). And the thing is that Larry Wall studied linguistics. The language he devised may be a write only language, but the basic idea of having many different ways of expressing yourself doesn't just give you the opportunity to make yourself clearer, it also makes learning the language easier. You can learn new tricks as you go along, but it doesn't block you from getting what you want done.

Of course, the above isn't really true for Perl, unless you can remember what $x is for any x, but the potential is there.

Tuesday, February 3, 2009

Learning Japanese

I started studying Japanese a couple of months ago. I decided to register for an intensive course at the local university. There were other places to go to, such as the Japanese embassy, private tutors, specialized companies or just learn it by myself. I'm not too sure why I chose to study in a university.

Ages ago (2003), when I was contemplating what to study, I narrowed it down to three options - Physics, Computer-Science and Japanese (as part of a degree in Far-East Studies). And then I decided the choice was too hard, so I'd take two of the three. The final choice was to study Physics and CS, with the hope of squeezing a course in Japanese somewhere in between. I can't say I'm sorry, even though I never did manage to take that Japanese course.

After finishing my degree, it was only logical that I finally study Japanese. And I guess I decided to do that in the university because that was my frame of mind back then. I did consider the other options, but either they were too expensive, or they were not rigorous enough for my taste. In any case, now that the semester is nearly over, I can say I'm quite please with my choice.

I must say that the learning Japanese is quite different from learning Physics. The entire atmosphere is different. For example, classes are much more interactive, but that may be due to the fact that few people want to study Japanese, but a great many want to study Computer Science (for $ome $trange rea$on). In any case, the biggest difference is that there's a lot of memorizing required when learning a new language. Except some courses in mathematics, I really didn't have to do much memorizing during my studies in the exact sciences.

I've always had a love-hate relationship with memorization. My teachers in high-school kept on saying that it's important to understand concepts, and not to memorize them, and I've spent most of my life agreeing with them. I no longer do. I think that memorization is an important step in the path to understanding. It is also important in itself. For example, any physicist should remember what Planck's constant equals, as well as the value of Boltzmann's constant. Remembering important equations is also very important, because it allows you to solve various problems without breaking your chain of thought by opening a book (or Wikipedia).

My father knows pretty much the entire Hebrew bible by heart. He's not religious, far from it. It's just that his teachers didn't have any problems with forcing people to memorize passages. And I think his teachers had a good point. My teachers also had a good point, but that's how life is.

So, back to Japanese. I've spent the last couple of months having to memorize stuff for the first time in my life (at least to such an extent). I wasn't prepared for it. I tried various techniques. At first, I wrote each new word in a tiny notebook which I intended to take with me everywhere. That didn't workout, mostly because I didn't take it with me everywhere I went (it had a spiral binding, quite uncomfortable in the pocket). I still think it's a good enough idea in most cases, and it certainly works out quite well for my brother, who gave me the idea. My current invention goes something like this:
  1. Buy a bunch of cards
  2. Write the English/Hebrew term on one side.
  3. Write the Japanese translation on the other side.
  4. Add some useful information (for verbs, for example, if it's いちだん or ごだん)
Yes, it may very well be the breakthrough in language study that millions of people have been waiting for. Oh, wait. Someone thought of it before me. Damn.

Both of the methods I tried are okay, but that's pretty much all I can say about them. Of course, I don't rely solely on them. I still think that the best way to learn is by doing, and, as a corollary, the best way to learn to read is by writing. So I write a lot, which is important in Japanese because their alphabet is a mess. A beautiful mess, but a mess none-the-less. The bottom line, however, is that all these methods fall under the category of "memorize by repetition". It's a good, proven method. It just takes up a lot of time, time which I simply don't have (when am I supposed to write that game in Python?).

There has to be a better way. I've started looking into the various tricks of memorization. In high-school, we once got a visit from some sales-person for a private course in improving learning skills, or something like it. She taught us how to remember all the different offices in the government in a couple of minutes. She did this by telling us a story, and I still remember it more than 10 years later. It's based on a simple trick, that is the basis of most memorization techniques.

The basic concept is that we have an associative memory, and we remember the extraordinary. So, to remember a list of things, you just make up some bizarre story that connects the various items. The more extraordinary, the better, especially if it involves as many senses as possible. There are many methods that take this basic idea much further, but I don't know enough about them right now. It's one of the things I've decided I want to learn (yes, yet another one).

And yet, I'm not sure these techniques are good enough for Japanese. There are thousands of "letters", each with several different pronunciations, depending on the context. Most letters have a dozen or more strokes to remember. I just don't know of a better way to remember them than by endless repetition.

So, although it's been a fun post, it's one of the longer ones I've written, and I have to go memorize some kanjis (料利 is especially annoying).

I also have to improve my English writing skills sometime.

Further Reading
  1. Learning Japanese - Memorization: includes many new lessons I've learned since writing this article.