Friday, December 29, 2006

the ultimate end of personal growth

Serious disclaimer: As could be inferred from the title, the pretentiousness, preachiness, and all-around self-importance of this entry is far above-average. Its content is grandiose. Its topic is a timeless one as old as philosophy itself, so the mere fact that it attempts an answer is a possible sign of megalomania. Entire books have been written on the same or similar ideas, so this post will definitely be on the long side. Some may feel it to be too smug, although that is not the intent at all. Reader's discretion is advised.

A conjecture that has long jiggled in my noggin for a while, only recently coming into greater clarity with the reflections and resolutions of a new year, is that the concept of the ideal (or best) mind (or mental state) is a real, independent, objective concept, a concept which I will try to sketch out here. While none of the following will be truly original, this particular synthesis may be instructive.

What I mean by "ideal" is, believe it or not, basically pragmatic: that this mind functions well in a variety of situations. It considers its environment and goals, formulates decisions and plans, and puts into practice what it has decided. It is principled and rational, but also flexible. Simply put, this mind is ideal because it governs behavior as it should. To use more specific terms, this mind is likely to achieve success and (lasting) happiness or at the very least not be a hindrance.

The ideal mind exhibits these qualities:
  • Rationality. The ideal mind relates well to information. It is capable of recognizing the source, authority, and applicability of the information it considers. It realizes how powerful the right information can be, so it tries to maximize this power. For instance, it should be eager and able to learn, toss aside harmful preconceptions, and adopt new paradigms if necessary. Generally speaking, the too-closed mind cannot exploit information as much as the open mind, but the too-open mind fails to filter/distinguish bad information.
  • Self-Control. The ideal mind relates well to its impulses and values. At this point some might start saying "wait, you're talking about a soul attribute". To which my reply is "If you're able to precisely formulate distinct compartments of consciousness and diagram the interactions of those compartments, have at it. For my purpose here, I'm considering the ideal mind as a whole." Being rational and having self-control are separate qualities. Almost by definition, an addict may be rational, knowing his behavior is more self-destructive than not, but lack of self-control prevents this knowledge from its expected effect. Self-control is much harder to achieve than rationality, though both are lifelong journeys. To refer back to my post on Freakonomics, someone with self-control can take the (economically-enumerated) incentives in front of him or her and "rig" them with different relative weights. The ideal mind probably doesn't practice what is traditionally known as ascetism; rather, the ideal mind chooses what desires to obey and ignore. The dog wags the tail, not vice versa. One way to achieve the ignoring of a desire is to trump it with another desire. I have heard of a smoker who didn't quit until he saw his young boy pretending to smoke one of his crayons. Various media try to paint unbridled desire as highly dramatic and noble; don't be fooled, it's only trying to incite pathos, not give you life lessons. The ideal mind can and should have plenty of fun. The point of self-control is that the ideal mind can avoid the fun that has devastating side effects.
  • Empathy. The ideal mind relates well to its environment. One informal way to sum up this quality is "giving a damn". Some other names might be compassion, love (which may be the most overused word ever?), caring, tolerance. The crucial tipping point that marks this quality is the mind identifying with entities outside itself, hence the primary name "empathy". The ideal mind can appreciate goodness or Quality wherever it is, and strive to spread it through actions which vary wildly depending on context. However, since the ideal mind has needs and goals of its own, not least of all survival, it must maintain yet another balance in myriad situations. In the extreme case, the ideal mind's own existence is part of the equation, and the result may be reasoned self-sacrifice. If someone is not subjected to this kind of decision, he or she is lucky.
  • Timeliness. The ideal mind relates well to time. This quality is the hardest of the four to affix a one-word label onto. The abstract nature of time is not helpful, either. Anyhow, timeliness is the quality of applying mental energy primarily to the present, as opposed to expending it on regrets or unimplemented dreams for the future. Some might say that it consists of "just living in" each moment. The timeliness of the ideal mind does not imply that the past is denied or the future ignored; real timeliness recognizes the connectedness of time, and in fact takes this connectedness quite seriously. Without future goals, present action is aimless. Without taking the past into account, no learning occurs. Both the past and the future have no power over the ideal mind. The ideal mind uses other eras of time to serve and enhance the present. Part of forgiveness is refusing to permit another person's past actions to continue hurting you.
