part of education series: connecting the dots

Solve Problems with Machine Reasoning

by Paula Perez

Presentation Notes

See footer ↓ for page detail.

Table of Contents is ↖ upper left – navigate from there.

Presentation works on 💻 & 📱.

Attachments include information that complements slide content. The following uses playful “lorem ipsum” style text to illustrate presentation of additional information.


Abbervail Dream
Blue Diamonds
Bright amazing and wonderful
Dancing around the flames
Everybody knows bird is word
Caramel Sensation
Dairy Cream
Frosty the snowman is a boss
Girls just want to have fun
Got some popsicles in the cellar
Elusive Enchantment
Fat Chance Cinnamon
Insomnia gives me time to
Inspiration slaps me in the face
Last chance for one last dance
Good Luck Charm
Hershey's Kiss
Laugh all day for no reason
Life is a box of chocolates
Live like there is no tomorrow
Ice Cream Mix
Jack Daniels
Make it up as you go
Moms cookies make everything
My room is an organized mess
Kitty Hawk
Last Man Standing
Pluto is still a planet
Six words can mean the world
Sleeping with a giant bear
Made You Look
Nabisco Cracker
Sour candy makes me twitch
The sky is not the limit
There always gonna be another
One in a Million
Peach Blossom
There no place like grandmas
Why whisper what you shout
Your the apple to my pie

How to know …

Will my food conflict with my medicine?

Will I like the flavor of a combination of specific foods and beverages?

How do I find information about a product that doesn't fit on its label?

Have you ever wondered whether the drugs you consume daily, such as blood pressure medications and antihistamines, interact with one another?
Drug, supplement or food affect how medication stays in the body, often by stimulating or inhibiting the production of specific enzymes in the liver or intestine.
Enzymes play an important role in metabolizing drugs and interactions can make a drug more powerful, whereby a standard dose can become an overdose or it can be rendered less potent or ineffective.
Several foods can also block or stimulate the enzymes that break down drugs.
The human body also breaks down drugs differently.
How to organize information so we can determine whether chemical interactions (drugs, supplements, flavors) are what we want — or what we don't want?
In this graph, biomedical concepts such as drugs, diseases, and side effects are represented as entities, while the edges in the graph denote their respective relationships.
For example, an edge between two drug entities might indicate a potential drug–to–drug interaction, while an edge between a drug and a disease entity might describe a treatment.
We organize data into similar graphs to “connect the dots”.

data: Knowledge: wisdom:
information: insight:

Human Logic

Humans use logic to connect the dots and make decisions.

You use logicical reasoning for simple problem solving.

It's a cognitive skill we benefit from in all kinds of situations.

Data
Data is raw.
It simply exists and has no significance beyond its existence (in and of itself).
It can exist in any form, usable or not.
It does not have the meaning of itself.
In computer parlance, a spreadsheet generally starts out by holding data.
Information
Information is data that has been given meaning by way of relational connection.
This “meaning” can be useful but does not have to be.
In computer parlance, a relational database makes information from the data stored within it.
Knowledge
Knowledge is the appropriate collection of information, such that it's intent is to be useful.
Knowledge is a deterministic process.
When someone “memorizes” information (as less–aspiring test–bound students often do), then they have amassed knowledge.
This knowledge has useful meaning to them, but it does not provide for, in and of itself, an integration such as would infer further knowledge.
For example, elementary school children memorize, or amass knowledge of, the “times table”.
They can tell you that “2 x 2 = 4“ because they have amassed that knowledge (it is included in the time table).
But when asked what is “1267 x 300“, they can not respond correctly because that entry is not in their times’ table.
To correctly answer such a question requires a true cognitive and analytical ability that is only encompassed in the next level … insights.
In computer parlance, most of the applications we use (modelling, simulation, eetc.) exercise some type of stored knowledge.
Insights
Insights is an interpolative and probabilistic process.
It is cognitive and analytical.
It is the process by which you can take the knowledge and synthesize new knowledge from the previously held knowledge.
The difference between understanding and knowledge is the difference between “learning” and “memorizing”.
People who have understanding can undertake useful actions because they can synthesize new knowledge, or in some cases, at least new information, from what is previously known (and understood).
That is, understanding can build upon currently held information, knowledge and understanding itself.
In computer parlance, AI systems possess understanding in the sense that they are able to synthesize new knowledge from previously stored information and knowledge.
Wisdom
Wisdom is an extrapolative and non–deterministic, non–probabilistic process.
It seeks to give us understanding about which there has previously been no understanding.
Unlike the previous four levels, it asks questions to which there often is no easily–achievable answer.
Wisdom is the process by which we discern, or judge, between right and wrong, good and bad.

