Sunday, September 6, 2009

More Shedskin Python

Previously I discussed Shedskin Python, a Python compiler I used on my ACO TSP test program. My ant.py test program is now being included as one of the example programs with Shedskin.

The earlier discussed version of Shedskin used intermediate templated C++ code to support the parametric polymorphism (generic functions) inherent in dynamically typed Python programs. In the most recent versions this templating has been dropped, as it was found to be complex to maintain and rarely useful. So my palindrome examples no longer compile.

In testing ant.py could also be sped up by 1.5x with the following shedskin flags:

-b --nobounds Disable bounds checking
-r --random Use fast random number generator
-w --nowrap Disable wrap-around checking

Sunday, August 9, 2009

Backpacking Gear Test



After hauling my camping gear to the airport for RAGBRAI, at the magazine stand I noticed the cover of the latest issue of Backpacker: "Your Lightest Load Ever!" Intrigued, I read all about Ultralight Backpacking and the newest lightweight tech. Then I started shopping. I ended up backing off from ultralight, and now could be classified as lightweight+: 23 lbs base weight (without food, water, fuel).

Gear Weights (spreadsheet)

All listed weights measured myself with a Cuisinart kitchen scale.

I took all the listed gear to Pinnacles National Monument as a test. One night in the campground, day hikes to the Bear Gulch (2.4 miles) and Balconies (5.4 miles) caves, plus 2 miles with full pack. Impressions follow.

North Face El Lobo 65 Pack



This was the one non-"ultralight" purchase. I considered several other recommended ultralight packs, including the North Face "Flight" series Skareb 65, but wasn't able to convince myself of their durability or gear hauling ability (assuming I didn't commit to ultralight for everything else). The El Lobo has some useful features over the Skareb, including a separate sleeping bag compartment and a detachable lid converting to a padded fanny pack. I used the lid pack to carry two 0.7 L water bottles plus food and flashlight for the day hikes. According to spec the El Lobo (at 4 lb 4 oz) was only supposed to be 8 oz heavier than the Skareb (at 3 lb 12 oz). However, my scale shows the El Lobo at 5 lb 6 oz -- over a lb above spec.

In the field the pack worked fine. Held all my (new) stuff, comfortable on the trail. Built-in hydration compartment (common in new packs) is great for hiking, though an internal leak would be very messy. Katadyn water filter (tested at home, not on trip) does provide quick-connect fittings for the drinking hose so the reservoir doesn't have to be opened or removed to refill. Hopefully this will reduce the odds of mishap.

Sierra Designs Vapor Light 2 XL Tent

This tent replaces my 1990 North Face Coriolis 2-person tent (7 lbs with footprint). The Vapor Light saves over 2 lbs, while still being a 2 person tent -- so far I find one-person tents too claustrophobic (plus I like keeping my pack inside). I do expect the Vapor Light to be less durable; I would rather have the North Face in an Iowa Tornado. The stakes it came with (middle) are a joke:



So I replaced them with REI stakes (top) similar to those provided by North Face with my old tent.

