# SciRuby projects for Google Summer of Code 2015

Another year with SciRuby accepted as a mentoring organization in Google Summer of Code (GSoC)! The Community Bonding Period ended yesterday; the coding period officially begins today.

I’m really happy with the projects chosen this year; various different subjects and some would be really useful for me, i.e. Alexej’s LMM gem, Sameer’s Daru and Will’s changes to NMatrix.

That’s all. After the next GSoC meeting, I should write about how each of the projects are going.

Searching for your tools when you need to use them is bad organization.

Having a standard set of tools is a good thing. I have two toolboxes in my house, one for electronics and another for “hard” tools.

A voltimeter, a Raspberry Pi and an arduino.

With that in mind, I decided to list the technologies I’m currently using at work. Some of them will be listed with a * to indicate that I’m still testing & learning about it.

• Machine – 2013 MacBook Pro, OS X Yosemite.
• Text editor – vim. I’ve been using it for a year and a half with no intention of switching over to another editor. My vimrc file is on GitHub.
• Programming languages – Ruby for data cleaning and other pre-processing tasks & Python for building models and preparing results for presentations. I’m working towards using only Ruby, but IRuby, Nyaplot and Daru still need some work before that is possible.
• Pry is much, much better than the default IRB console. Being able to look in objects contexts everywhere is underrated, you only notice how powerful this is after spending a few minutes to find a bug that would otherwise have taken 1 or 2 hours. Besides, pry-byebug allows you to use a decent debugger, with breakpoints, nexts and continues.
• Libraries
• SmarterCSV is quite good for handling CSV files. It has features for reading batches of rows, so bigger files are fine. Its interface is really simple, so I tend to investigate new datasets via  irb -r smarter_csv. For simpler operations, like projections or joins, I prefer CSVkit (as a matter of fact, implementing csvkit in Ruby with SmarterCSV should be a piece of cake).
• Nyaplot [*] is a great plotting library when used with IRuby. It is very easy to generate interactive plots and there is even an extension for plotting on top of maps, called Mapnya.
• Pandas for joining and grouping data in notebooks. There is a similar library in Ruby called Daru [*] that I still haven’t had the chance to try.
• Scikit-learn for building classifiers and doing cross validation easily.
• Matplotlib for plotting when in Python land. There are some niceties like allowing LaTeX in titles and labels and using subplots and axes.
• Jupyter notebook are amazing for presenting analysis and results. One of the SciRuby projects is the IRuby notebook, by Daniel Mendler, which brings the same facilities available in IPython to Ruby.
• GNU Parallel – This is probably the single most useful tool in the list right now. I’m not dealing with large datasets; the largest are a few GBs in size. Instead of booting a Hadoop cluster on AWS, I write my “MapReduce” pipeline with a few scripts and calls to Parallel.
• Julia Language [*] – I wrote a few number crunching scripts so far, but there’s a lot of potential in Julia. I hope to have something cool to show in some weeks.

And that’s it.

# Deep copying objects in Ruby

Time and time again I forget that `Object#clone` in Ruby is a shallow clone and end up biting myself and spending 30 seconds looking at myself asking what the hell happened. The only difference today is that I decided to finally post about it in my blog – let’s hope this time is the last.

## Well, what is a deep copy?

In C++ there is the concept of a copy constructor, which is used when an object is initialized as a copy of an existing object. In many situations this can be deduced by a compiler and you don’t have to worry. If your object contains pointers to things that can’t be shared, however, you have to provide what is called a user-defined copy constructor:

A user-defined copy constructor is generally needed when an object owns pointers or non-shareable references, such as to a file […]

— Wikipedia on Copy Constructor

In Ruby, variables have references to objects. If you want a clone of that variable (e.g. an `Array`), you can simply do:

This works because numbers are singletons, so you’re not passing references around (when working in 64 bits, the Ruby interpreter inlines Numeric objects for most operations as well). But if you have other arrays or hashes instead of numbers, things start to break. You don’t have the object, but a reference to it, thus when you do:

This kind of bug can be hard to understand when first encountered, so it’s definitely a good thing to have in mind.

I was in the middle of implementing what I just explained when I noticed I was reinventing the wheel. Turning to Stackoverflow, I found an answer similar to what I was doing and another, simpler, more interesting and applicable to my specific situation:

Duh. The Marshal library is a tool for storing objects as bytes outside of the program for later use. I’ve never had to use it before, as the only apparent use case I have (storing trained statistical classifiers) can be achieved more robustly by saving parameters in a JSON.