I'm going to stop here. There are many other fine mental ideals, I know, but I tried to choose four that were as uncontroversial and general as possible. Regardless of the many differences between the factions of the world, this concept of the ideal mind is common to all, even if it only takes concrete shape in a precious few individuals in a given society. It seems to me that any religion, belief system, morality, self-help regimen, or life principle worth listening to will foster development toward the ultimate end of personal growth outlined above: the ideal mind. Also keep in mind that in the vast majority of cases, strategies for the cultivation of the ideal mind fail primarily not because the strategies are defective, but because the person involved chose to fail. On the other hand, any specific strategy or system may overemphasize some attributes, leaving its acolytes to infer what counterbalances are necessary in practice of the ideal mind. And sooner or later the practitioner will discover complex unanswered questions and situations that must be confronted individually. Like some of the other vitally important intangibles of the human condition, the ideal mind is easier to sense "in the wild" than through words. That being said, the human search for the answer to Life, the Universe, and Everything has been ongoing for a looooong time, so it's foolish to disregard what others discovered before us.

Thursday, December 28, 2006

musings on Freakonomics

I admit to not reading a lot of nonfiction, especially if it is unrelated to my career. But recently, when I was dragged to a *-Mart, the cover, title, reviews, and introduction of Freakonomics pulled me in, hard. Merely the book's approach, applying the data mining and incentive-based reasoning of economics, intrigued me, let alone the colorfulness of the topics and conclusions. And I think it should go without saying that rethinking old assumptions through a high-level, objective analysis is a worthy goal, at least for anyone seeking the whole truth.

On the other hand, I can also see some weaknesses here. First of all, the reliance on statistics, while being the foundation of the book's claimed authority, can make for dubious evidence. There are three kinds of lies: lies, damned lies, and statistics. Dizzyingly intricate data manipulation can certainly illuminate patterns in a particular sample, but the more the data must be "massaged" and interpreted to reach an answer, the less convincing the evidence becomes. Second, the disagreements between economists when discussing even their own subject matter don't inspire confidence in bringing other topics under the same treatment. To be fair, their attempts to decipher the behavior of something as mind-bogglingly complex as the economy are admirable. It is unfortunate that they can't rely on direct experimentation the way that sciences, such as psychology, can.

Third, their picture of humanity is, of course, simplified. As others on the Web have commented, this book's subject matter is more like that of sociology and psychology than traditional economics. As I understand it, economics treats people as rational agents who balance their decisions in order to maximize profit and minimize cost. (I'm reminded of some comments that Yul, the last Survivor winner, made about one of his competitors, Jonathan. Yul said that he could predict Jonathon's actions simply because Jonathon was a rational player out to win the game for himself. In this sense, Yul was thinking like an economist.) This model assumes a competition is in place for the available payoffs, but there are other ways that people interact, such as sharing, collusion, or the extreme opposite: self-sacrifice. Sociologists would place greater emphasis on these other modes. The economic view would fit with the idea of government being a "social contract" in which free citizens cede some powers in order to have other needs filled.

