M-5 htm Computer (ver 1.3)

(for Treos & Palms OS 3.5 and above)

Inspired by the work being done at Numenta and Jeff's book On Intelligence

Version 1.3 added 'recognizing' mode. In this mode you can test M5s' ability to recognize objects.

 

---------

M-5 learns by watching. It demonstrates how a device can appear to learn without being 'programmed' for any particular task. In the above example we play a few games of tic tac toe in the learning mode (tap 'next' after each move) then switch to predicting mode and play with M-5. If it recognizes the environment it will enter its next move prediction when you tap 'step', then you enter your next move, etc.. If it is cheating by rearranging the board, you can switch to learning mode and let it watch you play a few more games. (draw by tapping individual pixels to toggle them on or off)

For a nicer looking game board, draw the board on the screen in the learning mode and tap next. Then switch to your Palm memo app and change the number of the M5-x memo to M5-0 (just change the number, there are some blank spaces after the number that shouldn't be removed) also delete the matching M5-Vx memo if there is one. Now when you launch M5 it will start with the ttt board.

On newer Palms, select a Color Theme (like Steel or Autumn) in Prefs to enhance the graphics.

 

If you have followed the work being done at Numemta with their NuPic Pictures demo you might try teaching M5 to recognize objects. One way to do that is to teach little 2 step sequences. Draw a picture for the first grid and draw a number for a category as the second grid, etc. This would represent supervised learning.

With Version 1.3 you can just show it your training images, switch to 'recognizing' and see how it does with partial images.

 

--

Teach M5 to recognize emotions, use a bar graph to indicate happiness or use a M5 happy face as a response to a happy puppy.

 

Simulate touch with the input grid, teach M5 to read Braille.

 

or learn its 1,2,3s

 

Teach M5 to recall phone numbers when shown little icons.

If you haven't erased its memory of the tic tac toe games, it will know that you want to play when it sees you start playing. It can remember lots of things as long as your Palm has room for more memos.

 

Here's an oversimplified example of teaching how to balance a broom. The 'cause' grids would be inputs from tilt sensors. The 'prediction' grids would be inputs from the motion control device indicating speed and direction.

 

M5 can reach conclusions from randomly learned facts.

Here I used letters instead of pictures, I told M5 (1) when Thirsty Drink (2) when Hungry Eat (3) favorite Beer is Bud (4) favorite Meat is Steak (5) you Drink Beer (6) you Eat Meat.

(learning mode, draw a T, press next, draw a D, press next, cycle through modes to end sequence, teach the next fact, etc.)

Predicting mode, tell M5 it's thirsty by drawing a T, tap Run and M5 will follow a train of thought and ask for a Bud ;-)

It can be used for real applications as well as toy problems. Say you need to monitor several gauges in a critical process, you could represent them as bar graphs on the M5 screen. Each morning you could teach the new readings to M5 and teach the Prediction as a second set of bar graphs that represent changes that need to be made to keep the process in line. After some training M5 would know how the process works, recognize trends in memory and predict problems.

If you start with an empty Unfiled category in memos you can beam M5s memos to another Palm or export them from the desktop as a .mpa file to share on the web.

Description...

An interactive platform for Palm OS devices 3.5 and above. The Input and Output environment is a 16 X 16 grid to represent sight, touch, etc.

Modes of operation are Learning, Predicting and Regressing. There are also Step/Next and Run (predict to end of sequence, up to 50 Steps) buttons. You can clear the screen by tapping 'Computer' at the top of the screen or remove all of the memory memos by taping the upper left corner (left of 'M-5'), you will get a confirm yes/no screen (your M5-0 memo template, if you have one, won't be removed).

It learns sequences of what is happening in its environment a step at a time, the present prediction grid was caused by the previous 'cause' grid (which was the prediction of a previous grid).

M-5 can learn many memory sequences of various lengths and use a combination of them to interact with the environment. If you want to teach a different outcome, regress at least 1 step, switch to learn mode, tap next, then start teaching the new memory sequence. If M5 has more than one identical prediction grids it will select the path of the most recently learned sequence.

Implementation...

At the bottom layer, the environment is viewed by a weighted 3X3 directional window that classifies the patterns producing 512 vectors. The next level reduces the 512 vectors to 256. The top level reduces the input vectors to 16 horizontal and 16 vertical integer vectors that represent the state of the environment.

The vector pairs are stored as memos, M5-V1 for the first pair, M5-V2 for the second pair etc. The environment grid is also stored as a corresponding memo M5-1, M5-2, etc. but it is only used to communicate with the environment ( to update the display grid).

All 'thinking' is done with the vectors, they can be thought of as synapse connections. When M5 looks at the environment (grid), the pattern vectors activate m5's memory of what it believes is the most similar environment it has learned and m5 will then display its memory of the following (predicting) or preceding (regressing) environment graphics. When you start M-5 it will use memo M5-0 (if it exists) for the beginning state of the environment.

When you launch the program your screen will be blank for several seconds depending on the number of memory memos.

Teaching M-5...

Tap the mode button to 'learning'

draw the first environment on the screen and tap next. An empty tic tac toe board for this example.

draw an X or 0 on the board and tap next

draw a next move on the board and tap next

continue this until the board is full

Tap the mode button to indicate the end of a sequence

Repeat the above several times showing M5 different ways the game can be played.

 

Teach M5 to get out the Tic Tac Toe board...

tap the mode button to 'learning'

draw a little tic tac toe board on the screen and tap next

draw the large tic tack toe board on the screen and tap next

Tap the mode button to indicate the end of a sequence

 

Teach M5 to respond to you...

tap the mode button to 'learning'

write a big M-5 on the screen and tap next

write a response you expect from M5 such as YES? and tap next

Tap the mode button to indicate the end of a sequence

 

Now you can interact with M5...

tap the mode button to 'predicting'

You could...

write the big M5 on the screen and tap step

M5 should respond with YES?

tell M5 you want to play Tic Tac Toe by drawing the little ttt board and tap step

M5 should get out the big ttt board

Now, if you want to go first, draw your X or O and tap step or if you want M5 to go first just tap step.

or...

just show M5 the big board or a partially completed game and it will start playing from that point. You could also tap run at any time and watch how M5 predicts the game will play out.

 

Teach M5 to find its way out of a maze. Show it the main path out 1 step at a time, switch out of learning mode to end the sequence. Now switch back to learning mode and show it a sequence from a dead end back to the main path and switch out of learning mode to end the sequence. Do this for all the dead ends.

Switch to predicting mode, place m5 anywhere in the maze and tap run, if it needs more steps tap run again.

If we could teach a 2 year old to negotiate a maze and play tic tac toe we would say they were pretty intelligent. Could M-5 be showing a tiny spark of intelligence???


4-16-07 improved interface & removed some glitches..

4-20-07 fixed problem with treo 650 and runs much faster (especially on LifeDrive).

I have made a small change, now when you finish entering a sequence and begin to enter a new sequence it removes the last M-Vxxx vector memo from the previous sequence. That way it doesn't predict into an unrelated memory sequence but the trade off is that it isn't able to regress from a final prediction in a sequence( a possible way around this is to teach the last object in a sequence twice, just tap next a second time on the last object). M-5 updates the screen with the exact image it was trained on but that is just to make an easy user interface. When it is looking for a memory it selects the closest matching vectors and can find memories with only partial data input.

4-27-07

M5 version 1.1 uses invariant representation for position of an object on the grid, if you want it to treat the entire grid as an object turn on the top left pixel (M5 sees an 'object' as starting from the first horizontal and first vertical pixels that are ON and ending with the last h & v pixels that are on). It isn't able to use memos created with version 1.0

5-7-07

Version 1.2 I've implemented the slider to allow setting M5s' degree of uncertainty when predicting. With slider at leftmost position (0) it must find an exact vector match or it wont provide a prediction. With the slider far right (100) it will select the closest matching vectors even if it's a very poor match (takes an educated guess). 'run' now stops at the end of a sequence. Clearing the environment now displays your memo template M5-0 if it exists.

7-23-08

Version 1.3 added 'recognizing' mode. In this mode you can test M5s' ability to recognize objects. First train M5 on some shapes (tap 'next' a second time after the last shape) then switch to 'recognizing' and draw a shape then tap step, M5 will show you the catagory it fits best. Be sure to set the slider to allow M5 to generalize.

Email Gary, gmayhak@aol.com

Tech Center Labs (Bud-Mic microphone module for TX & T5 Palms. Shameless advertising ;)

To teach M5 to play a good game here are some hints...

From Wikipedia, the free encyclopedia

To win or avoid losing in tic-tac-toe requires that the player consistently performs as many of the following actions as possible with each mark — listed in order of priority — without sacrificing the higher priorities: Complete three in a row. Block their opponent from completing three in a row. Threaten a win with two possible completions in two rows. Avoid a configuration in which the opponent can force the win. Threaten a win with a possible completion (two in a row). As second player: Get the center space, if it is not already taken. Prevent the opponent from getting two in a row. To be successful, the player must seek to complete as many of these objectives as possible with a single mark, without sacrificing higher priorities. The player must also think ahead to see whether a mark can be made this turn that will allow him or her to achieve a higher priority in the next turn. The game is won or drawn after the first two marks are made, assuming perfect play for the remainder of the game. It is therefore very important for the serious tic-tac-toe player to study these openings (of which there are 12) in order to avoid making a mark that enables the opponent to force a win, or to recognize marks that can be capitalized upon in order to force the win. The first player, whom we shall designate "X," has 3 possible positions to mark during the first turn. Superficially, it might seem that there are 9 possible positions, corresponding to the 9 squares in the grid. However, by rotating the board, we will find that in the first turn, every corner mark is strategically equivalent to every other corner mark. The same is true of every edge mark. For strategy purposes, there are therefore only three possible first marks: corner, edge, or center. Player X can win or force a draw from any of these starting marks. The choice of which to make will depend on the player's knowledge of their opponent's weaknesses in recognizing good answers to a particular opening. In a series of games, alternating the opening mark and its superficial position can help a player win more often against a weaker player. The second player, whom we shall designate "O," must respond to X's opening mark in such a way as to avoid the forced win. Player O must always respond to a corner opening with a center mark, and to a center opening with a corner mark. An edge opening must be answered either with a center mark, a corner mark next to the X, or an edge mark opposite the X. Any other responses will allow X to force the win. Once the opening is completed, O's task is to follow the above list of priorities in order to force the draw, or else to gain a win if X makes a weak play.