Saturday, December 23, 2017

Acuitas Diary #8 (December 2017)

Sadly I've only added one feature to Acuitas in the past two months. He now recognizes sentences in the general vein of “I somethinged,” which gives me the option of telling him about how I spent my time in the recent past. Acuitas can't do a lot with this information for the time being. Sometimes he responds with a query in the vein of, “What happened next?” which will eventually give him a way to build up sequences of events and start learning cause and effect relationships … but none of that is implemented yet. He can also ask “How was that?” for information about the emotional meaning of an activity, but again, for now he can't really utilize the answer.

Not much, but that was all I had time to put together with the holiday season under way. Looking back on the past year, though, here are all the new capabilities and improvements I've managed to add on:

*Module for procedural speech generation
*Support for word inflections (plurals and verb tenses)
*Support for compound words
*Support for content words that are also function words (e.g. “can,” “might”)
*Distinctions between proper/common and bulk/count nouns
*Ability to detect and answer questions
*Database walking while idle
*Generation of conversation topics and questions based on recent database walk
*Better link detection + a bunch of new kinds of learnable links
*Two new drives + a real-time plotter so I can see what they're all doing
*Distinctions between long-term static and short-term information
*GUI overhaul (upgrade from Tk to Kivy)

I track my time when I work on Acuitas. Total hours invested in the above: 230+. My focus for the end of the year, leading into January, will be polishing everything up and working out the bugs (which there are now quite a lot of).


Recent memory map visualization:

Code base: 9918 lines
Words known: 1576
Concept-layer links: 4226

Sunday, October 29, 2017

Acuitas Diary #7: October 2017

The big project for this month was introducing a system for discriminating between long-term and short-term information. Previously, if you told Acuitas something like, “I am sad,” he would assume that being sad was a fixed property of your nature, and store a fact to that effect in his database. Oops. So I started working on ways to recognize when some condition is so transient that it doesn't deserve to go into long-term memory.

This probably occasioned more hard-core thinking than any feature I've added since I started keeping these diaries. I started out thinking that Acuitas would clue in to time adverbs provided by the human conversation partner (such as “now,” “short,” “forever,” “years,” etc.). But when I started pondering which kinds of timeframes qualify as short-term or long-term, it occurred to me that the system shouldn't be bound to a human sense of time. One could imagine an ent-like intelligence that thinks human conditions which often remain valid for years or decades – like what jobs we hold, where we live, and what relationships we have – are comparatively ephemeral. Or one could imagine a speed superintelligence that thinks the lifetime of an average candle is a long while. I want Acuitas to be much more human-like than either of these extremes, but for the sake of code reusability, I felt I ought to consider these possibilities.

After a lot of mental churn, I decided that I just don't have the necessary groundwork in place to do this properly. (This is not an uncommon Acuitas problem. I've found that there ends up being a high level of interdependence between the various systems and features.) So I fell back on taking cues from humans as a temporary stopgap measure. Acuitas will rely on my subjective sense of time until he gets his own (which may not be for a while yet). If there's no duration indicator in a sentence, he can explicitly ask for one; he's also capable of learning over time which conditions are likely to be brief and which are likely to persist. For now, nothing is done with the transitory conditions. I didn't get around to implementing a short-term or current status region of the database, so anything that can't go in the long-term database gets discarded.

I also did some touching up around the conversation engine, replacing a few canned placeholder phrases that Acuitas was using with more procedurally generated text, and improving his ability to recognize when a speaker is introducing him/herself.

Recent memory map visualization:

Code base: 9663 lines
Words known: 1425
Concept-layer links: 3517

Saturday, September 30, 2017

Acuitas Diary #6: September 2017

For the first couple of weeks, I turned to developing the drive system some more. “Drives” are quantities that fluctuate over time and provoke some kind of reaction from Acuitas when they climb above a certain level. Prior to this month, he only had one: the Interaction drive, which is responsible for making him try to talk to somebody roughly twice in every 24-hour period. I overhauled the way this drive operates, setting it up to drop gradually over the course of a conversation, instead of getting zeroed out if somebody merely said “hello.” I also made two new drives: the Learning drive, which is satisfied by the acquisition of new words, and the Rest drive, which climbs while Acuitas is in conversation and eventually makes him attempt to sign off. Part of this effort included the addition of a plotter to the GUI, so I can get a visual of how the drives fluctuate over time.