Machine Logic

Machines use logic too, that's how they solve problems.

Logic is one of the components used in many computer algorithms, such as ones that decide what Netflix film you will want to watch next.

More about Netflix

Einstein’s Riddle

We're going to show you how to use machine logic to solve a famous riddle. The riddle focuses on deductive reasoning where facts are used to come to a logical conclusion.

If all the facts are true and all the rules of deductive logic are followed, then the conclusion will also be true.

Deductive reasoning

Einstein’s riddle is a logic puzzle that gives sentences relating objects to each other

There are five houses.

  • The Englishman lives in the red house.
  • The Spaniard owns the dog.
  • Coffee is drunk in the green house.
  • The Ukrainian drinks tea.
  • The green house is immediately to the right of the ivory house.
  • The Old Gold smoker owns snails.
  • Kools are smoked in the yellow house.
  • Milk is drunk in the middle house.
  • The Norwegian lives in the first house.
  • The man who smokes Chesterfields lives in the house next to the man with the fox.
  • Kools are smoked in the house next to the house where the horse is kept.
  • The Lucky Strike smoker drinks orange juice.
  • The Japanese smokes Parliaments.
  • The Norwegian lives next to the blue house.

The Questions

At the end are two questions about how certain objects relate to each other.

Who drinks water?

Who owns the zebra?

Can you solve the Riddle?

OK, you want to solve this riddle by yourself!
Here is one approach that will help you get started.

We need three tools to solve the riddle using machines

An editor to compose statements in machine format.

An ontology to encode statements in machine format.

A reasoner to solve the problem (find missing information).

Editor

Our editor is an Integrated Development Environment (IDE).

The editor we use is called Protégé , developed by Stanford University.

Many communities use Protégé to build ontologies that express complex relationships.

Protégé
Protégé provides a graphic user interface to define ontologies.
Protégé is developed at Stanford University and is made available under the BSD 2-clause license.
Investigate Protégé here .
Below is a Protégé screenshot from the Human Phenotype ontology.

Ontology

An ontology is a representation of shared knowledge that machines can read and understand.

The information is divided in classes.

For example, in Einstein’s riddle, a class would be the nationality (Spaniard, Ukranian, etc.)

