Showing posts with label Expert System. Show all posts
Showing posts with label Expert System. Show all posts

Tuesday, May 02, 2017

Real doctoring: more about perception than knowledge

Expert systems were big in the 1970s and 80s, the first golden age of AI. The paradigmatic system was MYCIN, which diagnosed bacteria causing severe infections such as bacteremia and meningitis, and recommended antibiotics. MYCIN "proposed an acceptable therapy in about 69% of cases, which was better than the performance of infectious disease experts who were judged using the same criteria."

MYCIN was never used.


"...  every blue box is a perceptual task"

In hindsight this held some lessons for us about the nature of real-world competence. MYCIN had world-class book-learning but no ability to interface conversationally with actual patients or examine test results. It couldn't do the effective application of assimilated knowledge, something which takes experts in all domains years of experience (as well as eyes, ears, touch and conversational ability).

---

A little gem I get every week in my mailbox: Denny Britz's "The Wild Week in AI".

This week's choice snippet, "The End of Human Doctors – Understanding Medicine", where Luke Oakden-Rayner writes this.
"Story time! Decades ago everyone thought being a medical expert was about knowledge, and computer scientists tried to automate the knowledge base of medicine. The earliest computer system that outperformed doctors was MYCIN, an AI system that was developed in Stanford in the mid 1970s.

"It was knowledge based, codifying the process of identifying the likely cause of infection and choosing a treatment for it in a set of 600 rules. ...

"With the benefit of 40 years of post-MYCIN experience, we can say a couple of things about it:
  • MYCIN worked really well. The system identified an acceptable therapy more often than the infectious diseases experts that they compared it with.

  • MYCIN was never used in clinical practice.
"The standard explanation for this failure to make a clinical impact was that MYCIN required time-consuming manual data input and that the IT infrastructure didn’t exist in the 70s to make use of it.

"But this argument isn’t very satisfying, because those challenges have long been solved. We can automatically mine electronic health records for phrases or keywords to populate our systems, and we certainly aren’t bottlenecked by computation or electronic infrastructure anymore. But we still don’t use MYCIN, or almost any of its successors.

"To understand my take on the clinical failure of MYCIN, imagine going to the doctor for a cough. Your doctor asks you some questions, listens to your chest, takes your temperature and your pulse rate. They send off a sputum sample or blood test. They might even get a chest x-ray. And after all that, how long does it take them to decide on an antibiotic?

"Seconds, probably. Most doctors would barely register the decision as a conscious choice.

"The fact is, the knowledge and decision making part of medicine becomes automatic for doctors. There is a long history of cognitive science research in medicine ... and it shows that senior doctors don’t really think about many of their decisions. They engage in an experience based form of pattern matching. In fact, senior doctors often perform worse if you slow them down and force them to think. ...

"The key point here is that the part of the medical process that MYCIN automated had a negligible cost (measured in time spent). Saving time on a process that takes between seconds and minutes just isn’t worth the effort of overhauling our current systems.

"But all of this does raise an interesting question: what are diagnostic doctors spending all their time on, if not “thinking”?

"Perception. ...

"The revolution that is happening in artificial intelligence can be understood in one idea; deep learning is really good at human-like perception. In fact, deep learning systems now perform around human level in a wide range of perceptual tasks, like visual object recognition and voice transcription.

"And because perception has such a big role in expertise we are achieving superhuman performance in “expert tasks”, like driving cars or playing complex games like Go. It turns out that these tasks were all bottle-necked by perception, not decision making.

"Machine learning guru Andrew Ng has a rule of thumb – “If a typical human can do it in 1 second, so can deep learning”. My experience in medical applications suggests a slight restatement of this rule:
“If an expert can perform a task in less than a few seconds, it can be automated.”
"... Your local family doctor still spends a lot of time looking, listening and feeling. A surgical specialist does too, and relies a lot on radiology and pathology tests. A psychiatrist learns a lot from sight and sound.

So we might be looking at a technology that can do parts of the work of most types of doctors, even if it can’t replace all of the jobs."
I've excerpted quite a bit here - do read the whole article.

