Friday, April 24, 2009

Fuzzy Logic and the "Brazilian Way"

Fuzzy is all about uncertainty. There is a common "street-smart" expression that I could not forget to mention here. Because Brazilians are, by nature, very flexible regarding their rules. We have an expression that people use every time that they are on the middle of "adapting" our rules to our needs :-). We say that there is always the "Jeitinho brasileiro" (Brazilian way... it is said in a kind and fun manner :-) ).

Anyway, I got back to this expression because it has everything to do with the Fuzzy Logic. I'd say that Fuzzy logic is the "Jeitinho Brasileiro" for logical expressions.

For Example:

One could say : "I like that girl, she is 1.62 meters tall, 56.5 kilos, her eyes are 78% black".

This would be the traditional mathematical/straight way of saying it. It is a precise description that lets no doubts. Any normal person would hear that and laugh because only a complete geek would describe a girl like that.

With Fuzzy logic, the description would be more like: "I like that girl, she is about one and a half meters tall, a little more than 50 Kilos, her eyes are light gray".

As it might be noticed, the fuzzy description is a lot more human friendly than the first one. Humans are imprecise by nature. Fuzzy logic fits on situations that precision is not required or when it is impossible to have it.

I could go forward and explain the Fuzzy Sets but today is Friday night and I'm not desperate to keep updating the blog. I may get back to this subject next week :-)


Monday, April 20, 2009

i-Ryodoraku has been released

Hi Everyone

Great news for our Babs2Go again. Apple just approved yesterday our latest application. i-Ryodoraku is our first app on the medical category. After helping me with my i-NVADERS, my wife asked me to bring Ryodoraku to her iPhone. Making a long story short, I translated this application from Java to Objective C. I developed this application a few years ago just for her own use during her practice. Now that she has an iPhone, she said she really needed to have this application ported. In this case, why not turn it into a real app? That is what I did. Hopefully, more people will have the chance to take advantage of it.

First, let's first understand what Ryodoraku is. I'm not an acupuncturist myself, but if you have questions, I'm sure that my wife will be able to answer them. As a regular IT guy, Ryodoraku is one of those techniques that sounds like magic to me. It amazes me every time that I see her using it.

The purpose of this technique is using the chart to diagnose health problems and propose treatments. The practitioner uses an special equipment (looks a lot like an adapted multimeter) to measure the energetic levels on several acupuncture points (24 total). Those values are plotted in a special scale inside the Ryodoraku chart. After plotting the points, the practitioner has a clear picture of the current energetic state of the patient.

Following the Ryodoraku rules, two boundaries are drawn. Those borders limit the normality area. Ideally, every single value should be plotted inside that area. Depending on what points are left outside, Ryodoraku indicates symptoms and treatment. Even more impressive to my computer-oriented brain, is that the system not only suggests the correct symptoms on the most of the times, but it also propose acupuncture treatment in order to bring those "bad" points back to normality. Even more surprising is that if a second chart is built right after the session, it is very likely that the energetic levels will get back to normal or will clearly move into that direction.

Anyway, in my opinion, Ryodoraku is one of the most helpful techniques on acupuncture. However, several practitioners do not use it because it requires lots of manual work. Hopefully, i-Ryodoraku will enable practitioners with the tools they need to improve even more their patients' lifes.

As aways, if you find anything wrong or if you have any suggestion of improvements, just let me know and I will do my best to include those on the next release.


Thursday, April 9, 2009

Brain Storm on Artificial Intelligence

Hi Folks

Here is the formatted/filtered versin that I will bring to the AI class. Send to me any comments if there is anything too crazy.


Friday, April 3, 2009

Artificial Inteligence - Computer Feelings

Hi Folks

This is the 1st draft for a paper that I'm writing to my Artificial Intelligence class. This has been a very pleasant class so far. Hopefully you will enjoy reading it as much as I enjoyed writing it.



1 - Introduction

Over the last three weeks, the AI classes went from classical to modern. The skeptical people got even more skeptical and the romantic people got even more excited. Based on History, IA has been a continuous cycle of frustrations where Objectives and Expectation have been continuously frustrated by reality. Neural networks have been made out of geniality sparks, frustrated by one man's opinion (Minsk) and raised from the dashes to keep fighting an endless war. Not much seems to be written on stone about AI, however, there are a few facts to come: Current AI system seems to be on one of two categories: 1) Play a magician role where computers try fooling a human being (Turing Test); or 2) Computers are used to classify input and generate outputs (what is considered intelligent because it is similar to some of the Human's behavior). Neither of those categories are exciting enough to bring AI to a brilliant romantic future. For skeptical people, the main goal to be accomplished would be finding new applications to the current technology, train the neural networks and watch them solving specific problems (nothing like C3PO interacting with Skywalker). For the romantic enthusiasts, this only means that the field is still wide open to build a real thinking machine.