But I digress. By storing the object’s data as a byte stream and reconstructing the same object afterwards, you create new copies of each of the constituent objects.

However, there are two problems with this approach:

• Some objects can’t be marshalled. You’ll need to implement marshalling logic yourself, which kind of defeats the purpose of using this technique: why not implement deep copying instead?
• It is slow. In some cases this doesn’t matter. I was building a small simulation in which I copied an Array with less than 100 Hashes at each iteration and there were less than 2000 time steps in total, thus resulting in maybe some extra seconds. But for larger scripts this can be problematic.

The second point could be solved by thinking the problem through, but I had 30 minutes to come up with an argument for a point I was about to make in a meeting. I sure hope I never have to do this again (famous last words…)

# Books read in the first quarter of 2015

Covers of the books read this quarter

In 2014, I wrote a list of the books read at the time. This year, I’ll collect the books and papers each quarter.

A curious note: Nassim Nicholas Taleb (author of Black Swan) wrote on Facebook about the paper about eusociality (think about insect colonies like ants and bees). The authors showed that kin selection theory is unnecessary given that traditional natural selection theory can predict this relation, and Richard Dawkins attacked them making no mentions to their mathematical models. I’m no biologist, but the text is very accessible (the math too if you’re familiar with stochastic processes).

## Papers

• AI Planning: Systems and Techniques. James Hendler et al. PDF
• O-Plan: a Common Lisp Planning Web Service. A. Tate and J. Dalton. PDF
• EduRank: A Collaborative Filtering Approach to Personalization in E-learning. Avi Segal et al. PDF
• Discovering Gender-Specific Knowledge from Finnish Basic Education using PISA Scale Indices. M. Saarela and T. Kärkkäinen. PDF
• The Unified Logging Infrastructure for Data Analytics at Twitter. George Lee et al. PDF
• The Evolution of Eusociality. Martin A. Nowak et al. Read online. Supplementary material.

## Mangas

5 Centimeters per Second manga cover

It has been a long time since I read any mangas, but 5 Centimeters per Second is a masterpiece. Read more about it on MyAnimeList.

# The most socially useful communication technology

Text is the most socially useful communication technology. It works well in 1:1, 1:N, and M:N modes. It can be indexed and searched efficiently, even by hand. It can be translated. It can be produced and consumed at variable speeds. It is asynchronous. It can be compared, diffed, clustered, corrected, summarized and filtered algorithmically. It permits multiparty editing. It permits branching conversations, lurking, annotation, quoting, reviewing, summarizing, structured responses, exegesis, even fan fic.

I read the post “Always bet on text” today and, I must say, it is a beautiful way to look at the process of communicating by writing. :)

# Excel trying to take over the world

Intuitively, it is not just the limited capability of ordinary software that makes it safe: it is also its lack of ambition. There is no subroutine in Excel that secretly wants to take over the world if only it were smart enough to find a way.
— Nick Bostrom, Superintelligence

I wouldn’t be so certain about it.

There are “scientists” (economists) who think it is OK to use Excel for making predictions that affect several people, as you can see from this article in The Guardian. Essentially, they didn’t add four years of data from New Zealand to a spreadsheet. Other methodological factors were in effect as well. And all of this contributed to lots of people losing their jobs in various countries when the recommended austerity measures were put in place. Imagine if Excel wanted to take over the world.

The paper that discusses in depth about Reinhart & Rogoff’s mistake is “Does High Public Debt Consistently Stifle Economic Growth? A Critique of Reinhart and Rogo ff“.

# Completeness and incomputability

It is notable that completeness and incomputability are complementary properties: It is easy to prove that any complete prediction method must be incomputable. Moreover, any computable prediction method cannot be complete — there will always be a large space of regularities for which the predictions are catastrophically poor.

— Ray Solomonoff, “Algorithmic Probability — Its Discovery — Its Properties and Application to Strong AI”

This quote is a paragraph from the book Randomness Through Computation, an amazing work I was reading this morning.

The idea that any computable prediction method can’t be complete is profound for those of us that work with machine learning; it implies we always have to deal with trade-offs. Explicitly considering this makes for a better thought process when designing applications.

## References

1. Ray Solomonoff — Wikipedia.
2. Solomonoff’s Lightsaber — Wikipedia, LessWrong

# Books so far in 2014

I have a lot of books.

I’ve finally decided to organize my collection and keep track of what I read. In this post, I’ll list the books I read since January — or at least an approximation given by the email confirmations of the ebooks I bought, my memory and the ones in my bookshelf. I also divided them in sections. Papers are included as well.