The book acknowledges this third weakness, by describing social and moral "incentives" (so it's more blessed to give than receive only because the giving act benefits the giver in some way?). Essentially, the economic model of human behavior is not falsifiable. If people act to gain positive incentives and reject negative incentives, then an incomplete analysis of any given situation indicates that the analyst needs to consider more incentives. Funny thing is, I'm pretty sure I've encountered this idea before: radical behaviorism. Push a lever, get a fish biscuit. The fiction book Walden Two presented a utopia brought about with those methods. In case it's not clear, I find that philosophy highly distasteful. Higher brain functions are A Good Thing.

Freakonomics doesn't duck such objections. It invites them. In fact, one of the points made by the book is that the decision to cheat or steal, i.e. breaking rules in order to obtain a resource, is like any other (economic) decision: it simply has strongly negative social and moral incentives. Since everyone acts economically, therefore most everyone cheats, but only when it makes (economic) sense. For instance, when the negative social incentive is infinitesimal because of an infinitesimal chance of being caught, or the negative moral incentive is puny because the otherwise rightful resource holder can "afford" to not have it. Truly, someone must have a firm, crunchy moral center indeed to turn down those opportunities. Or someone can try to engineer additional incentives against cheating, like the designers of Walden Two. It may be true that most people have moral limits, and "every man has his price", but that doesn't mean I must like it or condone it. A utopia would work well, if we could only manage to get around the people problem.

Monday, December 18, 2006

relational database as inference engine

A short while ago, I was reworking an SQL query to ensure that it would yield the precise results the rest of the application expected. (Side observation: my conscience kept hollering at me to make the SQL simpler and just crunch the returned data as needed. Shut up, Jiminy! Go spell encyclopedia and leave me alone.) I noticed that I was adding, taking away, and rearranging WHERE conditions to match particular rows. But matching to specific data based on a generalized set of characteristics is also an activity performed by inference engines! It's not that far of a leap to equate database rows to facts, SQL queries to rules, and newly-inserted database rows to concluded facts or assertions. I wouldn't be surprised if the academics in these two camps have been cross-pollinating ideas for some time. If I knew substantially more than jack about real relational database theory, I could offer some insightful comments. Instead, here's an example.

Imagine a set of widgets available for sale. A white widget has no additional cost, a black widget costs an additional 400, and a green widget costs an additional 200. The base cost for round widgets are 100, square widgets are 200, and triangular widgets are 150. How much does a round, black widget cost? An inference engine might have the set of rules (color white) => add 0, (color black) => add 400, (color green) => add 200, (shape round) => set 100, (shape square) => set 200, (shape triangle) => set 150. Then one could add the facts (color black) and (shape round) and have the answer. Or at least the necessary addends.

A (SQL-compatible) database could do a similar operation. One particular combination (or should I say tuple?) of facts becomes a row in table "facts". The rules become: (select 0 from facts where color = "white"), (select 400 from facts where color = "black"), (select 200 from facts where color = "green"), (select 100 from facts where shape = "round"), (select 200 from facts where shape = "square"), (select 150 from facts where shape = "triangle"). Add a row to "facts" that has a "color" column of "black" and a "shape" column of "round", run the queries, and there's your answer. Or at least the necessary addends.

The similarities become more striking when you use a database table in the usual way, i.e., using a row to represent one member out of a collection of similar entities. To refer back to the previous example, this just means renaming the "facts" table to "widgets" and breaking non-widget facts out into separate tables (the usual normalization). SQL queries that match multiple entities at once will employ JOINs. In the inference engine, an entity would look like (widget (shape square) (color green)), and I assume that rules that match multiple entities would work about the same as rules that match multiple individual facts.

As to whether it makes practical sense to map a relational database to an inference engine or vice versa, I'm inclined to think not. If your problem domain is rigid enough to work in a database, then there's no gain in using an inference engine instead. If your problem domain is a classic example of AI, a rather fuzzy attempt to capture a variety of heuristics working on loosely-structured data, then the database details would bog you down. To say nothing of the limitations (and proper place) of SQL.

Thursday, December 14, 2006

arithmetic unplugged - the abacus

Somewhere in the intersection of the sets "unnecessary activies", "math-related stuff", "exotic devices", "cheap equipment", and "skills requiring long practice" is "the use of an abacus". How could a frugal ComSci-major/Math-minor with way too much time on his hands resist?

I bought a surprisingly little but quite usable 13-rod Japanese abacus or soroban on eBay for cheap, and also an old but lightly used copy of The Japanese Abacus: Its Use and Theory by Takashi Kojima (ISBN 0-8048-0278-5, although I later stumbled on a page with links to a verrrrry similar pdf). If I had the requisite desire and/or discipline I would probably be pretty good at using my soroban--I'm not. Part of the lack of motivation stems from the fact that I have no practical reason for improvement; after all my cell phone (the same one that once made me feel like I had the power of the sun in the palm of my hand) has a calculator function. Nevertheless, I'm progressing slowly.

On the soroban, each rod has one 5-unit bead and four 1-unit beads, with a separator between the fiver and the rest. This means that the soroban is primarily for regular decimal-based applications, although I suppose one could use just the 5-beads and do binary math if one wanted to (setting the 5-bead would represent a 1, and each rod would represent a power of two). Note that more than 6 or so items in a group could be hard to accurately recognize and distinguish at a glance, so more beads might actually make calculations slower, because it would force the operator to laboriously count bead-by-bead.

One exceedingly simple drill for beginners, that I haven't seen mentioned anywhere, is just to add a single-digit number to itself a set number of times. It's easy to tell when you've made a mistake: merely check to see if the result is a multiple of the number. You can also start with a high multiple and perform a series of subtractions. The point of this drill, which clearly would never be performed with an abacus in a real situation, is to increase your speed. In my opinion, it makes sense to get really good at this drill before adding and subtracting two digit numbers, which seem to be the usual starting exercises for the abacus.

As the little book explained, the abacus procedures simplify a calculation by breaking it up into lots of rapid, little single-digit calculations. The usual pencil-and-paper method is almost exactly like the abacus method (in spirit anyway), but with some significant differences. The first, of course, being that the paper method involves writing a problem out, while an abacus operator just flicks his fingers to shift some beads--a considerably simpler if not faster motion. The second difference is that numbers in the paper method are distinguished by having differently shaped symbols, while numbers on an abacus are actual quantities of beads--numbers you can feel. Hence the usefulness of the "toy" abacus in teaching children.

The third and most confusing difference is that the paper method is free-form or malleable, while an abacus cannot be "rewritten" to have more or less beads in any given case! On the abacus, "carrying" and "borrowing", meaning the overflow or underflow of one power of ten to another, are achieved by making a one-bead adjustment in the higher power and then offsetting that adjustment by moving beads in an inverse operation in the lower power. You undo the excess. For instance, to add 4 to 8, you:
  1. Check to see if you have enough beads on the rod under consideration. Since there is only one 1-bead left (8 is one 5-bead and three 1-beads), proceed to step 2.
  2. In step 3, you will add a 1-bead on the tens rod to the left, which will be too much by 10 - 4 = 6. So reset six beads, that is, the 5-bead and one 1-bead, leaving two 1-beads.
  3. Add the 1-bead in the tens rod. By not doing this until last, you can keep your attention on the unit rod for both steps 1 and 2. Otherwise, you would focus on the unit rod, switch to the tens rod, then switch back to the unit rod to undo the excess.
This could also be thought of as adding 10 and a -6 (or subtracting 6). According to the little book, the key to doing this quickly is to think of numbers in terms of "complementary" pairs: 9 and 1, 8 and 2, 7 and 3, 4 and 6, 5 and 5. If there is power-of-ten overflow or underflow involving one of the numbers in a pair, just do the opposite operation with the other number in the pair. It gets easier with practice, believe me. The same strategy applies to adding or subtracting a 5-bead when you run out of 1-beads (e.g., 3+3), except there are only two pairs: 4 and 1, 3 and 2. The real kicker is when you have a problem like 13 - 6, in which you need to add the "tens complement" of 6 (i.e.,4) to the unit rod, but you can't do that unless you move a 5-bead and subtract the "fives complement" (i.e.,1) from the unit rod. You convert a subtraction to an addition to a subtraction as far as the 1-beads on the unit rod are concerned. Have I mentioned that effective use of the abacus takes some concentration at first until it becomes "automatic"? Try not to overthink it. There are also techniques for multiplication, division, and roots, but I've only skimmed those so far. It appears that the comparison to the paper method is again apt, as the simplifying principle is the distributive property: reducing a complex multiplication to a sum of one-digit multiplications.

The freaky conclusion of abacus training is the operator becoming able to do abacus manipulations on an imaginary abacus, enabling savant-like mental calculation. I don't plan to reach that point for a looooong time, but here is an incredible account that I'm not sure I believe. If the story's completely true, I might like to hire him as my mentat (I'll get that Leto!). Here are some of the more useful links I've found.