A rough time-line for AI could be drawn starting with Alan Turing. That was possibly the first time a person recognized the possibility of inserting intelligence into a machine as we know of. The basic idea behind the Turing test would be verifying experimentally if a computer brain could mislead a human in such a way that the human subject would not be able to distinguish if he/she has been communicating to another Human or a machine. This idea has defined the first reported method on how to qualify if a machine could be considered intelligent or not. This method is not unanimously accepted but it is considered the mark that starts the AI field.

As the time goes by, the classical age objective was building an artificial intelligence that would be capable of simulating the entire Human Cognition and Rationale. No need to say that they got into a dead-lock; Since Humans are building the machines and Humans themselves have absolutely no idea on how their intellectual processes work, they have not been able to reproduced that condition on the computers yet. Getting a little closer to reality, researchers have narrowed down their scope on the Romantic age. This second cycle brought to live the expert systems. On this attempt, scientists were using computer to mimic human experts solving specialized problems in their field of expertise. Inside this cycle, it is possible to find success stories. However, the complexity around accumulating and organizing the set of rules to enable the expert systems ended-up causing frustration and brought scientists to the Modern Age.

The Modern age was marked by the Neural Networks. When mathematicians brought to life the concept of an artificial Neurones, the possibilities around those models seemed end-less. Several Neural Network definitions can be found on the literature. A simple description of a Neuron can be seen next:

Figure 1: Artificial Neurone Model

On figure 1, one may realize that an artificial neuron is composed by three main parts. input signals, Summing Junction + Activation function and Outputs. Since this is not a biology paper, here is what happens from the computational perspective. Building a Neural Networks is, from a 20.000 feet perspective, a really clever way to design mathematical functions. Each of the synoptics have one associated input and one associated balance factor. In order to agglutinate the received information, the core runs a balanced sum of its input. The input "importance" is weighted on the equation by the factor associated to its entry synoptics. This way, does not matter how many inputs there are, the core will aways have a single value as its input. That single value is used as input to an activation function. The activation function could be considered the "cell activity". The activation function is influenced by the inputs on each synaptic and also by a threshold. The result of the activation function is the output of the neuron.

The neurone itself is a model, the clever part is how it can be trained to generate the required results. Assuming that there is a set of inputs and outputs (from now on called the "training kit), the training of a neural network consists of entering the input values into the artificial neurones and evaluating their outputs. If the neurone cannot match a particular output to its input, the balance factors of the synoptics are adjusted until the proper combination is found. If the neuron can generate proper outputs for the entire training kit, the neuron is considered trained and the "intelligence" to solve the problem is saved into the system. This way, one has just created a mathematical function that matches the desired inputs to the desired outputs. A special features that come with the neuron model is that, after trained, as a mathematical function, it can extrapolate that knowledge to guess intermediary values for inputs that were not part of the original training kit.

Assuming that several of the Human behaviors are not much more than action and responses (I'm hungry -> I have to eat, I feel pain --> I have to protect myself, etc), Neural networks have found a good fit on that area. Of course that the Human Being, at first sight, seems to be a lot more than just action and response. In this team opinion, the neural network could be seen as a good step on the right direction.

The Turing test and the Action/Response perspective ended-up being a good match. This is the closest that Man was able to get to the Intelligent Machines. By several different training techniques, artificial personalities have been developed. They get very close to pass the Turing test. However, even that widely accepted, the Turing Test may not be enough to really qualify intelligence. For example, let's bring the test to the following scenario:

a) keep a human painter in a room

b) keep a monkey on the second room

c) the Human judge will be a painter and will communicate to a) and b) only by looking into their paintings.

If the exercises involves a free-form of modern art (pretty much only random drops of painting on a frame). There is a chance that the human judge will be miss leaded to believe that the monkey is actually a human. Would this mean that the monkey is just as intelligent as a human?