# Updates on NMatrix and SciRuby development

For the last couple of days, I’ve been thinking about what I wrote two weeks ago regarding SciRuby and the whole Ruby scientific computing scene. I still believe that the `sciruby` gem can be used as an integrated environment, but there are some problems that must be solved before:

1. We need a reasonably feature complete and easy to install version of NMatrix.
2. A good plotting tool. Right now, Naoki is working on this as part of GSoC 2014.
3. Statistics. Lots of things are already implemented in Statsample, but both `Statsample::DataFrame` and `Statsample::Vector` should use NMatrix behind the hood. Supporting JRuby can be problematic here…
4. Given 1 and 2, it’s possible to implement a lot of other interesting and useful things. For example: linear regression methods, k-means clustering, neural networks, use NMatrix as a matrix type for OpenCV images. There are lots of possibilities.
5. Minimization, integration and others.

With that in mind, my objective for the following weeks is to improve NMatrix. First, there are BLAS routines (mainly from level II, but some stuff from level I and III as well) that aren’t implemented in NMatrix and/or that aren’t available for the rational and ruby objects dtypes. There’s also LAPACK.

Another benefit of having complete C/C++ implementations is that we’ll eventually have to generalize these interfaces to allow other implementations (e.g. Mac OSX vecLib’s LAPACK, Intel’s MKL), thus making it much easier to install NMatrix. As Collin (and, I think, Pjotr) said in the sciruby-dev mailing list, it should be as easy as `gem install nmatrix`.

## BLAS and LAPACK general implementations

• `HAVE_CBLAS_H` being derived from `mkmf`‘s have_header
• Many more routines are implemented. Ideally, BLAS level 1 and 2 should be complete by the end of May.

An important next step is to be able to link against arbitrary BLAS and LAPACK implementations, given that they obey the standard. Issue #188 started some ideas; issue #22 is the original (and very old) one.

## After that…

When NMatrix support both BLAS and LAPACK without a problem — i.e. have its own implementation and can also link against arbitrary ones (OSX’s vecLib, GSL, ATLAS, Intel’s MKL, AMD’s Core Math Library) — we’ll be able to build on top of it. There are some routines in NMatrix that are already working with every dtype, but most of them aren’t. When we know exactly which routines can’t work with which dtypes, we’ll reach a very good standpoint to talk about what we support.

Alright, we have determinants for rational matrices, but not “other operation”, etc. What else? STYPES! We also need to have good support for Yale matrices. (obs: maybe add “old Yale” format?)

There isn’t much to do: we have to support the whole BLAS/LAPACK standard, almost everything linear algebra-wise is in these. After that, it’s mostly improvements to the interface, better method naming, better documentation and examples, better IO, etc.

Another point that would be good to adress is to remove the dependency of g++ > 4.6. We should strive to remove everything that depends on C++11 features, thus allowing normal Mac OSX users to install NMatrix without having to first install another compiler.

## Better documentation

We need to refactor our documentation. Oh, how we need to!

First, remove everything that shouldn’t be in the facing API — the classes and modules used in NMatrix::IO shouldn’t be available in the public API anyway, only the outside-facing stuff: how to save and load to/from each format. Probably more things as well.

Second, do a better job of being consistent with docs. There are some methods without a return type or stuff like that. Lots of methods in the C/C++ world aren’t documented as well. We can do better!

Finally, a really good documentation template. Fivefish is a good choice — it provides a very pretty, searchable and clean interface. (create NMatrix’s docs with it and host on my own server, see what happens).

# Solving linear systems in NMatrix

I’m writing some guides for NMatrix, so in the following weeks there should be some posts similar to this one, but more complex.

Linear systems are one of the most useful methods from “common algebra”. Various problems can be represented by them: systems of linear ODEs, operations research optimizations, linear electrical circuits and a lot of the “wording problems” from basic algebra. We can represent these systems as

$Ax = b$

Where $A$ is a matrix of coefficients and $b$ a vector representing the other side of the equation.

# Gems for scientific computing

UPDATE (20/04): User centrx from #ruby-lang at freenode warned me that I forgot about RSRuby/RinRuby, so I added them to projects.yml.

In Wicked Good Ruby 2013, Bryan Liles made a presentation about Machine Learning with Ruby. It’s a good introduction to the subject and he presents some useful tricks (I didn’t know about Grapher.app, for example). But the best advise I could get is that there’s a lot of room for improvement in the Ruby scientific computing scene.