Visiting the family doctor must be one of the least productive things anyone ever does - and I mean this in the economist's sense of productivity. The labour-intensive, manual nature of the consultation means that in the UK patients are allocated a mere ten minutes per session and told they must not mention more than one condition.
"I've got this really painful sore throat doctor, and perhaps I could schedule another appointment sometime about this odd lump?"
I imagine the near-future surgery as a quiet library of cubicles where patients interact in privacy with smart doctor-apps. A nurse helps with recommended tests (interpreted by deep-learning systems in the cloud) and a doctor or two handles referrals.

The result? Perhaps a twenty-fold increase in  productivity.

With apps like Babylon* offering pre-screening, healthcare productivity would be all the greater.

So what's holding things back? The interaction model (chatbot-style) is still tedious and leaden. Without access to the patient's medical history and personal data, the dialogue is lengthy, tedious and repetitive.

Any root-and-branch transformation of healthcare would be capital intensive (money!!) and couldn't be attempted until pilots showed that the new process model was effective, user-friendly and safe. As well as cost-effective. Perhaps doctors, despite their many, frequently-stated grievances, would not be totally supportive. Nevertheless I see glimmerings of change.

Ten years minimum - this is healthcare we're talking about.

---

* I tried Babylon as well as Your.MD, one of the leading medical apps, and was not impressed: typing a query into Google still outperforms the specialized apps.

Tuesday, February 07, 2017

The return of (virtual) Shadow

The late Shadow

Chapter 5 of Peter Norvig's excellent "Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp" is entitled "ELIZA: Dialog with a Machine". I have spent the afternoon studying his pattern-matching code and transferring it into an executable Lisp file.*

An example of an Eliza pattern is this:
'((?* ?P) need (?* ?X))
which picks up text before and after the word 'need'.

If you tell Eliza:
'(Shadow and I need a vacation),
the program will match the input with the pattern above, thus ..
(pat-match '((?* ?P) need (?* ?X)) '(Shadow and I need a vacation))
to create a binding
'((?P SHADOW AND I) (?X A VACATION))       ;   (dotted pair) binding
which can then be passed to the output-generating pattern. And so on.

---

But we're not so much interested in Eliza and that Rogerian psychoanalyst. We want Shadow, our much-missed departed cat (RIP July 1st 2016).

The first step is to change the rules: less talk of vacations and how you're feeling about your parents, more about voles. And being sick on the carpet.

The Eliza architecture was criticised, correctly, for being totally vacuous. The emptiness of the 'conversation' led to bored withdrawal after a period depending upon the narcissism of the user.

We can do better.

To add intelligence to Shadow (such a bright cat!) we have to give him knowledge (in the knowledge lies the power) together with reasoning capability.

Peter Norvig helpfully gives us an equation (chapter 16, p. 548 or thereabouts):
Expert System = Prolog + uncertainty + caching + questions + explanations
The Prolog part powers the knowledge-base capturing Shadow's deep understanding of his own likes, light-hearted escapades and more lethal habits; the Q&A allows for his more sensitive, introspective side.

Peter Norvig has a detailed chapter (11 - Logic Programming) where he explains how to implement Prolog in Lisp (interpreted).

I think this is the way to go with chatbots: combine Eliza-style interaction with a little knowledge-based reasoning to add interest and depth, and to steer the conversation. Perhaps a semantic grammar in there somewhere to help extract meaning from the user's input, though personally, given the ungrammaticality of dialogue, I've always put semantics/pragmatics first.

Anyway, watch this space. It won't be quick .. but we will bring him back!

---

* We spent the morning strolling in the sun around Cheddar reservoir.

Thursday, January 12, 2017

John Cook on automated theorem provers

(Source)

Mathematician and computer scientist John Cook restates the orthodoxy on automated theorem proving (ATP).
"When I first heard of automated theorem proving, I imagined computers being programmed to search for mathematical theorems interesting to a wide audience. Maybe that’s what a few of the pioneers in the area had in mind too, but that’s not how things developed.