What is an Ontology?
Data is how we express our observations about fine art, scientific experiments, government policies or food and drugs, and is effectively mankind's most powerful tool. As humans, we use text and numbers to communicate this data in a way that other people would understand.
Machine use a different language to express data. They use lists of entities, their properties and their relationships in order to understand human observations. A way to encode this knowledge in a machine–readable way is called an ontology.
Tom Gruber authored a widely accepted definition for ontology:
In the context of knowledge sharing, I use the term ontology to mean a specification of a conceptualization. That is, an ontology is a description (like a formal specification of a program) of the concepts and relationships that can exist for an agent or a community of agents.
How is information stored in an ontology?
As human beings, we put objects into categories.
Similarly, ontologies use classes to store objects. Objects in classes can be related to each other.
There are also subclasses, when each and every member of one class is also a member of another class. There can be more than one subclass for any given class.
When two classes do not have any element in common, they are called disjoint . A goal of ontology engineering is to keep sibling classes pairwise disjoint.
How are objects’ relationships stored?
Objects can be related to each other by different types of relationships.
Other relationships describe how one object develops into, or is transformed into another object while retaining its identity.
One type is the part of relationship. Part of is used to describe how objects are parts of, components of, or regions of other objects.
Another relationship is the derive from . The derive from relationship describes how one object changes into another object with a change of identity.
Another relationship describes how a discrete object can participate in a process object.
These relationships give structure to descriptions of a world of objects.
How to describe an object or class?
We also need to make statements about classes. For example, Helium was discovered in 1894.
When describing the elemental form of an atom such as Helium, statements about the discovery date and industrial uses are about the class — not about the objects in the class.
How to recognize an object or class?
We also need to agree about how to recognize members of a class — inclusion conditions (rules).
We are concerned about two types:
1. Necessary Conditions. These are conditions that an object must fulfill. But fulfilling this condition is not enough to recognize an object as being a member of a particular class.
2. Necessary and Sufficient Conditions. These are conditions that an object must fulfill and are sufficient to recognize an object as being a member of a particular class.
For example, each and every organic molecule of alcohol must have a hydroxyl group.
However, an organic molecule described as having a hydroxyl substituent is not sufficient to classify that molecule as an alcohol.
But an organic molecule with a saturated backbone and a hydroxyl substituent on that backbone is included in the alcohol class (according to the IUPAC “Gold Book”).
When defining an object, an ontology makes distinctions.
That is why a formal ontology needs to make distinctions rigorously .

Reasoner

Reasoners are able to make the connections between different objects in an ontology.

It does not predict the future, but it connects the dots.

In our Einstein’s riddle, a reasoner is able to infer that if the Ukranian drinks tea, he does not drink water.

Reasoners

Reasoners are computer programs that can infer logical consequences from a set of facts (axioms), which are usually the data stored in an ontology.

For example, the following fact: “a Student is a Person”, can be expressed in an ontology. The fact: “Bob is a Student”, can be stored in a database. A reasoner is able to infer the following implicit fact: “Bob is a Person”.

But before discussing reasoning, we need to introduce two concepts:

Closed World Assumption (CWA)
Open World Assumption (OWA)

CWA is the assumption that what is not known to be true must be false. This is applied when a system has complete information, such as airline reservation systems.

OWA is the opposite. OWA is the assumption that what is not known to be true is simply unknown. It applies when a system has incomplete information. For example, if a patient’s clinical history does not include a particular allergy, it would be incorrect to state that the patient does not suffer from that allergy.

Unlike an ontology, reasoning rules operate under CWA.

This means that whatever is not derivable from a set of reasoning rules is considered false, but may be subject to change if further knowledge is gained.

In other words, like a database, a reasoner will only infer new information from existing information that has been recorded.

A reasoner does not predict what might happen in the future.

A reasoner connects the dots as they exist today.


Description Logics

For Description Logics we begin by defining Concepts. In our example, Concepts are people.

Woman ≐ Person ∩ Female
Man ≐ Person ¬ Woman
Parent ≐ Mother ∪ Father

In this case our Concepts are Person , Woman , Father , and Mother . We express relationships among each Person with symbols:

definition: ≐
conjuction (and): ∩
disjunction (or): ∪
negation (not): ¬
nested expressions: (  )

At this point we also need to introduce:

Childless ≐ Person ∩ ¬ Parent

so that we can relate Children to Parent when we want to talk about our children.


The next step is to define the Roles performed by each Person .

Mother ≐ Female ∩ ∃ hasChild.⊤
Bachelor ≐ Male ∩ ¬ ∃ hasSpouse.⊤
Uncle ≐ Male ∩ ∃ hasSibling. Parent

The new terms and symbols are:

roles: hasChild, hasSpouse, hasSibling
universal concept ("top"): ⊤
existential restriction: ∃

Now we'll introduce a more complex Person and their Role.

Grandparent ≐ Person ∩ ∃ hasChild.⊤
Grandparent ≐ Person ∩ ∃ hasChild. ∃ hasChild.⊤
Uncle ≐ Male ∩ ∃ hasSibling. ∃ hasChild.⊤