Having contributed to some SciRuby projects in the last year, I’ve seen it first-hand. With NMatrix, it’s possible to do a lot of vector and matrix calculations easily, if you know how to install it — a task that’s much easier today. There are `statsample` for statistics, `distribution` for probability distributions, `minimization`, `integration`, the GSL bindings and others. But if you need plotting, it can be pretty hard to use (e.g. Rubyvis) or depend on external programs (Plotrb outputs SVG files). Do you want an integrated environment, like MATLAB or Pylab? There isn’t one.

Searching for more instances of people interested in the subject, I found a presentation about neural networks by Matthew Kirk from Ruby Conf 2013, an Eurucamp 2013 presentation by Juanjo Bazán and slides from a presentation by Shahrooz Afsharipour at a German university. If we needed any confirmation that there are folks looking for SciRuby, here’s the evidence.

## What can be done

In order to address these problems, I’m trying to come up with concrete steps towards creating a scientific community around Ruby. It’s obvious we need “more scientific libraries”, but what do we already have? What is easy to install and what isn’t? Should we create something new or improve what we have?

Also, I’m mapping the Ruby scientific computing landscape. I’ve compiled a YAML file with a list of the projects that I’ve found so far. In the future, this could be transformed in a nice visualization on sciruby.org to help scientists find the libraries they need.

If you know how to use the R programming language, both RSRuby and RinRuby can be used. They’re libraries that run R code inside of Ruby, so you can technically do anything you’d do with R in Ruby. This is suboptimal and R isn’t known for its speed.

For an integrated environment, we can revive the `sciruby` gem. For example:

I’m updating the SciRuby repository in this branch. Before creating the above DSL, it’s necessary to remove a lot of cruft (e.g. should use `bundler/gem_tasks` instead of `hoe`) and add some niceties (e.g. Travis CI support). Most importantly, adding dependency to the main SciRuby projects — NMatrix, statsample, minimization, integration, etc — in order to have a real integrated environment without require’ing everything manually. I’ll probably submit a pull request by next week.

We also need to improve our current selection: NMatrix installation shouldn’t depend on ATLAS, plotrb (or other solution) needs to be more usable, show how IRuby can be used to write scripts with nice graphics and LaTeX-support and create a list of all the applications that use our libraries for reference.

The Ruby Science Foundation was selected for Google Summer of Code 2014, thus some very bright students will help us fix some of these problems during the summer. However, there’s a lot to be done in every SciRuby project, if you’ve got the time. :)

## Conclusion

We still have a long way before having a full-fledged scientific community — but there’s hope! Some areas to look at:

• Good numerical libraries: NMatrix, mdarray.
• Algorithms for data mining, modeling and simulations: AI4R, ruby-fann, ruby-libsvm, statsample, distribution, etc.
• Plotting: Rubyvis is a port of Protovis, which was deprecated in favor of
D3js. Thus, we should create some plotting library around a C backend or
around D3, like Plotrb.
• Integrated environment: IRuby together with SciRuby.

Except for plotting, an area that really needs a lot of love and care, most of these are already working, but with usability problems (installation, mostly).

If you think that it’d be cool to have a scientific community centered around Ruby and you do have some time available, please please please:

1. Take a look at the SciRuby repositories.
2. If there’s a subject you’re interested in, see if you can refactor something, add more tests, well, anything.
3. Open issues about new features or pull requests improving the current ones.
4. If you don’t understand much about the subject, but see something that could be improved, do it: is there Travis CI support? Something wrong with the gemspec? Is it still using some gem to generate gemspecs?
5. There’s the sciruby-dev mailing list and the #sciruby channel on Freenode if there’s something you want to ask or discuss.

You can find me as agarie on freenode or @carlos_agarie on twitter.

## References

1. SciRuby. SiteGitHub
2. List of scientific computing projects in Ruby. projects.yml
3. Wicked Good Ruby 2013. Site
4. Bryan Liles: Machine Learning with Ruby. bryan
5. Matthew Kirk: Test-driven neural networks with Ruby. neural
6. Shahrooz Afsharipour: Ruby in the context of scientific computing. slides in PDF
7. Juanjo Bazán: presentation in Eurucamp 2013. juanjo-slides

# A PNG showing differently in Firefox and Chrome

I was chatting with some friends on IM when someone posted an URL to a Psyduck image. In it said “Now open this in Firefox” when opened in Google Chrome or Safari and “Now open this in IE (or Chrome/Safari)” when opened in Firefox.

What.