The biggest uses for automated theorem proving have been highly specialized applications, not mathematically interesting theorems. Computer chip manufacturers use formal methods to verify that given certain inputs their chips produce certain outputs. Compiler writers use formal methods to verify that their software does the right thing. A theorem saying your product behaves correctly is very valuable to you and your customers, but nobody else. These aren’t the kinds of theorems that anyone would cite the way they might site the Pythagorean theorem. Nobody would ever say “And therefore, by the theorem showing that this particular pacemaker will not fall into certain error modes, I now prove this result unrelated to pacemakers.”

Automated theorem provers are important in these highly specialized applications in part because the results are of such limited interest. For every theorem of wide mathematical interest, there are a large number of mathematicians who are searching for a proof or who are willing to scrutinize a proposed proof. A theorem saying that a piece of electronics performs correctly appeals to only the tiniest audience, and yet is probably much easier (for a computer) to prove.

The term “automated theorem proving” is overloaded to mean a couple things. It’s used broadly to include any use of computing in proving theorems, and it’s used more narrowly to mean software that searches for proofs or even new theorems. Most theorem provers in the broad sense are not automated theorem provers in the more narrow sense but rather proof assistants. They verify proofs rather than discover them. (There’s some gray zone. They may search on a small scale, looking for a way to prove a minor narrow result, but not search for the entire proof to a big theorem.) There have been computer-verified proofs of important mathematical theorems, such as the Feit-Thompson theorem from group theory, but I’m not aware of any generally interesting discoveries that have come out of a theorem prover."
However, if you widen the discussion to automated deduction as we see in expert systems, planning systems and pretty much everything Google is trying to achieve, inference is everywhere.

Sunday, August 09, 2015

Simulating your significant other

Talking Angela: a tiresome app
I've told Clare that I'm writing a simulation of her - and that this explains why I spend long hours toiling away upstairs in  my study generating Prolog code.

I'm not sure whether she believes me ...

'Virtual Clare' will not be a chatbot in the mould of Eliza, or modern equivalents such as Cleverbot (try it here). Chatbot conversation is purposeless, vacuous and tedious beyond belief as it mindlessly pattern-matches canned responses*. But, as Ed Feigenbaum at Stanford noted with regard to expert systems, “In the knowledge lies the power.”

There were some expert systems a while back which explored a kind of creativity and learning. Given a comprehensive list of facts and a bunch of rules, they would apply the rules to generate new facts and then use heuristics to weed out those that were obvious, pointless and redundant. The system kind of saw the implications of what it knew. You can see how this might beef up a conversational chatbot's repertoire.

It's impossible for me to replicate the knowledge of an adult person - the significant other simply has had too many experiences, has too many memories and too much knowledge of the intricate web of daily life. The domain of conversation has to be drastically reduced -- for example, to the worldview of a cat.

Yes, notwithstanding Wittgenstein's aversion to the idea, I think Gossip Cat is coming back!

---

* So I guess that makes simulating me pretty easy, then ...

Tuesday, May 12, 2015

Prolog

I was a terrible teacher. All my interest was in teaching those secondary-modern kids maths. This was not, however, their interest; they needed a lion-tamer, not an intellectual. After my Head of Department's nervous breakdown I headed off. The Civil Service seemed uninterested in hiring a member of the International Marxist Group; KBS Computer Services was less picky and so I became a COBOL programmer.

They say COBOL damages the brain - but I speak as a survivor. After some years of commercial programming I made my escape into a research environment (STL) and programmed in the world's best language, LISP.

Alex is a Java developer and has been doing an assessment of various programming and scripting languages. He treats LISP with the utmost disdain, a response I consider unfathomable. To mention the lambda calculus would go right over his head - 'how many transactions per second?' would be his mindset.

I am thinking of playing around with Prolog. Its power and economy are legendary, and there's a neat online guide to writing expert systems in the language. In the past I struggled to conceptualise its depth-first, backtracking execution model. With LISP I could generally figure out what a succinct program was going to do; with Prolog, not so much. But this could change - there is a powerful free system, SWI Prolog to play with.

I have ordered a book which I will use to torment Alex. Sheer professional pride will surely force him to master the unification algorithm and resolution refutation in Horn clauses before the inevitable rejection of the language*.

---

* I don't mind the technical nitpicking - execution speed and memory management, etc; it's the moral disapproval - like 'what kind of idiot would you have to be to prefer this to Java?'