Home arrow PHP arrow Page 9 - Implement Bayesian inference using PHP, Part 1

Sensitivity analysis - PHP

Have you ever wanted to build an intelligent Web application? Paul Meagher shows how to do it using conditional probability. (This intermediate-level article was first published by IBM developerWorks, March 16, 2004, at http://www.ibm.com/developerWorks).

TABLE OF CONTENTS:
  1. Implement Bayesian inference using PHP, Part 1
  2. Conditional probability
  3. Learning from experience
  4. Conditional probability and SQL
  5. Frequency versus probability format
  6. Deriving Bayes Theorem
  7. Medical diagnosis wizard
  8. Implementing the calculation with Bayes.php
  9. Sensitivity analysis
  10. Resources
By: developerWorks
Rating: starstarstarstarstar / 25
January 05, 2005

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

An important aspect of Bayesian inference involves examining the effect of small changes to your prior and likelihood distributions. If the prior probability values you are using are viewed as best guesses, then you might want to see what happens when you adjust the prior probabilities of each hypothesis slightly. You may notice that this significantly changes the posterior distribution values or it might have little effect. It is good to know how sensitive your results are to the exact prior values (or likelihood values) used.

The final screen of the Bayes diagnosis wizard gives you the options to

  • Start again
  • Re-enter labels
  • Re-enter your priors
  • Re-enter your likelihoods

If you decide to re-enter your priors, the wizard remembers your previously entered likelihoods. After you re-enter your priors, you can click forward to Step 5 without having to re-enter your likelihood values (or you can modify the likelihoods as well). In other words, the design of the Bayes wizard encourages you to engage in sensitivity analysis prior to drawing any final conclusions.

It's only a beginning

Since you have made it this far, you should have a basic understanding of how Bayesian inference works. I will, however, continue to focus on the more general concept of conditional probability and the availability of various techniques, including but not restricted to the Bayes theorem, that you might use to compute a conditional probability value.

One way to compute a conditional probability is by enumeration and you have explored the idea that databases might be good tools to use to compute conditional probabilties in this way. Indeed, these conditional probability computations often form the primitives used in many data-mining applications. I'll present other opportunties to explore the role of databases in computing conditional probabilites in the upcoming articles on Web survey analysis.

Bayes theorem is another method you can use to compute a conditional probability. In this article, I demonstrated what a prior, likelihood, and posterior distribution are; how to estimate the prior and likelihood distributions from raw data; and how you can use PHP to compute the full posterior distribution. To become more skillful in the art of Bayesian inference requires that you become thoroughly familiar with these three concepts.

You've only scratched the surface of Bayes inference. Hopefully this article has provided you a good foundation for exploring more advanced topics in Bayesian inference, such as Bayes classifiers, Bayes learning algorithms, and Bayes networks.



 
 
>>> More PHP Articles          >>> More By developerWorks
 

blog comments powered by Disqus
   

PHP ARTICLES

- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 11 - Follow our Sitemap

Dev Shed Tutorial Topics: