home
on exploration, introspection and creation

Archive for the ‘whatis’ Category

What is Intelligence (part II)

Sunday, October 10th, 2010

Let me try something dangerous and talk about intelligence without really defining it; there are many different kinds of intelligence and the arguments here will hold for most definitions I can think of. The necessary requirement is that intelligence is an emergent property of individuals (not necessarily humans; not even necessarily biological life forms but for now constrained to life forms in general–in the sense of mutating auto-replication and pursuit of survival) that allows them to adapt to changing conditions on an intra-generational scale (evolution, for example, is a mechanism for adaptation on an inter-generational scale). I believe (though, quite frankly, haven’t thought hard about it) this is sufficient to go on.

Is intelligence a necessary artifact of evolution? To expand on this, what set of circumstances make intelligence a much more desirable trait than other traits, and how likely is intelligence to emerge? Evolution deals with randomness — it’s a greedy random walk, favoring changes that increase the species’ chance of survival. What makes intelligence better than, say, a stronger set of legs? I have two theories. First, as life forms evolve and strengthen their physical characteristics, it becomes inefficient to continue the physical growth; either it leads to massive energy needs which begin to outweigh the individual’s abilities to gather food, or it leads to side effects inherent in the mechanics of a body (stronger legs may lead to worse injuries). Evolution, essentially, runs out of avenues to pursue and non-physical development becomes the most energy-efficient. Secondly (now I realize the two theories are related), evolution’s greatest limitation is its speed — it must act over generations; and with complex enough organisms the generation cannot be very short. If the natural circumstances favor quick adaptability (for example, a series of ice ages come and go too quickly for any single species to evolve around them), evolution must replace itself with intelligence.

Of course, I may be wrong and intelligence could just be a fluke.

Regardless, if I wanted to have a particular characteristic evolve, I could manufacture a world which favors that characteristic and watch nature come up with it through a process of evolution. In the extreme, if all I had was plants and wanted the species to be able to walk, I would provide incentives for the plants to displace themselves (maybe an ever-moving source of food). Early species will probably simply grow fast, or maybe have the ability to detach themselves from the soil and attach themselves back, propelled by wind. Ultimately species would develop self-propulsion (I could help them by providing a negative incentive to simply go where the wind takes them). Nature would “cheat” and use water as an interim medium — it’s easier to be able to walk if you are already swimming — and so we can see how ultimately we would have species able to walk.

Similarly, what would I have to do to favor intelligence?

I did make an assumption that the life form evolves, that is, life replicates itself (a “species” composed of a single individual that doesn’t die cannot evolve) with mutations between successive generations. In order for evolution (that is, a long-term progression) to take place, there must be survival of the fittest, and with it, the favoring of life to non-life by the individuals. That second assumption is interesting because I’m not quite sure how it came about and why it holds true for species. With intelligent species such as humans you could make an argument that the will to live is an outcome of consciousness — a constantly running narrative of our life, created thanks to the development of memory and the ability to make connections (non-intelligent species have memory but they can’t connect it into a narrative) — but for all other species, it’s not so black-and-white.

It’s, obviously, just as fascinating to talk about why intelligence exists as how it exists — I think that we tend to focus too much on the latter and not enough on the former (and the theories above are just a small step towards that thought). But, on the how, we can learn a lot just by drawing a parallel between it and other non-mental features of evolution. Intelligence requires the environment — and with it sensory inputs and the feedback element with the environment. Intelligence is a wonderful example of a (relatively — all purists calm down) binary characteristic that nevertheless came about gradually from non-intelligence (just as flight came from non-flight; the outcome is clearly distinct but it’s not immediately clear how non-flight evolved into flight).

The structure of elevenseconds.com

Tuesday, September 21st, 2010

I tend to favor building to buying when I want to learn something, so when I first started constructing the main site elevenseconds.com I thought of building myself a small Rails-like framework. The main difference would be that it would apply to a simple principle of just-enough abstraction layers, that is, I would introduce a new abstraction layer when I left that the cost of maintaining the current code was too high. I am currently pretty happy with the structure of the site, although updating the front page takes a bit of time so perhaps it’s time to introduce a new layer of abstraction.

At a high level, all requests go to an index page

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.cgi [QSA,L]