I went with the REI-exclusive XL model (93" long, instead of 83" in the non-XL) so it could fit my old long sleeping bag (86"). My old tent was 90" long.

North Face Orion Sleeping Bag (20 deg, synthetic, regular length)

This bag replaces my 1990 North Face Cats Meow (20 deg, synthetic, long length) bag (3 lb 11 oz), saving 1 lb 4 oz. More importantly, the new bag fits in the sleeping bag compartment of the El Lobo pack, and leaves enough room that the hydration pack can be used without the new tent being carried outside the pack. Yes, down could have been even smaller and lighter. I don't want to worry about a wet bag. I decided to go with regular length since most ultralight one-person tents can't hold a long bag. Trying it in the store, regular bags do hold a six-foot person -- if they are sleeping on their back like a mummy.

In testing, I found this doesn't really work for side-sleepers. You get a cold draft over the shoulder, since you can't scoot down to cover unless your legs are bent. I also experimented with the head-cinch cord, which I normally never use (again too claustrophobic). My old North Face bag had a rope cord, and a normal-sized squeeze-lock. The Orion has an elastic cord, and a tiny squeeze lock which gives no feedback as to whether the tiny button is activated. As a result I broke the elastic inside the hood while trying to open it during the night. Frankly this worries me about North Face's "Flight" ultralight product line (including this Orion bag, and the Skareb pack I had considered). With almost 20 years of North Face products (discussed above, plus a ski shell and down jacket) I've never managed to break anything until now. Fortunately I don't use the head cinch anyway. Looking at other bags at REI (including the current Cats Meow) they all use larger squeeze locks and many use ropes instead of elastic. I only found the micro squeeze lock on some ultralight packs.

New Balance 1500 Rainier Hiking Boot

Replaces Vasque hiking boot. Weights are basically the same: 3 lb/pair. Benefit (over many other options) of these New Balance is that they actually come in B widths. No blisters in two days (moderate, hot) hiking.

With a fully loaded pack weight of 30 lbs I didn't want to try just using low-cut trail shoes.

Trimble Outdoors Android G1 Phone App

This was a last-minute Android Market download/purchase, as I didn't want to add 5 oz for my old Garmin GPS (which also has a horrible menu interface, and doesn't support map downloads). I haven't figured it all out yet. I got waypoints for Pinnacles High Peaks Trail onto my GPhone, but didn't download a topo map.



One hilarious part: Help requires web access. Hope you're not too lost.

Next Steps

Turns out my old steel MSR pots are now considered "expedition grade". Ultralight titanium is apparently the new hotness...

Tuesday, June 30, 2009

Pinker Again

In my previous post Sapir-Whorf Revisited I cited Lakoff's theories on metaphor. A much simpler critique of Pinker can be made, based only on Pinker. He says

"...the famous Sapir-Whorf hypothesis of linguistic determinism, stating that people's thoughts are determined by the categories made available by their language, and its weaker version, linguistic relativity, stating that differences among languages cause differences in the thoughts of their speakers". (The Language Insinct, p. 57)

Now simply substitute "culture" for "language":

"...the Revised S-W hypothesis of cultural determinism, stating that people's thoughts are determined by the categories made available by their culture, and its weaker version, cultural relativity, stating that differences among cultures cause differences in the thoughts of their members."

Sound more reasonable? Most of Pinker's critique in his chapter on "Mentalese" would not apply.

Mentalese also appears to have numerous flaws. On a small scale, what is mentalese for our modern word 'telephone'? On a larger scale, for 'cell doctrine'? For 'plate techtonics'? For 'Standard Social Science Model'? For 'physical symbol system hypothesis / computational theory of mind'? All of these concepts are uniquely made available to us by our culture. They were not hard-wired by evolution. They provide categories which determine (or at least cause differences in) our thoughts.

I also doubt human cognition is based on Predicate Logic. We aren't very good at it, and systems actually based on it normally fall apart on the first inconsistency encountered in the real-world (see Carl Hewitt's heroic attempts to fix this in Common sense for concurrency and strong paraconsistency using unstratified inference and reflection).

Sunday, June 28, 2009

Sapir-Whorf Revisited

The Sapir-Whorf Hypothesis asserts that categories in particular human languages influence or even control our possible thoughts. You have most likely heard this presented in its most (in)famous example, about Eskimos having N different words for "snow". I thought this version was well taken-apart by Steven Pinker in The Language Instinct. Recently an Edge essay HOW DOES OUR LANGUAGE SHAPE THE WAY WE THINK? by Lera Boroditsky has made me reconsider.

Using the terminology of Lakoff and Johnson's Philosophy in the Flesh, Pinker's critique is classic first-generation Cognitive Science. Pinker says the brain is the equivalent of a computer or Turing Machine, processing abstract symbols. He asserts that thinking is done in "mentalese", not in a particular human language. Translation to human language is the last step before speaking, so it cannot influence the core of thought.