At first, I though it would be a simple use of pattern matching against HTTP’s User-Agent on the server to send two different PNG files depending on the browser. However, both files had the same size and I couldn’t reproduce it with `curl`. Worse: I downloaded the file and the same behavior was present, so it should be something with the image itself.

I never really studied or read about binary file formats before, so I googled a bit and installed the chunkypng gem. After playing a bit with its documentation, I could see which blocks it had.

Can you see the acTL block? It isn’t in the PNG specification. Why is it there? After some more searching, it was clear that this block is only available in APNG files, an extension to PNG enabling animated images similar to GIF.

The first byte `@content` of the acTL block is the number of frames (only 1) and the second one is how many times to loop the APNG
(source). From the spec, there’s always a “default image” (described by the IDAT blocks, exactly like a normal PNG file), thus this extra frame should be the second Psyduck image.

To confirm this hypothesis, I installed pngcrush with Homebrew and removed the acTL block:

I ended up with an image that will look the same independent of the host browser:

Search a bit more lead me to the cause of the discrepancy: only Firefox and Opera have support for APNG files! From this post in Google’s Products forum and this ticket in Chromium’s issue tracker, WebKit/Chrome doesn’t support the format and probably won’t for some time. Also, from the spec:

APNG is backwards-compatible with PNG; any PNG decoder should be able to ignore the APNG-specific chunks and display a single image.

Take all that and the mystery is solved: when that image is opened in Firefox (or Opera), it’s treated as an APNG and the second frame is shown. In Chrome/Safari (WebKit), the extra blocks are ignored and the default image is shown.

That was fun.

# Cross validation in Ruby

These days I had some data mining problems in which I wanted to use Ruby instead of Python. One of the problems I faced is that I wanted to use k-fold cross validation, but couldn’t find a sufficiently simple gem (or gist or whatever) for it. I ended up creating my own version.

## A review of k-fold cross validation

A common way to study the performance of a model is to partition a dataset into training and validation sets. Cross validation is a method to assess if a model can generalize well independent of how this separation is decided.

The method of k-fold cross validation is to divide the dataset into k partitions, select one at a time for the validation set and use the other k – 1 partitions for training. So you end up with k different models, and respective performance measures against the validation sets.

The image below is an example of one fold: the k-th partition is left out for validation and partitions 1, …, k-1 are used for training.

E.g., if k = 5, you end up with 80% of the dataset for training and 20% for validation.

## The implementation

My solution is a function that receives the dataset, the number of partitions and a block, responsible for training and using the classifier in question. Most of it is straightforward, just keep in mind that the last partition (`k-1`-th) should encompass all the remaining elements when `dataset.size` isn’t divisible by `k`. Obviously, the training set is defined by the elements not in the validation set.

The last part is to `yield` both sets to the given block. Some information regarding the functionality of the `yield` keyword can be seen in another post and in Ruby core’s documentation.

Now suppose you have a CSV file called “dataset.csv” and you have a classifier you want to train. It’s as easy as:

And your classifier’s code is totally decoupled from the cross validation function. I like it.

## Conclusion

I found a gem on GitHub the other day unsurprisingly called cross validation. Its API is similar to scikit-learn‘s, which I find particularly strange. Too object oriented for me.

This code isn’t a full-blown gem and I don’t think there should be one just for cross validation. It fits in a whole machine learning library, though–and I hope to build one based on NMatrix… eventually.

# MATLAB in OS X Mountain Lion

I needed to write an optimization function for college and came across this problem today: if you use OS X Mountain Lion (I think the problem also happens in Lion and < 10.6), your MATLAB should stop working correctly after a Java update that occurred in June. Well, Java.

The problem lies with a bug packed in the Java Security Update released by Apple. For some reason, the corresponding fix isn’t automatically downloaded by the App Store, so we must do it manually1. This bug interferes with MATLAB’s graphical user interface, making it unusable.

It’s pretty easy: go to support.apple.com/kb/DL1572 and download the update. Then, just install and open MATLAB.

Another “solution” is to run MATLAB without its GUI by using:

Where `\$MATLAB` is the installation directory, for example in `/Applications/MATLAB_R2009b.app/`.

Moral: don’t leave some computer-based homework for the last day when it depends on Java.

# On the verge of procrastination

Procrastination is… jumping from an idea to another.
Johnny Kelly

I’m currently procrastinating. And it hurts, much more than it should.

This post is the result of my shallow research on the topic of procrastination mixed with the desire to avoid doing something else (like writing my dissertation).