which grabs the desired page to be visited from the URL as well as the subpage option (I thought it would be cool to separate the option with a colon — I never liked the questions marks and ampersands, and overloading slashes for paths and parameter separations never agreed with me. And so http://elevenseconds.com/photography/italy:slides takes you to an index page which knows to display a page called photography/italy with an option of slides.

Most of the pages are very similar so I put in place a kind of Metacontent-Metaview paradigm: every page request will fetch content from the /content/ directory. The ruby files there are organized in the same hierarchy as the URLs, so the above link will fetch content from /content/photography/italy.rb.

The actual content file is very configuration-like; let’s take a look at a part of the main content file (root URL resolves to /content/main.rb):


append = []
append << rendering('text', {
  'x'=>1,
  'y'=>0,
  'text'=>'<img src="/images/ui/whatis.png"/>11seconds: on exploration, introspection and creation'
})
append << rendering('verticalLine', {
  'x'=>1,
  'y'=>2,
  'size'=>3
})
append << rendering('imageWithCaptionOnRight', {
  'x'=>1,
  'y'=>2,
  'link'=>'http://blog.elevenseconds.com/trends/',
  'src'=>'/images/thumbs/main/glogo.png',
  'text'=>'trends'
})
append << rendering('imageOnRight', {
  'x'=>1,
  'y'=>11.5,
  'link'=>'/pictures/glowdoodle',
  'src'=>'/thumb.cgi?im=/images/pictures/glowdoodle/sadterminator.jpg&x1=197&y1=74&ss=344',
  'id'=>'projects',
  'text'=>'glow doodles'
})
render('main', {'append'=>append})

append is really a collection of items to append. Each item is a rendered view with some parameters. Each view is simply some HTML markup with Ruby inline code. For example, imageOnRight.rb contains

<div class="rightOfLine" style="left:#{x*35+2}px;top:#{y*35+69}px">
  <a href="#{link}">
    <img class="image" src="#{src}"
      onMouseOver='caption("#{id}", "#{text}", "#{link}")'
      onMouseOut='caption("#{id}", "", "")'/>
  </a>
</div>

(To make the page more structured, I decided on absolute positioning — maybe that’s because I’m a bit of a control freak.)

Note that I’m not quite allowing hierarchical content — there is no need for it given the current design of the site. All I need to do is a two-level hierarchy: a main view (the last line in the main.rb file above may include a bunch of other views.

I needed to introduce another abstraction because a lot of the sites with photography looked the same and I saw myself writing the same code over and over again. So I wrote a function that displays a generic set of pictures. Take our italy.rb content page:


category = 'photography/italy'
caption = 'italy june 2010'
images = [
  ['italy-0', true, '115, 45, 305'],
  ['italy-1', true, ''],
  ['italy-2', true, '296, 20, 54'],
  ...
  ['italy-45', true, '117, 75, 85'],
]
append = []
append << generateSeries(images, category, caption, [534, 356, 2.42])
render('main', {'append'=>append})

The above specifies the absolute minimum that is needed to render the Italy photographs — a definition of each images (I don’t always just number them in sequence), with a specification of whether the image is in landscape (true) or portrait (false) mode, and the top-left coordinate and the size of a window which will be made into a thumbnail. If not specified, the function chooses a smart default.


$explore = [
  ['http://www.gagneint.com/Final%20site/Animation/Sensology/Sensology.html', '/images/thumbs/main/sensology.png', 'sensology'],
  ['http://js1k.com/demos', '/images/thumbs/main/js1k.png', 'demos'],
  ...
]

I do the same with the front page — since it’s mostly made up of a bunch of links, I define each (in the example above, all I need for a link is a URL and a thumbnail picture) and then just cycle over the array. I only look at the latest 10 images for each category (except for EXPLORE which gets 20) but when you click on the link you get them all (http://elevenseconds.com/detail:explore) — again, code reuse.

As the content gets more streamlined (and as I get more lazy), I’ll probably go a step further towards configuration and just define everything in some standard configuration format like JSON (XML may be human-readable, but it’s certainly not human-writeable!). My goal is not quite to minimize the number of characters that I type (because then the conventions at play will no doubt be too obscure, plus the amount of plumbing code I’ll have to write too much for me to remember what I wrote in a year), but I’ll want to get close to it.

The thumbnails are also pretty painless. The utility page, thumb.cgi, generates a thumbnail out of any picture. You just need to specify the top-left coordinate and the size of the window to made into a thumbnail, and the resulting size. Most thumbnails on my page are 32×32 (it’s a kind of hallmark of the site). Some are 67×67 (not 64×64 because I want the images to line up — two 32×32 in a row actually take up ((1+32+1)+1+(1+32+1)) = 69 pixels because of the border and the one-pixel gap so to replace it with a bigger picture means it needs to be 67: (1+67+1)=69.

thumb.cgi saves the autogenerated thumbnails in a cache directory so that the images don’t have to be scaled each time the page is loaded. That is, when thumb.cgi is called with the same arguments again, it will just bring up the saved thumbnail instead of resizing and cropping the picture:


# by default output png unless the target size is specified
format = cgi.has_key?('sc') ? 'jpeg' : 'png'
hash = Digest::SHA1.hexdigest(ENV['REQUEST_URI'].to_s())[0..7]
cacheFile = "cache/" + hash + "." + format
if(File.exist?(cacheFile))
  puts cgi.header("image/#{format}")
  file = new File(cacheFile, "r")
  puts file.sysread(20)
  exit
end

But (great example of just-enough abstraction layers), I go even further: instead of having thumb.cgi do the logic, I replace the source of the image when rendering the view with its cached image. That way I don’t even have to call thumb.cgi which significantly speeds up the page load:


def gen2cache(html)
  source = html.clone
  links = []
  while(source =~ /"(\/thumb.cgi\?[^"]+)"/)
    links.push($1)
    source[$1] = ''
  end
  links.each { |link|
    format = link.index('sc=') ? 'jpeg' : 'png'
    hash = Digest::SHA1.hexdigest(link)[0..7]
    cacheFile = "cache/" + hash + "." + format
    if(File.exist?(cacheFile))
      html[link] = "/"+cacheFile
    end
  }
  return html
end

I guess the next step would be to actually autogenerate the entire HTML response.

Anyway, while Rails is certainly a much better solution to arrive at the final answer, I’ve learned a great deal about Ruby through this exercise. I doubt I’ll make the site much more complex than that.

Great Music

Monday, September 13th, 2010

Music also has a property of bringing back compressed memories quickly. It symbolizes a particular set of circumstances, a particular company, particular events. Great music is all about the atmosphere it creates. In a way, it doesn’t even matter what it is — the actual melody or lyrics are just a medium; what matters is what it connotes.

The best music is nondescript.

Good Design, continued

Saturday, September 11th, 2010

I already talked briefly about design in my “tree of concepts” as the thing that allows us to answer a simple question of what we should be doing. However, to leave it at that is a cop-out — the design is by far the hardest part of the puzzle. I continually see people come up with poor designs, which cause lots of problems (which those people fail to attribute to poor design, but instead, blame on poor inputs). For example, if you are a CEO of a company and your design is to hire people who will do the right thing based on some simple guidelines, and if the people keep failing, do you keep hiring hoping for the right person to show up? Or do you rethink your design, admitting a possibility that such a design is not likely to succeed?

Good design is an art and so there is no step-by-step guide to it. There are some principles of good designs — statements that usually hold true that provide you with both the constraints and the scaffolding to bootstrap the design. I listed a few of them last time — but here is a little more thought-out list (note how these principles connect with each other):

  • Good design is natural — it feels right. Perhaps it actually borrows from nature
  • Good design makes few assumptions — and those it does make are worth calling out. Most designs fail because of an assumption that wasn’t, or ceased to be true. It’s important to understand the magnitude (the number of degrees of freedom) of the assumption — for example, a design relying on people to do the right thing has a relatively significant assumption built into it
  • Good design is consistent — once you list the assumptions, you should make sure they don’t contradict one another.
  • Good design is simple — There is a tendency for people to fix designs by tacking on exceptions. This is more likely to introduce inconsistencies
  • Good design is robust and forgiving — a robust design is not likely to cause problems that require you to overcomplicate it. Remember that humans err, things always go wrong. If your design is relatively slow to change, those unexpected events may cause a lot of problems
  • Good design is agile — you won’t design it right the first time, so build mechanisms in for improvement (for example, an evolutionary one — consider several options and choose those that work better over time). However, don’t violate any of the above principles (often people take a lazy approach to design because they think they can change it any time they want. That does not produce good designs)

Cancer and Evolution

Friday, September 10th, 2010

We all learned about how evolution led to homo sapiens and how through being more competitive, humans displaced other, similar but inferior, species. I often wondered how natural selection will manifest itself in the future — who will replace us, humans? Is evolution per se dead now that we are intelligent and can influence our adaptability through our actions? Or will it take some other, more nuanced, form? I think the answer is closely related to cancer.

People think of cancer as a kind of defect that affects healthy cells. But from a microscopic point of view, where the survival of cells rather than large organisms is relevant, there is an alternative explanation. At that level, cancer is a higher stage of evolution of cells, since usually those cells have a higher chance of survival (they don’t get recycled by the body, they take over other cells, they are much harder to eliminate than healthy cells). The existence of cancer is an outcome of natural selection of cells — evolutionarily, each cell undergoes mutations and those cells that happen to have superior features survive in a harsh natural environment. Cancer cells are regular cells that have mutated and gained features that allowed them to push past their harsh natural environment, i.e. a boundary defined by the human body. In a way, a human being dies of cancer when the cancer cells are too powerful to be confined in the body, that is, when cancer succeeds. So on a microscopic scale, we see a kind of natural selection of cancer cells over normal cells. The fact that they end up killing the body is a tragic side effect of the cancer being so successful.

Now let’s look at this at a macro level. We live in an age where our bodies are bombarded by perturbations of many sorts — electromagnetic waves permeating us, radioactivity and toxins (such as those in highly processed food) that we — willingly or unwillingly — absorb. These perturbations increase the frequency with which our cells mutate, and so, unsurprisingly, the incidence of cancer is much higher now than it ever was in the past. These perturbations, of course, are a natural consequence of progress — a consequence of our intelligence. Intelligence, therefore, is a double edged sword: on one hand it’s our greatest weapon, allowing us to reign over all other species, but on the other hand, it’s our weak spot, crippling us by allowing parts of us to be naturally selected against the body — and since evolution is a fundamental law of the Universe (since it’s nothing really than a statistical phenomenon), it’s likely we will not be able to fight it.

It’s possible we have reached the end of the evolutionary path for species: once a species reaches the Age of Intelligence, it dooms itself. This instability brought about by the decay may ultimately cause us to lose our position as the Earth’s most supreme beings; smaller, less intelligent creatures, less susceptible to toxins and disease, prevail. From our point of view this would seem like a regression, but evolution doesn’t have a design in mind, of course.

It’s also possible that evolution is circular — the species that survives us will not be an organism but a class of rapidly-mutating cells. Those cells will not need hosts as they will be so powerful no host will be able to harness them. Such rapidly-mutating cells could start the path anew, giving the lineage of species an unheard of momentum that encourages great diversity. And who is to say that the same hasn’t happened before.

It’s also possible that, being intelligent creatures as we are, we’ll preempt our dark fate and change our lifestyles. A culture of “natural living” may become popular, a minimalistic (though not primitive) living aiming to perturb Nature the least. A culture of men realizing the fragility of life and striving to limit the rate at which they increase entropy in the Universe.

How we Add Value

Monday, August 2nd, 2010

I’m becoming increasingly more convinced that where one adds the most value in a workplace is not a set of skills one possesses, but the ability to make reasonable decisions faced with imperfect information, which is really just three things:

  • An ability to see the possible outcomes (ability to visualize; one something you may call creativity)
  • An ability to enumerate the value and the possible risks of each
  • An ability to evaluate these trade-offs

In other words, everything there is to a responsibility is the ability to make decisions and each decision is simply an output of an evaluation function of all the pros and cons of all the possibilities.

Acquired Taste

Thursday, July 29th, 2010

I remember disliking alcohol pretty much in any form until I was about 20 (and yes, I have been drinking prior to turning 21, since in some parts of the world such an act is legal). And recently my friend P.P. and I had a conversation about alcohol and he told me he still doesn’t like it (he’s about my age). This prompted me to think about what caused that transformation in me, and whether it is a good one (i.e. one that is beneficial to undergo — and under what circumstances).

I think that alcohol itself performs two roles: it’s a stimulant (which is why most people are drawn to it from a young age), and it’s a carrier of gustatory information. Wine wouldn’t taste as good if it had no alcohol in it, but alcohol itself is pretty disgusting.

I also think, at least for me, alcohol was an acquired taste — a taste which required me to forgo some utility in the short run in order to enjoy a lot more utility in the long run. That is, before I acquired a liking for alcohol, I was in a local maximum; I didn’t like alcohol but I stuck with it and over time, doing that has allowed me to experience a much greater wealth of experiences. I am proud to have a good friend T.C. convince me to keep trying Scotch as right now it’s pretty much the only liquor that I enjoy drinking (maybe except some in cocktails).

What solidified my understanding of acquired taste as something valuable and desirable were many other examples, especially in the past six months, of my tastes changing. I moved away from sweet, milk chocolate in favor of dark chocolate. I started enjoying spicy food (yes, even the chicken wings — mind you, I still dislike vomit sauce with all my might) and this opened up the wealth of the Indian cuisine to me. Finally, some distinct experiences where an ingredient I never liked (such as, for example, celery) found its way in a dish I had, and to my shock I liked how it tasted, made me realize that there are no bad ingredients, just bad ways of preparing them.

Another thing that an acquired taste allowed me to do is to be able to understand myself better. Acquired tastes, having a higher barrier of entry, are usually complex and our enjoyment of them is sensitive to many small changes in their olfactory and gustatory properties: there isn’t much you can say about, say, gummybears, but Scotch you can write manuals about. This forced me to understand what particular components of taste I like more than others.

I’m not sure P.P. will have alcohol any time soon. But there is a glimmer of hope — I did manage to find one drink he did not dislike.

A Universal Language

Wednesday, July 21st, 2010

One of the ideas behind Esperanto was supposed to be the abandonment of irregularities, especially the duality between sounds and glyphs. Esperanto was supposed to be a perfectly phonetic language.

As it turns out, no language can stay perfectly phonetic and in popular use at the same time. I think this is because as the language is used, we tend to optimize it, and the optimizations are not based on structure, because that’s not how our brains work. Think about the optimizations as a kind of cache — caches are not structured, they are simply a way to throw some hardware into a problem.

Which brings me to an important question. Can mankind use a single language? Not the way English is used now — English is more of a code than a language — a default option that everyone seems to agree on, due to its prevalence in the world, both geographically, but also culturally (the most impactful culture “producers” have been and are now English-speaking empires).

I think there is something about language and distance — just like you can only naturally interact with about one hundred and fifty people, you can only share culture with people closest to you. Despite globalization, the French have been, are, and will always be very different than the Chinese. Language will reflect that culture (why? Does it have to do with differing natural circumstances in the early history of the nations?) and so it will diverge if the cultures are divergent. It’s clear even on a smaller scale, with various dialects being distinctly different, not just in sounds, but often in syntax and semantics.

However, it may be possible to devise a kind of basis, a fundamental set of principles that everyone agrees on and can communicates basic thoughts with, but then uses the local language on top of that to express more complex thoughts. Something, I think, that Latin was to European languages a long time ago.

Wit and The Art of the One-liner

Tuesday, July 20th, 2010

My three friends and I were driving to a music festival. My friend, seeing a police car parked on the street, instantaneously responded: “There’s my ride home.”

There’s something beautiful about one-liners: a perfect narrative compression of the situation, an almost poetic ability to synthesize while retaining information (I compare poetry to lossless data compression: a way to say to much in so few words). They are closely related to the concept of wit: the ability to comment on a situation with insight and humor. Probably the most extreme — and hilarious — example of that relation were “the battles of the wits” that my friends would engage in: a dialogue where each subsequent response built upon the previous but towered over it in wit. Unsurprisingly, the dialogue consisted almost entirely of one-liners.

The Yearning for Metropoleis

Friday, July 9th, 2010

We long for living in a metropolis — a place densely packed with people. But then once we’re there, we avoid humans at all cost — we avoid eye contact on the subway, we tend not to talk to people on the street, we just want to go about our day uninterrupted. I think this contradiction is because we’re simply greedy/em>: we want the metropolis all to ourselves.