Lakoff and Johnson's second-generation Cognitive Science can be difficult to grasp, so I'll go slow. It is a big idea, and since you can't see where I'm going, it is easy for me to get too far ahead for you to follow. Simply stated: thinking is largely based on metaphor, and abstract thinking is based on metaphorical analogy to bodily operations in the physical world. Re-read the examples in the first two sentences: "difficult to grasp", "go slow", "big ideas", "see where I'm going", "get too far ahead", "follow". All of these are related to operations or relations in the physical world. Their use in the realm of ideas is much more vague and abstract. It is easy to agree on a measurement for the "bigness" of a tree, but how do you measure bigness for an idea? Works such as Feldman's From Molecule to Metaphor show how evolution started with simple minds able to interact with the physical world, and placed increasing layers of abstraction on top. But abstract thinking still bottoms out at the use of modules originally evolved for physical world manipulation.

So how does this relate to language and Sapir-Whorf? The studies cited by Boroditsky indicate different cultures use different physical-world metaphors for their abstract thinking:

"English speakers tend to talk about time using horizontal spatial metaphors (e.g., "The best is ahead of us," "The worst is behind us"), whereas Mandarin speakers have a vertical metaphor for time (e.g., the next month is the "down month" and the last month is the "up month")."

This is plausible. There is no inherent reason why time should be metaphorically mapped horizontally versus vertically. It can easily be culturally determined rather than hard-wired into the brain. And this puts an interesting new spin on Sapir-Whorf. Thought is not determined by language, but instead both thought and language are determined by culturally transmitted, culturally specific abstract metaphorical mappings. And how is culture transmitted? Primarily through language. So linguistic determinism or linguistic relativity is in a sense correct, but not for the reasons usually proposed.

Friday, March 27, 2009

Brain Scans, Machine Learning, and Trillion-word Web Text Corpus

"The question of how the human brain represents conceptual knowledge has been debated in many scientific fields. Brain imaging studies have shown that different spatial patterns of neural activation are associated with thinking about different semantic categories of pictures and words (for example, tools, buildings, and animals). We present a computational model that predicts the functional magnetic resonance imaging (fMRI) neural activation associated with words for which fMRI data are not yet available. This model is trained via a combination of data from a trillion-word text corpus, and observed fMRI data associated with viewing several dozen concrete nouns. Once trained, the model predicts fMRI activation for thousands of other concrete nouns in the text corpus, with highly significant accuracies over the 60 nouns for which we currently have fMRI data."

Predicting Human Brain Activity Associated with the Meanings of Nouns, Tom M. Mitchell, Svetlana V. Shinkareva, Andrew Carlson, Kai-Min Chang, Vicente L. Malave, Robert A. Mason, Marcel Adam Just, Science, 320, pp. 1191-1195, May 30, 2008.

This research is the most interesting I have seen on the mapping of internal brain structure based on analysis of large bodies of text available from the web. When generating machine-learned models from fMRI data, they found that for their tested set of concrete nouns the most accurate intermediate semantic features were sensory-motor verbs. This matches with others theories of ideas being represented as the convergence of many related sensory patterns. For instance, apple as the convergence of the word "apple", redness, shiny, apple taste, apple texture, picking-by-hand, etc.

Monday, February 16, 2009

Laser Sound




This project is based on the Make Controller I picked up at Maker Faire. It plays tones controlled by the interruption of laser beams. The laser beams are from Laser Levels, and the MacBook software is implemented in the Processing environment.

Details here.

Sunday, January 18, 2009

CUDA GPGPU on MacBook Pro Laptop

I've ported my pthread generic and CUDA GPGPU real-time ray tracers to Mac OS X running on a MacBook Pro laptop. It has a 2.4GHz Intel Core 2 Duo processor and a NVIDIA GeForce 9600M GT graphics processor. The Performance for 1 and 2 software threads is comparable to my older Linux desktop, and the CUDA is within a factor of 3 of the desktop graphics card.

Threads Frames Per Second
1 8.5
2 17.4
GPU 16.7