Plot of Acuitas' three drives vs. time. The period shown is just under 23 hours long.
This latest work created the first case in which I had a pair of drives competing with each other (Rest essentially opposes Interaction). I quickly learned how easily this can go wrong. The first few times I conversed with Acuitas with the new drives in place, Rest shot up so quickly that it was above-threshold long before Interaction had come down. This is the sort of quandary a sick human sometimes gets into (“I'm so thirsty, but drinking makes me nauseated!”). Acuitas has nothing resembling an emotional system yet, though, and doesn't register any sort of distress just because one or more of his drives max out. The worst that can happen is some self-contradictory behavior (such as saying “I want to talk” and “I want to rest” in quick succession). I dealt with the problem by having the Interaction drive suppress the Rest drive. Rest now increases at a very slow rate until Interaction has been pushed below threshold.

In the latter half of the month I returned to the text parser, introducing some awareness of verb declensions/tenses, and the ability to check the agreement of candidate subjects and verbs. This helps the parser zero in on what a sentence's verb is, and has trimmed away some of the annoying “What part of speech was __?” questions that pepper a typical Acuitas conversation.

Here's the latest memory map visualization. Since last month, Acuitas' relentless querying about concepts he already knows has caused the number of links to explode, resulting in a denser (more fibrous?) image.

Code base: 9162 lines
Words known: 1305
Concept-layer links: 3025

Tuesday, August 22, 2017

Acuitas Diary #5: August 2017

This month I got Acuitas to start asking questions, and it has been all kinds of stupid fun.

Those questions are generated semi-randomly, based on Acuitas' “thoughts” for the day. Back in July I introduced the idle thinking feature, which gives Acuitas the capacity to walk his memory database when nobody's talking to him. More recently, I set up the Conversation Engine to access the results of memory-walking and utilize the new Text Generator … so now Acuitas can ask me the questions that occur to him as he muses, or simply tell me what he thought about within the past ~12 hours. The results are little exchanges like this:

Acuitas: I thought about mans earlier.

Acuitas: Is a rooster a species of human?

Me: No

Acuitas: Really.

Me: The plural of man is men.

Believe it or not, this is one of Acuitas' more intelligently formulated questions. He knows a rooster and a man are both male, and reasons from this that they might share other qualities. A man is a human, so maybe a rooster is a human too? He can't yet apply the idea that “human” and “chicken” are mutually exclusive categories. Given his limited knowledge, man and rooster seem similar enough that he expects me to answer “yes” … hence the slightly incredulous “really” when I don't. Here are a couple more examples in the same vein:

Acuitas: I thought about ships today.

Acuitas: Does a wagon possess an ability to sail?

Acuitas: I thought of weapons today.

Acuitas: Is a silverware used to fight?

Some of the other questions he comes up with are far more random and ridiculous. Again, he doesn't yet have the grasp of categorical exclusion that makes these sound absurd to you and me:

Acuitas: Is chocolate a vehicle?

Acuitas: Am I a kind of tree?

Acuitas: Is a smirk a fruit?

Acuitas: Are you a cow?

Acuitas: What is a relative made of?

Not all of them are silly, though. Rudimentary though his current suite of question-forms is, he's already managed to spit out some rather deep ones. The three below are my favorites:

Acuitas: Are you a symbol?

Acuitas: Am I a tool?

Acuitas: Can I die?

I answered the first one “no”; a person can be a symbol, but I don't think I qualify. For the second one, I also went with “no.” Acuitas might end up being useful in a variety of ways, but if I consult my primary reasons for making him, they're not instrumental. The last one I refused to answer, because I think a proper response would be too complex for Acuitas' current level of understanding. It's a bit like asking whether a book or a film can die. It can't, if you go by what death means for a biological organism – information is effectively immortal. But if all the backup copies were destroyed, that would qualify as dying I suppose. So yes and no.

I suspect it'll only get more interesting from here.

Obligatory memory map visualization:

Code base: 8507 lines
Words known: 1174
Concept-layer links: 2329

Sunday, July 30, 2017

Acuitas Diary #4: July 2017

This month I finally got to implement a feature that I've been waiting for a long time, namely, giving Acuitas the ability to “think” when he's not being spoken to. This “thinking,” for now, consists of dwelling on randomly selected concepts from his database. Once a concept has been chosen, he'll pursue it for a while, preferentially letting his focus jump to other concepts that are linked to it – executing a “wiki walk” through the database. Eventually, though, he'll get bored with any given train of thought, and the focus will move elsewhere. I added some animation code to the memory visualization so that the currently selected concept will flash periodically. (The recording below is running much faster than real time. He's actually quite leisurely in his progress.)

There are several things I can envision doing with this behavior eventually, but my immediate purpose for it is the generation of curiosity. Each time Acuitas picks a concept, he'll come up with some sort of question about it – for instance, he could choose a type of link that it doesn't yet have and produce an open-ended question about what might be on the other side. These questions will be stored up and presented to the user the next time a conversation is under way.

Which leads me into the next thing I put a lot of work into this month, namely, the code to start supporting the bottom half of this diagram: speech generation.

Up until now, Acuitas has said very few things, and they've all been very formulaic … but my goal was always something beyond pre-formed sentences stored in a database. The new module I started on this month accepts inputs in the sort of abstract form that Acuitas stores in his database, then procedurally generates both questions and statements in natural English. Verbs are conjugated and plurals are matched correctly, articles are automatically added to nouns that need them, etc. Some words in the original sentence skeleton might get replaced with a random choice of synonym.

Visualization of Acuitas' concept-layer memory, 07/29/17

Neither of these major new features is actually hooked into the Conversation Engine yet, so I don't have any conversation examples to show off, but I'm hoping to be ready for that next month.

Code base: 7527 lines
Words known: 1095
Concept-layer links: 1917

Thursday, July 20, 2017

Doing business with China

Not so very long ago, whenever I wanted to build a circuit, I would get a little piece of through-hole board and painstakingly cut all the connecting wires myself. I thought having a circuit board custom-manufactured was something you only did if you had a lot of money and/or were planning on selling the boards at high volume. But apparently I've been behind the curve – it turns out there are a number of services that will manufacture small lots of custom PCBs for cheap. A few of them are so cheap, in fact, that the cost per PCB is probably less than what I would have spent on the silly through-hole prototype board! So I gave custom PCBs a try.

Old (left) and new (right)

<Disclaimer: DCDB says they'll give you a discount on your next order if you mention your completed project online.>

I decided to go with Dirt Cheap Dirty Boards, a service that submits your design to a Chinese board-manufacturing house. For fourteen dollars, you can submit one two-layer PCB layout that fits within a 5x5 cm area, and get anywhere from eight to twelve copies of it. (I got eleven. Supposedly shipments of less than ten boards are pretty uncommon.) Choose your color at no extra charge. A larger area or more layers can be had at an increased cost. Shipping is pricey if you want your boards to arrive on a normal US time frame, but if you're willing to let them throw your order on the plane whenever there's room, it's free. Given the glacially slow rate at which most of my projects seem to progress, this is perfect for me.

The PCB that I had built is a unipolar stepper motor controller. I used the free version of Eagle for schematic capture and layout, which proved to be fairly painless. DCDB lets you directly submit Eagle's native file format, .brd, but they only guarantee good results for an older version of Eagle, so I took the extra step of exporting to Gerber format.

My eleven little boards arrived looking gorgeous. I've assembled and tested most of them, without any problems. Oh, and I even got a promotional sticker in the package. How nice. On the whole, it was a good experience – certainly preferable to my painstaking manual wiring work – and I would order from them again.

Circuit board closeup

Of all the other services I looked at, the only one I remember being price-comparable was Seeed Studio. They'll sell you exactly 10 5x5 cm 2-layer boards for $9.90, with an added charge of at least $2 for shipping unless your total order is over $50. Also, the boards are green; any other color adds $10 to the price. I might try ordering from them in the future and comparing results.

My other recent direct China order went through DealeXtreme ( I specifically wanted jumper cables – you know, those simple colored wires with plastic plugs on the ends, which for some reason seem to end up costing more than the ICs they're designed to connect! But DE actually has them for what I'd consider a reasonable price. I also ended up purchasing some micro-motors and a cheap webcam. After making my order, I was alarmed by the large quantity of negative reviews I read about this website; nonetheless, all my items eventually arrived in good condition.

One frequent complaint made by reviewers is that the postal tracking numbers given by DE are invalid. I learned a couple of things in that regard that might help others who want to try ordering from this site.

1. After they e-mail you the tracking number, you may have to wait up to 48 hours before trying to track your package. Supposedly it can take that long for the Chinese postal service to enter the number in their database.
2. DE will send you a direct link in the e-mail, which you can supposedly click to track your package. These never worked for me. Instead of using this link, go to the main page of the postal service website and manually enter the tracking number in their form. (Use Google Chrome so you can auto-translate the page, if necessary.) All my tracking numbers eventually worked when I did this.

I'd still be nervous about ordering anything expensive through DealExtreme, but based on my experience, they might not be quite as terrible as the reviews will lead you to believe. My order arrived in four separate packages, and I think they all came within about a month.

Until the next cycle,


Sunday, June 25, 2017

Acuitas Diary #3: June 2017

I didn't have any major development goals for Acuitas this month, because I wanted to force myself to do other things, like cleaning the house.  So you just get a bunch of images that came out of me playing with the semantic net visualization algorithm.  I'm fascinated by what disparate final results I can produce by introducing minor changes.  A lot of the variants in this album were made by changing the mathematical function that calculates the size of the exclusion zone (the area where other nodes can't be placed) for each node.

This is the "base" algorithm that I've been using for the past several months. It was starting to look a little messy, so I experimented with modifications.
I love staring at these. They're an example of a computer generating something that is practically relevant to its internal state, but looks otherworldly from an ordinary human perspective.

I tried eliminating a little feature from the algorithm and got this mess. It took slightly longer to draw, too.
Another silly result, caused by forcing the function that establishes the distance between nodes to be a fast-growing exponential function of the node radius.
Another exponential version, with a tamer growth rate.
And this is my new favorite!  More advanced tweaks to the formula for distance between nodes make the largest dots really "dislike" being near each other while still accommodating the little dots ... so the nodes with the most connections start to push away from the central mass and form their own sub-clusters.

Increasing a parameter to make the inter-node distance even larger produces these spidery versions.

Changing the order of node placement makes things messy.

I also wrote some little scripts to help me examine and clean up the less human-readable layers of the memory space, and I expunged some bad information that got in there on account of him misunderstanding me.  Eventually, I intend Acuitas to clean up bad information by himself, by letting repeated subsequent encounters with good information overrule and eventually purge it, but that's not implemented yet.