### Counterproductive, needless and delaying tasks

This triad of adjectives is the constant companion of college students. You try to focus, but an invincible foe keeps pushing you against a wall. Nothing works. You realize you should’ve studied more for that test, and to all the other ones you had since your freshman year.

Inside this whirlpool, you begin to wonder why you were allowed to continue. And then you get anxious because the job market is fucked up and no one is there to help you besides yourself. Competition against your peers. Mostly unfinished tasks multiply. And you miss your first deadline, then you have to talk to a bad mooded professor without a drop of consideration.

Finally, you begin to do something entirely different. Facebook, Twitter, Tumblr — those islands of pure ego — or anything else, really, in order to avoid what you ought to do. At this stage you’re writing lists, large lists, gigantic lists, and then you realize none of them is going to get completed. Ever. And panic strikes.

You feel weak. Now you’ve graduated, and no better situation awaits. Your naïve notion of perfectionism attained nothing but frustration and sleepless nights.

What should you do?

Some researchers1 suggest that counterproductive, needless and delaying tasks are the necessary and sufficient conditions to categorize some comportament as procrastination. I disagree. Sometimes, it’s necessary to “procrastinate” (by doing these tasks) in order to create interesting things. So, when is it bad?

### Misery

A common attribute among procrastinators is perfectionism.

Generally, one is taken as a perfectionist if s/he “tries to do everything right”. A more descriptive set of variables3 include: high standards, orderliness and discrepancy between her/his achievements and standards. The last item is mostly responsible for the problems attributed to perfectionism.

In fact, people who rate high on our discrepancy scale also rate high on scales measuring depression, shame, anxiety, and other negative psychological states.

Robert B. Slaney3

So the troubling situation is if you want to achieve more but can’t actually do it. Then you begin to realize that if you do nothing until the last minute, you won’t be blamed for not having skills, but for being lazy. And you begin thinking this is alright. “I feel more productive doing it the night before, overloaded with coffee”. As far as coping mechanisms goes, this is bullshit.

Can someone escape from this spiral after entering it? Or s/he is condemned to a life of self-hatred, unsatisfied in every waking hour? That’s… a good question. The answer might be in identifying what kind of “mindset” typically generates procrastination.

### Losing yourself in doubts

With important and potentially negative outcomes linked to procrastination, why would a student choose to procrastinate?

Jeannetta G. Williams et al2

I and most of the procrastinators I know of are students, so restricting this discussion to this group isn’t so bad an assumption. (as a matter of fact, we’re pretty good at it).

There are two opposite mindsets2, each very (negative or positively) correlated with procrastination tendency. The first, called mastery-oriented, is defined by a strong desire of learning for its own sake, unconcerned with grades. The second, performance-oriented, is marked by studying to “win”, as the name implies. The latter is obviously much more afraid of failing than the former.

This situation is unsustainable. Getting anxious over the fact — an immutable one, considering a student — that you won’t understand or be good at something is painful.

Another problematic factor is the “big push effect” before a deadline: if you have a semester to do it, why the heck did you wait until the last week?! Coffee, awful nights and a constant fear of not being able to finish, all this due to some afternoons and nights on the Internet, doing nothing.

On the other hand, doing things for their intrinsic value is so much better that there’s a whole area of research devoted to it — the so-called [Optimal Experience or simply Flow](http://en.wikipedia.org/wiki/Flow_(psychology).

### Conclusion

My first impulse to write this article appeared right after I finished “What are BLAS and LAPACK“. Considering that I still have to write lots of things for my senior dissertation, I was procrastinating by writing about procrastination. Wonderful.

I don’t have much to say before turning this into an autobiographic “I was a much worse procrastinator, now I’m just an average one!” or a self-help post. However, I’ve learned a good deal about the subject and it might be useful in some parts of my work. I hope you learned something as well.

During my research, one of the best resources I found was the video below. While not scientific, its rhythm, images and words are stunning.

It’s unsettlingly precise.

### References

1. Schraw, Gregory; Wadkins, Theresa; Olafson, Lori. Doing the things we do: A grounded theory of academic procrastination. Journal of Educational Psychology, Vol 99(1). link.
2. Jeannetta G. Williams et al. Start Today or the Very Last Day? The Relationships Among Self-Compassion, Motivation, and Procrastination. American Journal of Psychological Research, Volume 4, Number 1. October 20, 2008. link
3. McGarvey, Jason. The Almost Perfect Definition. Seen on 08/24/2013. link.

: http://vimeo.com/9553205