Entries from December 2009 ↓

Licensing dynamic systems and AI

Recently I’ve been contemplating a number of potential directions for creating a start-up based on application of OpenCog to a problem or field.

One evening, I had an interesting discussion in bed with my partner that was related to licensing such technology. OpenCog is open source, which is my personal preference for the development of AGI, even if the jury on whether it’s beneficial or needless reckless is still out. As open source software, it means that if we sold expert systems based on OpenCog to end-users, we’d have to also provide the source. Even though we can license it under different terms from SIAI, this isn’t entirely needed since my current viewpoint is that the real value will be in data within the system.

As an analogy, the biological design for the brain isn’t what makes us unique or what encompasses our knowledge and experience of the world. The pattern that’s formed during our childhood and education is what is really valuable, otherwise we’d make no distinction between twins and not particularly care if one twin passed away.

So, the digital mind’s pattern would be the important part that we’d license or sell. However dealing with a dynamic system makes that interesting, since the pattern that was sold/licensed would inevitably change. Learning software could well have the valuable part (the “identity” if you will) morph and change beyond the original deployment. In fact, the software could learn new things which makes the individual deployment “smarter” than the original or any other deployment.

In that case, who owns those improvements? Should we get
the rights, since it was our software that altered itself, or does it belong to the license-holder since the AI learnt the improvement in their environment?

I’m sure with sufficiently rigorous legal-work one could protect towards one view over another, but I’m more interested in what seems right.

Connectedness and gift giving

It’s Christmas time, and I enjoy getting gifts for people even though I’m not religious. I’ve also been enjoying getting rid of lots of stuff I don’t use/need. This not only makes me feel like I’m clearing out mental space (I have Tyler Durden’s words echoing in my head “The things you own, end up owning you”) but also makes me feel good that other people are getting something that they want/need. Especially since I’m either giving the stuff away or selling it cheaply on TradeMe.

I googled “It’s better to give than receive.” since that’s the quote that’s automatically been ingrained into my psyche. Turns out it’s from the Bible, Acts 20:35 (King James Version):

“I have showed you all things, how that so labouring ye ought to support the weak, and to remember the words of the Lord Jesus, how he said: ‘It is more blessed to give than to receive.'”

(I guess “more blessed” translates to “better” these days.)

Never mind that giving psychologically makes us happier than spending money on ourselves. It also physiologically affects us, by releasing, not only the good old reward molecule Dopamine, but also the love neurotransmitter Oxytocin (unfortunately the mention of oxytocin isn’t in the abstract, but it’s discussed here).

There is another aspect of gift giving I want to mention, which I haven’t got any references for, but is based on my intuition on the mechanics of intelligence. When we give someone a gift, we usually have a reason for it, and when we choose a gift for them we tend to think “Will the person like this?”. The act of that means we have to emulate, model, and predict what they want and by activation it re-enforces their pattern within our mind. Does this inadvertently get us thinking of other aspects of their personality and of what other people might like too? I’ve discussed how part of love is the strong bonding of patterns, one’s self in another mind, their mind emulated in the self. This twinning makes us feel connected to the other person. To me, it makes sense that going through this process while selecting gifts for other people will inevitably make one feel more connected in general. And as mentioned above, the neurotransmitter associated with love is also released during giving.

Maybe this is why the gifting economy of Kiwiburn (and the American equivalent) is such a central part of the festivals and contributes to them being such enjoyable experiences.

“We make a living by what we get, but we make a life by what we give.”
— Winston Churchill

Upload a file to S3 with Boto

Amazon S3 is a distributed storage service which I’ve recently been working with. Boto is Python library for working with Amazon Web Services, which S3 is one facet of. This post will demonstrate how to upload a file using boto (a future post will demonstrate who to create the parameters for POST multi-part request that another client can use to upload to S3 without knowing your AWS key id or secret access key).

I will assume you’ve signed up for S3 already, and successfully downloaded and installed boto.

import boto

# Fill these in - you get them when you sign up for S3
AWS_ACCESS_KEY_ID = ''
AWS_SECRET_ACCESS_KEY = ''

bucket_name = AWS_ACCESS_KEY_ID.lower() + '-mah-bucket'
conn = boto.connect_s3(AWS_ACCESS_KEY_ID,
            AWS_SECRET_ACCESS_KEY)

If you’ve previously learnt about S3 you’ll know that bucket names need to be unique, so that’s why we’ve used the AWS Key ID as a prefix (as this is your unique id it’s unlikely someone else will be using it as a prefix). We’ve also converted the bucket to lowercase, as DNS is case-insensitive and it’s nice to use vanity domains of the form http://[bucket_name].s3.amazonaws.com/.

We create the connection object with boto.connect_s3() and this object let’s us interact with S3. We now create ourselves a bucket and upload a file:

import boto.s3
bucket = conn.create_bucket(bucket_name,
        location=boto.s3.connection.Location.DEFAULT)

testfile = "replace this with an actual filename"
print 'Uploading %s to Amazon S3 bucket %s' % \
       (testfile, bucket_name)

import sys
def percent_cb(complete, total):
    sys.stdout.write('.')
    sys.stdout.flush()

from boto.s3.key import Key
k = Key(bucket)
k.key = 'my test file'
k.set_contents_from_filename(testfile,
        cb=percent_cb, num_cb=10)

There you have it! The set_contents_from_filename is a particularly nifty method which simplifies all the streaming of data to S3. Amazon’s prototype python S3 library required that the file be loaded into memory. This doesn’t work too well if you are working with large media files.