On a few exercises with on-line personalities (, it is possible to dream with a real artificial intelligence being made. However, one can realize right away that the artificial personalities are not real. There is a very clear lack lack of awareness of the world. As good as their knowledge base is, they cannot provide context and temporal realization yet. If one asks Hall about a TV show, it will promptly tell you that it loves "Seinfeld". It can tells you a lot about each character and about his favorite, George. However, it gets completely lost when one asks about the show from last Thursday... May be, this is just a matter of expanding the knowledge base but, until them, AI systems like HAL as just playing the magician role...

I consider myself part of the Classical thinkers of the Artificial Intelligence. If there is a real challenge on the Artificial Intelligence area to be accomplished is the creation of an artificial being. This my not be accomplished in my life time, however, this is the real challenge. Using AI techniques to solve other problems are not more than valuable applied engineering. On the next session, since this is not a pure scientific paper (and I do not have a scientific agenda on this area yet), there is going to be a brain storm of opinions and possible technologies that could lead to a potential work on developing a smart computer in the future.

2 - Adding feelings to Computers

I still have no idea why, but Neural Networks sound just right to me. As limited as they may be today, I do not think that they are limited because of any internal reasons. They seem limited because Humans have not been able to use them properly yet.

As great classifiers, their initial role should be composing the computer sensors. Everything from vision, tactile, hearing could take great advantage of the natural Neural Networks capabilities.

Just like the neurone model, a single specialized network is nothing without a proper training algorithm. On the case of enabling a computer to think, feelings and purpose would be required.

Evaluating the Human being, it is possible to realize that everybody is born without a purpose. When a new baby is born, there is absolutely no clue on why he/she was born and what his/her future will look like. Based on external inputs, Humans are driven to find what they like most and what they believe to be their purposes. There is going to be a balance between the boy who has become a doctor just because his father wanted and the other boy who has become a suicide just because he was old enough and still could not find his purpose. Both behaviors might indicate that without purpose, Humans get just as lost as computers. The main difference here is that Humans' "firmware" is designed to make sure that Humans keep looking until a purpose is found.

Moving to the theory ground, a "clean" brain could be compared to a neural network with specialized areas for all sensors and memory. As describe before, the single algorithm to be hard-coded would be one that enables the network for finding its purpose. However, there is a key part of this concept that is missing. Sane people do not drive their actions only by external inputs. They use their feelings (just like me saying that Neural Networks sound good without knowing why) in order to validate their actions. In this case, feelings need to be part of the system.

Reviewing the Human feeling, they are abstract by definition. In this case, they can be evaluated by their side-effects. In general, they allow people to do things that they would not normally do if they were not "taken" by their feelings. For example, a regular boy whose main exercise is playing IPhone games on his coach would run like crazy if he had to run away from a wolf on a forest. A normal guy plays a foolish role by singing on his girlfriend's front-window just because he is in-love, etc.

By abstracting those effects, one could propose that feelings are internal driven actions that over-rule or mislead the common sense in order to allow humans to reach their purposes.

Let's assume this set of feelings and their associated functions:

1) Hungry
2) Happy
3) Excited


Figure2 - Pertaining functions for Computer feelings

As you can see in Figure 2, it uses fuzzy logic to define its value, and as such, each feeling overlaps with each other. The Excited state might even bring all other states to their balance levels in case it goes very high. In this case, the computer firmware would be designed to train the neural network to make sure that those "feelings" are kept as long as possible on the balanced state.

Since the emotion qualifiers have been set. It is time to enable the computer to trigger them. The initial state of the brain would be totally random (or shaped by the species evolutionary path). The fact is that the weights from each neurone would be different for each individual. A specific area could be called "talent" area. That area would be hard-wired to the feeling counters. This means that whatever outputs of the neurones get generated on the talent area would have immediate effect on the feeling counters. For example, the Hungry counter could be associated to a sensor monitoring the computer battery level. However, if the computer finds something that it "Likes" or that makes it "Excited", the lack of battery would not be realized until it leaves the current state or an emergency alarm is generated. It would be same as people studying all night long, without sleep, just because of the fear of going bad on the test that will take place on the next morning. Crazy, but reasonable.

The diversity among these artificial beings would be dependent on the topology of the "talent" area. The talent area would be an area with non-supervised learning area. In fact, the learning process would barely have a place there. Computers would be born with the talent just like Humans are. From an anonymous source, I heard that a Human can become an expert in any area; however, if he/she decides to become an expert on its talent Area, he/she will certainly become a genius. This statement would also be true for artificial beings.

The secondary purpose of those new beings would be getting as much information as possible in order to be helpful to their society (do what your father tells you to do). The primary purpose would be making sure that the basic feelings are balanced (follow your feelings). The common sense would be balancing the society needs (do not hurt anyone) and the internal needs (just because it pleases you). The talent area would be responsible by enabling the systems to "like" special subjects. By having their "body" functions enhanced by the talent areas, their firmware would drive their actions to do/learn more of whatever it is causing those feelings. This way, just like Humans, neural networks would be able to learn anything, however, whenever the talent area gets excited, it would be able to learn and do things that it was not designed to.

3- Final comments

As science fiction as it might sound, it makes sense. There is no intention here to state that this is the right way to evolve the AI area, neither it is just a crazy thought that, hopefully, nobody will care to read it. As previously stated, this is supposed to be a brainstorm exercise on how a smart brain could be designed.

As not many things seems to be written in stone on AI, hopefully this paper has been able to reach some of the kids who will not be born in 10 to 15 years from now and enable them with their technology to move one step closer to the truly Artificial Intelligence beings.

-Luciano Fagundes