Friday, December 01, 2006

If House visited Scrubs

I regularly watch House and Scrubs. Both shows take place mostly in hospitals, but Scrubs is more likely to have scenes elsewhere. Scrubs seems to have more minor and recurring characters than House, which mostly revolves around a few people (the Simpsons has far more than both put together, but since tremendously talented voice actors can do multiple cartoon characters this is no surprise). House is about complicated diagnoses; it's the medical equivalent of a mystery or "whodunit", while Scrubs is more about the daily and routine trials of hospital work. House is a drama that often has (acerbic) funny moments. Scrubs is more of a comedy with token dramatic moments. Scrubs has its share (or more) of shmaltz, but House is more stingy in that regard. Most prominent of all, in my opinion, is that House takes place in a realistic setting, and Scrubs takes place in a surreal setting (including J.D.'s imaginative mind).

What I find fascinating is the huge contrast in tone. Consider this thought experiment or scenario: J.D. can't figure out what's wrong with a patient. He calls Dr. Cox. After calling J.D. Rhonda and launching into a drawn-out tirade about how he isn't a genie to be summoned at will by the incompetent, Dr. Cox decides to bring in the renowned Dr. House. Dr. Kelso meets Dr. House at the door, smiling widely and generally trying to flex his political know-how. House nods politely until Kelso is done talking, then nails him with a surgically-precise insult. Dr. Kelso raises an eyebrow in surprise that someone stood up to him so well, then walks away in a huff. If J.D. watched this exchange, then there may have been a daydream sequence in which House and Kelso fought in a Western quick-draw gun duel. When House arrives at the patient's bed to deliver his first cynical comment about the root cause, the patient immediately starts convulsing and coughing up blood, because that's what House's patients do. Carla stabilizes the patient with her usual quick action. When House orders her to perform a painful test, she flatly refuses before giving House unsolicited advice on his lack of caring. House gives the standard retort that "all he's trying to do is save the patient's life", to which Carla responds by telling House to do it himself. If the test is highly expensive, House may also need to cajole Dr. Kelso into allowing it at all. Later, House concludes that some surgery is needed, so Turk comes by to receive instructions. In the ensuing conversation, House makes a racial joke, but it flies completely over Turk's head. At meal time, House sits with Dr. Cox to fill him in on his diagnosis so far. He starts by making a poor analogy, then waiting for Cox to ponder what he's saying. Cox makes his own poor analogy between doctors who don't say what they mean and women with deceptive breast implants. House mocks Cox for being so slow, and Cox mocks House for treating his work like a game. Eventually they manage to communicate. Towards the end, Jordan joins Cox at the table. House includes her by indulging in some thinly-veiled innuendo. Jordan not only fails to be embarrased by this, but follows it up by insulting House's masculinity in some way. As all this is going on, there is a subplot involving J.D. and Elliot, but nobody cares because the guest star is more fun. In the end, the patient may or may not die because this is Scrubs, but in any case it won't be because House was wrong. With well-hidden enthusiasm, House will leave, overjoyed to return to a hospital where people take things, such as Dr. House, more seriously.