Oh, and the percent_cb function is a call back that gets called as the upload progresses.

Code-brain

I have the code-brain.

Now that I live centrally, I’ve been finding myself more frequently excusing myself for having code-brain. What is code-brain? It’s when I’ve spent a day immersed in hacking code without social interaction… and to get out of this state generally just requires time. Usually if I went anywhere it’d require a drive and enough temporal separation for me to revert to a more sociable state, but now that I live in town, it’s about a 5 minute walk to meet up with people which is not enough time and words come with difficulty.

Given the plasticity of the brain, I sometimes wonder if coding for a living is psychologically stunting for one’s social behaviour. However, I can quickly reject that because many coders I know are very social and I don’t see them having the same difficulty.

I sometimes liken it to a mild form of Aspergers, since when dealing with code, for the most part it’s possible to keep everything you need to know about in front of you and it’s finite. It’s not overwhelming except when you’re thrown into a new project with a large existing code-base. Coming from being immersed in such a controlled environment it’s hard to adapt to being in a room full of people because it’s impossible to predict exactly what everyone else will do.

I don’t want to predict what everyone else will do, that’d make life boring. I just know it personally takes time to adjust between the two environments. If anyone has read or seen anything about this phenomenon then I’d appreciate links/comments – mostly so I can understand how to speed the transition and get more enjoyment from social situations without the painful transition.

Possibly I just need to make the transition more often and it’ll become easier 😉

Filtering Python dictionaries

Here’s a little Python snippet I just made up, but is immensely useful because I couldn’t find an obvious method like filter that applied to dictionaries instead of lists. This code pulls out specific key-value pairs from a dictionary and puts them in a new dictionary.

>>> x={ 'test1':1, 'test2':2, 'test3':3 }
>>> my_keys = ('test1','test2')
>>> y=dict(filter(lambda t: t[0] in my_keys, x.items()))
{'test': 1, 'test2': 2}

Obviously the performance characteristics of this won’t scale, but if you just want a few keys out of a dictionary then you should be fine.

Will it be okay?

This is a piece of writing from Hubbards cereal newsletter #36 – I used to have it on my wall when I was incredibly depressed, it was a amusing light in otherwise dark time. I’m miles from that place now, so am going to throw the newsletter out, but the writing itself deserves transcribing.

Will it be okay?
by Crescent Dragonwagon.

Yes it will.

But what if a big dog comes?

You will know whether it is friendly or not, if it is friendly, you pat it, if it is not you stand perfectly still and unafraid and it stops barking and comes to you and sits quietly beside you.

But what if there is thunder and lightning?

Continue reading →

The problems with OSX

I’ve recently bought a MacBook Pro 13″ for work and because I thought it’d make the music process much easier. Windows and Linux are fun for hacking/games, but sound stuff usually results in spending time on configuration rather than things just working. Anyhow, I’ve had a couple of weeks, and although the Macbook Pro is a nice machine, I have some gripes about the OS:

  • No consistent method for a keyboard shortcut to beginning of line or end of line. Seriously guys, what’s up with that? There are ways to go to start and end of lines, but some apps interpret these actions as start/end of buffer, others ignore them. Even Apple software isn’t consistent with this behaviour. Same goes for page-up and page-down short-cuts.
  • Control and command keys. Given that their names are almost synonyms, the extra key is kind of annoying because it’s often used in place of where Control would be used in any other OS. Difference for the sake of difference does not make you a beautiful and unique snowflake. And yet, Apple goes to all this trouble to simplify and allow the interface to be controlled with one mouse button, or to remove apparently superfluous home/end/pg-up/pg-down keys.
  • No consistent policy for click-through (what is click through? See a anti-click-through person here. As far as I can tell it seems to be about making the computer nanny you, for me… the general lack of click-through (except in rare cases) means I have to click an extra 200 or so times a day. I could get used to that… eventually. But some (Apple) apps don’t follow this policy. So it just ends up as a confusing mess. It’s even less productive than having direct mouse focus.
  • I thought Apple just couldn’t program multi-threaded applications on Windows. iTunes would stall frequently… turns out that’s normal. Clicking the help menu in most app also causes the menu to lock up (And not just the first time… everytime you click it seems to be regenerating an index or something. This leads to clicking elsewhere while waiting and then having to wait AGAIN. Exasperate the user looking for help? Not exactly a smart user relations design!)
  • A money grubbing $50 for a miniplug to DVI adaptor. Another $50 for VGA adaptor because they don’t give you a DVI-I with your DVI adaptor. Also the miniplug doesn’t support audio if you get the DVI to HDMI cable. My 1.5 year old Dell has HDMI out with audio and VGA (the only difference between HDMI to DVI is the plug and HDMI also supporting audio, so a basic HDMI to DVI cable is all that’s needed). For $50 an adaptor, I’d at least expect the adaptor to match the style of the Macbook Pro’s aluminium case, instead of being plastic white thing that clashes.
  • Try to move a file using finder without having to drag things. You can’t, cut and paste commands are disabled. In fact, why even have a cut item under the edit menu? It’s always greyed out as far as I’ve seen, as if to taunt anyone that’s used a decent file browser! Instead it’s “NO, YOU ARBITRARILY CAN’T DO THAT.” Thanks Apple, I love you too.

Maybe my expectations were too high, and maybe I’ll get used to the quirks of Apple software, but I currently miss Ubuntu. If anybody can point me somewhere that solves these issues though, then I’d be most appreciative.

Having said all that… things I like: multi-screen support done right, dock is pretty cool, the Macbook feels nice.