Visualizing Algorithms
An anonymous reader writes "Many people reading this site probably have a functional understanding of how algorithms work. But whether you know algorithms down to highly mathematical abstractions or simple as a fuzzy series of steps that transform input into output, it can be helpful to visualize what's going on under the hood. That's what Mike Bostock has done in a new article. He walks through algorithms for sampling, shuffling, and maze generation, using beautiful and fascinating visualizations to show how each algorithm works and how it differs from other options.
He says, "I find watching algorithms endlessly fascinating, even mesmerizing. Particularly so when randomness is involved. ... Being able to see what your code is doing can boost productivity. Visualization does not supplant the need for tests, but tests are useful primarily for detecting failure and not explaining it. Visualization can also discover unexpected behavior in your implementation, even when the output looks correct. ...Even if you just want to learn for yourself, visualization can be a great way to gain deep understanding. Teaching is one of the most effective ways of learning, and implementing a visualization is like teaching yourself."
He says, "I find watching algorithms endlessly fascinating, even mesmerizing. Particularly so when randomness is involved. ... Being able to see what your code is doing can boost productivity. Visualization does not supplant the need for tests, but tests are useful primarily for detecting failure and not explaining it. Visualization can also discover unexpected behavior in your implementation, even when the output looks correct. ...Even if you just want to learn for yourself, visualization can be a great way to gain deep understanding. Teaching is one of the most effective ways of learning, and implementing a visualization is like teaching yourself."
Wonderful stuff. Reminded me of this site: http://www.informationisbeauti... (beautiful ways to view typically boring stuff).
I'm sure this is fun cool stuff to play with but... I'm pretty sure my imagination is still better than what a computer screen can show me. "Playing computer" is one of the first practices most new programmers learn, and if you're good at it, it is one of the most powerful tools in your arsenal.
Here's hoping "kids these days" don't skip out on the importance of programmer's imagination over these new fangled tools.
What you mean if I turn my head, the scenery changes? How unexpected! Who would ever think focus was important ... or choice?
I've always visualized what's going on, this is how I do everything. Doesn't everyone program this way? Think about something for a while, building up the model in your head, then visualize the interactions among the parts. If the problem is too complex to visualize, then I simplify and add abstractions until I can visualize it. This iteration naturally creates simplified abstract layers in my code.
I debug most of my code this way also. When I'm internally visualizing stuff, I lose track of what's going on around me. I wouldn't be surprised if a brainscan would show activity in my visual cortex.
Many people reading this site probably have a functional understanding of how algorithms work.
Humorist.
https://www.youtube.com/watch?v=kPRA0W1kECg
I'm not affiliated with the author in any way, but I did buy the book (though you can get it for free).
This is an amazing resource for someone new to D3.js's declarative javascript and helps you put it all together: https://leanpub.com/D3-Tips-an...
After using D3.js, I've come to the conclusion Mike Bostock is awesome! But it doesn't stop there, people have expanded it like Crossfilter and dc.js.
Tech that allows a javascript n00b like myself to build a simple race results visualization.
It's ironic you post this on this particular article. It highlights how the placement of receptors in your eye effects how you see the world. What makes you think your own in-built bias (apparently culture-jamming) is any less than anyone else?
I drive many other programmer's batty because when they ask me for help the first thing I do is "survey the scene", the code surrounding their point of interest, rather than listen to anything they think or *know* about what is happening. Once I have my bearings, and a basic outlook of the subject matter, I'll hear them out. It may seem 5 minutes wasted, but I've solved many 4 hour problems in 10 minutes this way.
What makes you think I treat the media any differently?
Comment removed based on user account deletion
This is total nonsense.
Algorithms are first _designed_ BY humans. Algorithms can be _optimized_ FOR computers.
Visualization is a way to augment understanding, not replace it.
There are 4 primary ways of learning:
* visual,
* auditory,
* kinesthetic, and
* mental.
Students have various ways that work "best" FOR THEM. Saying visualization is dangerous shows your ignorance about the subject. If you had seen the excellent move Temple Grandin you would understand that not everyone thinks the same way.
in explaining how things really are.
Light is a continuous signal. It must be sampled at an interval to be determined and interpreted. It actually flows like a river. Amazing.
- Zav - Imagine a Beowulf cluster of insensitive clods...
A group I was working with had this strange phenomenon where their windowed machine learning algorithm would just crap out on certain training sets.
A few weeks later, I was presenting my results and casually mention that, hey, the dataset i got is just outright missing 20% of the data, but there's still enough to illustrate the results, next slide. One of the leads asks, "wait. why didn't anyone notice this?"
I had assumed that it was just my dataset. Nope, turns out that the data just wasn't there at all (this was our partner's fault). It's not quite as trivial as it may seem, since it was point data and required some amount of interpolation. It was just that the interpolation script was intended to fill in, oh, a few hours or maybe days, but it was filling in a year or two.
Back on topic, I noticed it at first because I plotted the covariates (apparently I was the first to do this) and noticed that they were rock-still for huge sections. Sometimes the problem isn't with the code, or even the theory. Visualizing fixed algorithms may or may not be helpful, depending on audience and application, but even a crude visualization of the actual problem and data can almost never hurt. If nothing else, it gives you actual slides to show people. Not really knowing what's going into your algorithm is generally a bigger problem than choosing the "right" algorithm. Of course, sometimes the data really is too big/complex to plot, so you have to look at various algorithmic reductions, which can always make things interesting.
Now to try to parlay my apparently rare insights into cash.
"They were pure niggers." – Noam Chomsky
Hmm... Get much performance out of your systems that way? Procedural methods have a time and place, and have given us most of what we have now. Functional methods have given us... A pale, slow, anemic cousin of what procedural has done? (that can't fail in-theory, much like the titanic...)
Honestly, garbage collection did way more for the industry than any other sea-change... Here, was some scut work we could freely let the computer do completely for us. (At least when any kind of hard time-keeping doesn't matter)
I don't see how NOT understanding how computers work is going to make them better. Seriously. (I mean, if you want to skip steps from the design cycle, why not simply use genetic algorithms to implement everything, then you don't need design either and can go strait from requirements to testing and don't need to worry about anything else.)
There's no claim to novelty for any of the algorithms. If you scroll down you'll also see imagery of quicksort: stop the presses, this was invented in 1960. The point is the graphical presentation of existing algorithms. This is all made very clear in the prose, and in the summary, and in the title. So well done Captain Blowhard, top marks for your knowledge of a somewhat related domain (although what you're talking about really has fuck all to do with Poisson-disc distributions) but minus several million for basic reading comprehension failure.
Visualization is also great for evaluating randomness; remember the images of broken RNG implementations a few years ago? http://lcamtuf.coredump.cx/new...
More fundamental CS though: http://www.cs.usfca.edu/~galle...
A 21st century issue: the irony of technologies of abundance in the hands of those still thinking in terms of scarcity.