One way to define a Concept is to state “what it is” (as we did above). Another way is to state “what it is not” (known as negation).

Male ∩ Female ⊑ ⊥

The new symbols are:

subsumption (sub concept): ⊑
null concept ("bottom"): ⊥

Now let's ask a Person to express emotion.

HappyFather ≐ Father ∩ ∀ hasChild.HappyPerson

The new symbol is:

universal value restriction: ∀

Ancestry

Ancestry is a problem where reasoning works well. If we define a grandmother, her children and children’s children, we then can infer which people are uncles, aunts, cousins, and nephews.

Similarly we can figure out all of the people who work for subsidiaries of a given parent without that fact being explicitly documented.

Here is a problem we can solve:


Description Logic Symbol Table
approaches the limit; is nearly equal to
Limit (mathematics)

conjuction; intersection
Intersection

¬
negation
Negation

disjunction
Disjoint union

existential restriction; there exists
Existential quantification

universal concept; (“top”)
Top type

subsumption; subset
Hierarchy - Subsumptive containment

null concept; (“bottom”)
Bottom type

equivalence
Equivalence relation

universal value restriction; for all; for any; for each
Universal quantification

( )
precedence grouping
Precedence grouping

implies; if … then
Material conditional

How do we program a solution?

Organize classes (categories such as nationalities or pets) to make sure they are unique.

Assign the correct class to a relationship (which person has which pet).

Protect against unexpected outcomes such as the houses are placed in a circle.

More about Programming

It is your turn to solve the Riddle. We know the Ukrainian drinks tea.

We know the Spaniard owns the dog.

How many people answer both questions correctly?

Now let's look at how Protégé solves the riddle
The Reasoner is active
Who drinks water?
Norwegian drinks water
Who owns the zebra?
Japanese owns the zebra

Other Applications

Ontologies also have a wide variety of uses, from helping you chose your next Netflix movie, to more scientific applications like learning about cosmic relationships or helping doctors diagnose disease.

A challenge common to many construction projects:
determine the optimal allocation of construction machines for different projects, or in the same project but at different locations.
In the example below, the challenge is to allocate three loaders and three trucks on three different construction sites.
The optimization objective is to minimize the total hourly expenses of the assigned machines and to maximize the loaders’ utilization.
Even in relatively small–scale problems the number of feasible combinations and parameters exceeds human imagination and experience.
This paper uses the Constraint Satisfaction Problem (CSP) properties of the Einstein Riddle to solve a combinatorial optimization tasks in the field of construction.

Other Resources

Want to learn more about OWL, OWL documentation, RDF, RDFa, XML, YAML and Graphs?

See the resources below.

There are several ways to view the programmatic solution of the Einstein Riddle.
Our solution is written in the Web Ontology Language, a.k.a OWL.
OWL is similar to other languages designed for logic programming; languages like Prolog and Lisp.
A way to understand OWL is through pictures — through the symbols used to express logic programming.
Here is “OWL in Pictures” — also known as Visual OWL or VOWL.
Here is the text of the Einstein Riddle OWL ontology.
There are many tools available for OWL programmers (many of whom are night owls).
Using an OWL file as its source, one tool generates documention about the ontology.
Here is Einstein Riddle documentation.
OWL is based on Resource Description Framework (RDF) which is an extension of XML.
Here is a description of RDF in 50 words or less.
OWL, RDF and XML documents are machine–readable — meaning that a computer can act on the information in those documents.
There are other machine–readable documents.
One that is commonly used to describe GitHub repositories is YAML (YAML Ain't Markup Language; nee Yet Another Markup Language)
Here is a YAML description of the Einstein Riddle.
As you see above, OWL and RDF were not designed to be read by humans.
The human–readable solution is called RDFa which is combined with human–readable HTML.
Here is the Einstein Riddle in RDFa.
Other tools read OWL ontology files and generate a graph of the information.
Here is a graph of the Einstein Riddle ontology.

One World Language — many ways to read it and apply it.