Thursday, August 14, 2014

New Cognition

Attached is a paper I published in 1995. (Reformatted by copying into the blog editor)

A New Model for the Cognitive Process
Artificial Cognition


Richard Keene - Park City Group
Phone: 801-645-2875
Box 5000, Park City UTAH 84060


(2014 now rmkeene@gmail.com)

Abstract
A theory is presented: That a subsumptive neural system coupled with a semi-randomly connected, teachable, neural net will result in cognitive behavior similar to what appears to happen in biological brains. The paper discusses a new theory of what cognition is, and an algorithm for the simulation of cognition. The topics of what the brain appears to do, why the brain provides the functions it does, and how this could be simulated are discussed. The intent is to arrive at a single unified algorithm that covers all functions of the brain.


1. Why Brains?

It is obvious that the reason that animals have brains is because the brain imparts a survival advantage. Not only does a brain such as the human brain impart a survival advantage, the various stages of evolution that neural systems have gone through also must help the organism survive.

1.1 What are the advantages of neurons

If one studies very primitive creatures, such as the hydra, one finds they have simple networks of undifferentiated neurons. The survival advantage of neurons to such a creature is that information about it’s environment can be transmitted quickly to all parts of the creature. For instance if a small particle touches one part of the hydra the rest of the hydra can respond quickly and close the tentacles before the food gets away. In contrast, a Venus Fly Trap uses chemical diffusion to detect a fly touching the sensor hairs and thus closes rather slowly.
The other advantage of neurons it that the pulsing nature of neurons makes the strength of the signal (pulse frequency encoded) fairly independent of temperature, sugar levels, and oxygen.

1.2 Abstractions of the Environment

As one looks at slightly more complex organisms one finds the neural networks begin to specialize into several types of neurons. The organisms such as the Planarian use neurons to directly arrive at a more abstract representation of their environment and to respond in pre-programmed ways. (The planarian has some primitive learning too but is used here as an example of a pre-programmed organism.) For example a group of neurons could convert “the touch sensors are being stimulated on the left side” to be “there is danger from the left side”. This primitive abstract mapping could then be used to stimulate a reflex movement of the Planarian toward the right, and thus escape being eaten. This ability to have hardwired (unchanging) abstractions and hardwired reflexes imparts a survival advantage.
Another reason for neurons that use pulse frequency encoding also becomes apparent at this level. If a group of neurons is not pulsing then it appears not to exist. If a small genetic mutation causes some new neurons to be created in some rather random fashion, there is a high probability that the organism will still be able to function. The reason the organism can still function is that when the new neurons are not pulsing they appear not to exist, and the organism acts normally. When the new neurons are active the organism will exhibit some new behavior that may or may not impart a survival advantage. This need for neural hiding in incremental designs has been shown with a program called NuTank. See the appendix A for details of the NuTank program and experiment. With neural hiding a neural system can mutate with some finite probability that the mutation will not completely destroy the function of the neural system. This is very different from current computer programs, where a single bit error almost always results in a fatal program crash.

1.3 Subsumption -- A Simple Idea to make Evolvable Complex Systems

Such a system where inputs are abstracted or transformed to new representations of the environment, and the abstractions are then converted to low level output stimuli, is called a subsumptive architecture [4]. Each of the abstractions of the environment in a subsumptive system is called a concept map.
Figure One shows a cut away view of such a system with one slice showing possible concept maps. Sensory neural input come in at the bottom left, and neural outputs to muscles and such come out the bottom right. Note that in biological systems the upward traveling signals are often spatially intermingled with the downward signals. The diagram separates them spatially for clarity. Biological systems seem to have two dimensional concept maps, and three dimensional concept volumes.
As the input signals are propagated upward the inputs from lower layers are transformed into representations of the conditions or attributes of the organism’s surroundings. This results in neural maps of abstract concepts (concept maps or direct concepts)[2]. These concept maps determine what the organism can have a concept of and respond to. An example of a direct concept in the human brain is “red”. The intuitive feeling for the concept “red” is probably manifest by the pattern of neural activity in a single concept map in the visual areas of the brain.
Signal paths in the system may travel part way up, propagate across to the reflex areas and downward. Such a path is called a subsumptive loop or reflex loop. If an upper layer reflex is strongly stimulated it can inhibit lower level reflexes (making them hide) and thus subsume the lower level reflexes.

1.4 Predicting the Future Environment

The second major component of the proposed system is a neural net that can learn by changing it’s connection weights. This neural net is like traditional teachable neural nets [1]. This neural network does not serve as a direct information transformer as the subsumptive system does. Instead the neural network serves to recognize past patterns and to predict the future state of the environment, and then to stimulate (or inhibit) the concept maps into the predicted future state. The strength of this stimulus depends on how strong of a pattern match there is. The network is always learning.
Here is an example of why this is a pro-survival algorithm; An organism detects a certain sound and sight combination, thus setting the concept maps to a certain state, and then is attacked and narrowly escapes. The pattern recognizer now has been imprinted with this pattern to some degree. Later when a similar pattern of sound, and sight occurs the pattern recognizer detects a similarity and stimulates the concept maps partially to the state they were in just after the pattern occurred. (The state of being attacked and fleeing.) Now the organism is reacting to a future state of the environment and this imparts a very big survival advantage. The organism can now learn what environmental states result in danger and react before the actual danger arrives. I have coined the term subsumptive-regular system or SRS for this combination of a subsumptive system and a regular or traditional neural network.

One can extrapolate several characteristics of such a system. (See Figure Two)
The pattern matcher (I theorize that this is what the cortex is) co-evolves with the subsumptive system. This co-evolution causes the subsumptive system to be evolved to have as many abstractions of the environment as possible, and to minimize reflexes. (Since the cortex supplies learned reflexes instead.) Thus most of the human brain would be dedicated to input abstraction and have relatively few hard wired reflexes will cause the subsumptive system to respond to that stimuli, and strong pattern matches from the cortex will cause the subsumptive system to be in a state caused by the cortex. There would be a fuzzy boundary that moves up and down, between where the subsumptive system is representing the real environment and where it is representing the predicted environment. Thus at times much of the brain can be “thinking” about an “imagined” situation instead of the current real environment.
  • There is a very interesting behavior implied in this design. The system can have a repeated cycle of:
  • Do a pattern match on the current state of the subsumptive system, stimulate the subsumptive system into the predicted next state (predicted from the sum total of all past experiences) , and repeat the cycle.
    This is what one calls a “train of thought” or “Cognition”. With such a behavior one can do very complex predictions of the future state of the environment. Such a cycle would not be synchronized in the SRS but would consist of any number of asynchronous cycles.
  • Memory is manifest in such a system. In a digital computer to remember something means to transfer data from disk to memory. In an SRS to remember something means to put the subsumptive system partially into the state it was in at some previous time.
  • Such a system would also be able to work with concepts that are not directly represented in one of it’s conceptual maps. Instead many indirect concepts would be managed as chains and blends of direct concepts. For example the human brain manages to think about money, yet there is no single concept map in the brain related to money. Instead money is a mixture of hundreds of direct concepts that blend into the patterns we associate with money.
  • The learning rate of the cortex can be very low and still result in immediate learning and memory. If 1% of 100 million neurons change by 0.01% when a significant external event occurs, this is equivalent to 100 neural connections changing by 100%. Such a change would result in an immediate pattern match on similar situations.
  • Such a change probably consists of an immediate chemical change followed by cellular growth. As the chemical change fades the growth would make the “memory” permanent.


    2. A New Design and Programming Algorithm

    With the previous concepts one can now define a new way of programming and designing a cognitive system.

    2.1 Set A Goal

    To achieve an artificially cognitive system one must first set a goal to imitate some functions of a biological SRS. For example one might set the goal to create a program in a robot that exhibits much of the behavior of some biological system.
    The very lofty goal of a cognitive system that can carry on a meaningful human conversation would require creating a system that has conceptual maps that cover most of the conceptual maps in the human brain and is able to update them in real time. This is currently beyond the capabilities of current computers. One might create a system that lacks many of the concept maps that humans have but has very good mappings of audio stimulus and could at least talk about limited subjects.
    A very realistic experiment would be to build a system with a single channel of video input, a single robotic arm, an audio spectrum analyzer input, and a synthesizer output. Such a system could be endowed with several hundred direct concepts. One could then put the system in a rich environment and see if it develops learned behavior. This would be an interesting system where one could test various combinations of cortex complexity and the strength of connection of the cortex to the subsumptive system.

    2.2 Designing the Subsumptive System

    Next one would need to design the computer based tools to represent the subsumptive design with a useful notation. One would also need other support tools for visualizing the resulting operational system activity, and debugging. Next one would start at the bottom of the system and develop the subsumptive system from simple concepts to more abstract concepts. This process could be directed by what we know about biological brains [2] and by what direct concepts are desired in the final system. This design process could work in stages developing a simple system and testing it, then adding new concept maps

    1.3 Add the Cortex

    The cortex could be generated with a simple algorithm:
    Randomly choose a neuron in the subsumptive system with the probability skewed toward choosing neurons in the more abstract parts of the subsumptive system. This neuron is the learning neuron’s target. Next make some number of connections randomly to nearby neurons, with diminishing probability with distance from the target neuron, and initialize the weight of the connection to zero.
    By “distance” one means conceptual distance. For example, vision processing functions are “close together” and vision and hearing might be “far apart”. Also low level concept maps are far from very abstract concept maps. The cortex neurons could also connect to other cortex neurons. The design tools for the subsumptive system would need to have some notation of coordinates for each map so it’s “distance” from another map could be determined.
    In the brain the cortex is separate from the subsumptive regions. This may be so the cortex neurons can connect with each other and arrive at second, third and higher order solutions for pattern matches.
    It would be interesting to experiment with truly random connectivity such that the connection probability is global to the system. One also might experiment with deleting connections that have zero weight for long periods of time (days, weeks, months) and creating new connections randomly. This might emulate the connection growth that happens in an infants brain.

    2.4 Teach the System

    Next one must let the system developed learned behavior. In a human starting from scratch until a conversation can be held takes about 4 years learning. An animal such as a dog learns most of it’s behavior in about a year. More primitive creatures have much less learned behavior and so have shorter learning times. An artificial SRS might have a much shorter learning time since it could be awake 24 hours a day and might have much more perfect memory.
    One would want to be able to dump the entire state of the system to permanent storage, add new concept maps, and reload the previous system back in. This would allow previous learning to be carried over into the more advanced system. This is far different from how biological systems progress. Biological systems depend on the next generation to mutate and then start learning from scratch.

    2.5 Proof of the Theory

    This paper has proposed a single central theory: That a subsumptive neural system coupled with a semi-randomly connected, teachable, neural net will result in cognitive behavior similar to what appears to happen in biological brains.
    The evidence that the theory is worth pursuing is intellectual. If one follows the logical path that brains have evolved along one arrives at the SRS theory. This is a different approach from “let’s simulate some cognitive functions” that created rule base systems.
    The other indication that the SRS theory is worth testing is that once one understands the theory one can do a mental simulation of how the algorithm would behave and see that the behavior would be similar to the thought process. The SRS theory also makes much of human behavior obvious. See appendix B for a discussion on human behavior.
    The proof of the SRS theory would be to actually build a reasonably complex system and have it behave as a biological system. The ultimate proof would be to build a system that was not explicitly “programmed” to talk and yet could hold a conversation. This second proof of holding a conversation is very homocentric. Such a system might pass the Turing Test, but the validity of the Turing Test is debatable. It might be possible to create an SRS that can talk yet has very limited conceptual maps. This might be possible on a current super computer. As stated in the goals section above, a good short term proof would be to attach a computer to a simple robot and see if learned behavior emerges.

    2.6 Possible Applications

    If this theory proves out the result would be robotic systems that can behave as biological systems in natural environments, such as woods, jungle, deserts, and oceans. The systems could be given behaviors and sensors that are beyond natural biological systems. If the system does not need to reproduce and it’s food is gasoline then it’s behavior could be much more focused than biological systems. Such a system would be a very good house cleaner, explorer, or war machine. Such a system would probably not be a very good factory worker, unless it could achieve human cognitive levels.

    3. Appendix A - The NuTank Program

    NuTank stands for neural tanks. The program provides a neural editor, a drawing editor, and a two dimensional environment simulator. NuTank is a DOS VGA program. The idea is to design a “brain” for a tank or beast with neurons and see how it reacts in the simulated environment. The tanks can have many inputs such as optical sensors, whiskers, smell, and hearing. The outputs are sound emitters, smell emitters, and the wheels. The tanks can also have jaws that can bite things.
    The theory that a subsumptive design allows for easy incremental modification of the system was well proven while designing the brains in tanks. One could concentrate on behaviors and not worry too much about how they interact. At a later time one could decide to add a new behavior, and not need to modify the lower level behaviors.
    The NuTank program’s neural editor is much like an electronic schematic editor, with blocks representing direct concept maps, and “wires” between block to represent connections. This method of designing a neural subsumptive system has proven to be a poor choice. It appears that a much better design would be a text style editor and a textual representation of each concept map. This would greatly increase the information density of the screen when designing systems, and would localize relevant information. The current “schematic” style design requires too much panning of the screen to trace connections.
    The entire NuTank program is currently being rewritten from scratch as a MS Windows (TM) program.

    4. Appendix B - Human Behavior

    Given that the human brain is a subsumptive system with a pattern matching cortex (Actually the human brain appears to be at least two SRS’s nested one inside the other.) one can see why people have mental problems. The following examples are a bit simplistic. Like Figure one, human psychology is made of many intermingled and complex parts.
    Let’s imagine someone who has been hurt when they were a child. Now they are an adult and the same situation would not be harmful. The person can easily go through the chain of thought and recognize that such a situation is not now harmful. Still when a similar situation occurs the cortex gets a very strong pattern match on the situation and stimulates the related concept maps into the previous state of extreme fear. The person knows it makes no sense, yet feels fear and panic and may act irrationally. This is because the primitive emotional response is not effected by the weaker “chain of thought” that requires several cycles of pattern matching and stimulus. Current psychological theories show that the best way to get over such traumas is to get in a calm controlled environment and “re-live” the experience in one’s imagination. This “re-living” needs to be on an emotional level, not just an intellectual level. Now the cortex gets as similar as possible of a pattern match, but the expected bad events don’t happen. This replaces the previous pattern with a new positive pattern and thus reduces the impact of the original trauma. If one has experience with psychotic people one gets the feeling that the psychotic person is reacting to a script that only they know. Indeed they are, they are reacting to previous patterns that are no longer applicable.
    One factor that can be arrived at only by testing in a real SRS is the ratio of connection strength needed to achieve a balance between awareness of the external world and the imagined world. If one has an imbalance toward too high of stimulus from the cortex (or week stimulus from between subsumptive layers) then one might have something as mild as Attention Deficit Disorder or serious as Autism. In the reverse, if the cortex connectivity is week then the person’s ability to chain thoughts would be hindered. (low IQ)
    A severe trauma could also cause such a strong pattern match--stimulus cycle that the entire system could get stuck in a loop where external stimulus can’t override the cortex pattern match. This would put the person in a catatonic state.

    5. References

    1. Haykins, Simon 1993. Neural Networks, A Comprehensive Foundation, IEEE Press
    1. Konishi, Masakazu April 1993, Listening with Two Ears, Scientific American
    1. Thompson, Richard 1985, The Brain, WH Freeman Pub.
    1. Wallich, Paul December 1991, Silicon Babies, Scientific American
    1. Whole Issue, September 1992, The Mind and Brain, Scientific American

    Photon Soup

    Quite a while back, in 1994 I published some images at SIGGRAPH.  Thought I'd put them here so they are not lost.

    First image:

    This image was generated in 1991 by simulating the motion of 29.8
    Billion photons in a room. The room is 2 meters cubed with a 30 cm
    aperture in one wall. The opposite and adjacent walls are mirrors, so
    this is a 'tunnel of mirrors'. The depth of field is very shallow. In
    the foreground is a prism, resting on the floor. A beam of light
    emerges from the left wall, goes through the prism and makes a spectrum
    on the right wall. About 1 in 177 photons made it through the aperture.

    The image took 100 Sun SparcStation1s 1 month to generate using
    background processing time. This represents 10 CPU years of processing
    time. If the lights are 25 watt bulbs this represents a few picoseconds
    of time.
    This was 'grid computing' way before its time.



    Photon Soup 2

    This next series was done several years later on much faster machines.

    These are made by simulating the motion of 382 Billion Photons in a 2 meter cubed room.  There are aperatures on the walls that capture photons.  These are stereo pairs. The lighter ones are 382 billion photons.  The darker ones are just the prisim to show off the caustics better.

    Front View
    A white beam of light comes in from the wall on the left, hits the prism, and is refracted to a rainbow on the right side wall. BUT... It also is internally reflected and bounces around a bit more and goes throught the clear ball on the right.  If you take the overhead view image that is mostly black below and brighten it way up you can see all the caustics.



    Top View


    Side View


    Front View - Prism Only


    Top View


    Side View


    Tuesday, September 3, 2013

    Failing at Meditation

    So here I sit trying to meditate.

    The dog wants to play.  Go away can't you see I'm meditating? Oh failed again, my mind has wandered off about the dog.

    Back to focusing. Ok, no thought. Hmmm.  It would be so cool to be a Zen teacher. All those students admiring my great mind control.  I could teach them so much about the empty mind and no thought. Failed again, my mind wandered.

    Focus! Just experience what is right in front of me.  Oh, the dog again. The dog is so Zen.  Just right there in the moment.  No thought of the past, future, and no self analysis of the present.  Just being a dog.  Which I was like that. Ah, failed again.

    Ok, be present in my room. The rug.  The table. The wall. The dog. Just as they are.  I remember a cool talk by Gil Fronsdale about not letting the mind wander. He is so cool.  Wish I could be like that. I bet he's rich too. And gets to meditate all day.  Arrrgh, failed again.

    New approach, watch the failures and stay with them.  Just observe what my mind is doing. Ahh, the dog.  Watch how I perceive the dog. My mind wanders.  Let it.  Watch where it wanders and why.  Then I start to think too much.  Why? What is happening? Ah, what desires are pushing my thoughts? Oh 'failure'. Why do I think that? Be conscious of the failure and and the thoughts and feeling of disappointment at 'failing'.

    "Success".



    Friday, April 19, 2013

    The Rules of Engagement

    For Software Developers

    Some rules of working, in particular in start-up companies...
    • I you are self employed or 1099.  Ignore any promises of a bonus to make up the tax differences at the end of the year.  Compared to W2 you must make about 20% more to account for medical insurance, self-employment tax, and in general, risk.  So $50 per hour @ 2000 hours per year, is not the same as $100,000 / year as an employee.
    • Any stock option promises should be discounted to about 10% of what they vaguely quote they will be worth.
    • If you have the meeting... "We are short this payroll, but will get money on Monday and everyone will get paid".  Leave immediately.  If you are not getting paid, do not work even one hour.  It is not about your loyalty to the company, it is about the company's loyalty to you. (Exception: if you own more than 30% of the company then you are the company.)
    • Do not ignore the signs of failure.  There is always the hope that "things are about to get better".

    Monday, August 27, 2012

    Eco-Tripping

    Definition: Eco-Tripping

    To own a 'local' car that is ultra efficient, perhaps electric, with a limited range a speed. When you want to go on a " trip to grandma's " you rent a family van with all the fancy TV and such for the trip.

    The net result is less money spent, and a HIGHER STANDARD OF LIVING.


    Standard of Living:

    What is meant by wealth and standard of living?  These are the combined sum of how much 'stuff' you get for your day's work at some job.  By 'stuff' we mean material position, travel, security (police, fire, safe neighborhood), medical care, entertainment, internet access, recreation, family togetherness, food, clothing, house, exercise.  Notice that money is not in that list.  Money is a future claim on all the above.

    A standard of living item that Americans cling to very tightly is transportation freedom.  Go where you want, when you want, in style.

    There are two ways to raise standard of living: First is to make more money, and second is to get more stuff for less money.

    The Diesel Rabbit Story:

    My first car way back when was a VW Diesel Rabbit.  It was a freedom machine for me because at the time it went very far on very little money.  Going on a trip somewhere was not a big money decision.  The car was a very tangible increase in my standard of living.

    One thing that lowers standard of living is when we worry about some activity we are doing or material we are using.  For example if you have to worry about the cost of gas, global warming, foreign wars fought over oil, then you standard of living is lower. You tend to have a negative mindset about driving anywhere.

    Large Car Costs

    If you currently have a Ford Expedition and haul the kids around in it, and gas hits $5 per gallon, the car becomes a drag on all trip decisions.  "Maybe we could go to the park, but it would cost too much in gas."  Why haul around such a huge car all the time when you only need it twice a year for long distance trips?  Not only is the big car a gas hog, but also repairs, tires, filters, oil changes, transmission, and the whole thing is very expensive. On the flip side if you look at person-miles-per-gallon a big car is very efficient if all seats have people in them.  A Hummer at 12 MPG with 8 people in it is 12 x 8 = 96 person-miles-per-gallon!

    Electric Car Costs

    A very efficient electric car (or gas for that matter) is less expensive, and less costly to repair.  The exception to this is some hybrids where the unique nature of the car pushes repair costs up.  That is a temporary condition.  An all electric car is less expensive to build, repair, and drive. The current lineup of electric cars are expensive because it is new technology. (Remember how expensive flat screen TV's started out?)

    The Electric Car Delusion

    There is  a current impression that electric cars are a reduction in standard of living.  This has been fostered by the automotive manufacturers. The problem is that it is obvious that if electric cars cost less to make, and have virtually no repairs, then selling the same number of cars per year will result in something like half the revenue.  Not a good business direction.  The fallacy is that either way cars are going to change to electric, the question is just when.  Only Nissan and Toyota have fully embraced this fact and are looking toward a future where they dominate the market. (Side note: electric cars can waaaaay out accelerate gas cars.)

    Other Similar Topics

    On a similar vein is how we handle the two largest home uses of energy, heat and hot water.  Both use natural gas and are completely unnecessary. Solar systems, if massed produced, should not cost much more to install, and result in a complete freedom from subsequent cost of hot water.  So take a shower as long as you want.  Once again a higher standard of living on less money.

    Cultural Inertia

    We have a cultural inertia where the way we have been doing things is what everyone knows, and it is difficult to imagine a different way, even if it might be better, more fun, and a 'higher standard of living'.  Instead we are stuck with the tree hugger nightmare where we all are supposed to suffer, trim back, reduce, scrimp and save, drive some eco-car that is no fun, freeze in the winter, bake in the summer and so on.  It is all wrong.  We need to put our creative powers toward how to live sustainably at a higher standard of living

    It can be done.

    TF

    Tuesday, July 31, 2012

    C++ std::list Chop off end of list

    A little code here.

    I have a list of X,Y,Goodness values.  I want to randomly select one entry from the top Goodness entries with some leeway for what 'top goodness' is.

      // Now sort the list by goodness, largest goodness at front.
      fits.sort(compare_PlacementRule_goodness);
    
      // Keep entries within a certain closeness to the maximm value.
      BuildingRect::xyPairGoodness & pg = fits.front();
      float topval = pg.goodness - r->m_placementRuleAllowance;
      // If topval is negative then no elements will get cut out.
      if(topval > 0.0f)
      {
        for(std::list<BuildingRect::xyPairGoodness>::iterator it = fits.begin(); it != fits.end(); ++it)
        {
          float g = it->goodness;
          if(g < topval)
          {
            // Cut rest of list off.
            fits.erase(it, fits.end());
            break;
          }
        }
      }
    
    

    and the compare is

    bool compare_PlacementRule_goodness(BuildingRect::xyPairGoodness first, BuildingRect::xyPairGoodness second)
    {
      // We want the highest positive goodness at the top of the list.
      if (first.goodness > second.goodness) 
      {
        return true;
      }
      else 
      {
        return false;
      }
    }
    

    And as usual the greater than and less than symbols get munged.

    TF

    Monday, June 11, 2012

    Physics Engines

    Ok, a bit of advice earned the hard way...

    DO NOT TRY TO WRITE YOUR OWN PHYSICS ENGINE.

    We decided to go with Havok.

    First we tried Bullet Physics, but it does not handle multiple independent simulation worlds, and our game (The Dead Linger) deals with an infinite world.  So we need to break it up into 1km cubes, each one an independent physics simulation.

    The I spent two months part of which was general game stuff, but much of which was a custom infinite world physics engine.  Eventually we realized that we will never hit our deadline that way...

    So we looked at Crysis (too expensive) and Havok.

    A talk with the Havok engineers assured us that multiple worlds is fine (and yes, it is) and the licensing terms are perfect for a startup like Sandswept Studios.

    So now after 2.5 weeks of effort we are on Havok and working.  The performance is amazing, and the robustness of the player motion among world objects is amazing.

    TF