Select your font size 
 
about us products & services consulting & support news & events contact us
Discussion of the canonical formula for Bayes Inference.

Deriving Bayes' Theorem - Alaska

print this article 
 

You are now in a position to discuss the canonical formula for Bayes inference. The derivation of Bayes formula follows naturally from the definition of conditional probability using the probability format:

P(A | B) = P(A & B) / P(B)

Using some algebra, this equation can be rewritten as:

P(A & B) = P(A | B) P(B)

The same right-hand value can also be computed using A as the conditioning variable:

P(A & B) = P(B | A) P(A)

Given this equivalence, you can write:

P(A | B) P(B) = P(B | A) P(A)

Simplifying, you arrive at Bayes theorem:

P(A | B) = P(B | A) P(A) / P(B)

Notice that this formula for computing a conditional probability is similiar to the original formula with the exception that the joint probability P(A & B) that used to appear in the numerator has been replaced with the equivalent expression P(B | A) P(A).

Computing the full posterior

Bayesian inference is often put forth as a prescriptive framework for hypothesis testing. Using this framework, it is standard to replace P(A | B) with P(H | E) where H stands for hypothesis and E stands for evidence. Bayes inference rule then looks like this:

P(H | E) = P(E | H) P(H) / P(E)

In words, the formula says that the posterior probability of a hypothesis given the evidence P(H | E) is equal to the likelihood of the evidence given the hypothesis P(E | H) multiplied by the prior probability of the hypothesis P(H). You can ignore P(E) as only serving a normalization role (in other words, ensuring the sum of all the cell probabilities is 1.0). You can thus mentally simplify the equation to:

P(H | E) = P(E | H) P(H)

The prior distribution P(H) in this equation can be represented in PHP as an indexed array of probability values (as shown):

var $priors = array();

The $priors array is expected to contain a list of numbers denoting the prior probability of each hypothesis. In the context of medical diagnosis, the $priors array might contain the prevalence rates of each hypothesized disease in the population. Alternatively, the array might contain a medical specialist's best guess as to the prior probability of each disease under consideration given everything they know about each disease and current conditions.

The exact nature of the full posterior probability computation is made clearer by seeing that the posterior and likelihood terms appear in a PHP implementation as two-dimensional arrays (the closest you can currently get to a matrix datatype in PHP).

Listing 3. The posterior and likelihood terms appear in a PHP implementation as 2D arrays
<?php

// $m denotes the number of hypothesis
// $n denotes the number of evidence patterns

$m = 3;
$n = 4;

$priors      = getPriorDistribution();
$likelihoods = getlikelihoodDistribution();
$evidence    = getEvidenceDistribution();

for($e=0; $e < $n; $e++) {
  for ($h=0; $h < $m; $h++) {
    $posterior[$e][$h] = $priors[$h]
       * $likelihoods[$h][$e] / $evidence[$e];
  }
}

?>

For now, ignore the issue of how the $prior, $likelihood, and $evidence distribution values are computed from raw data. You can posit magical get functions to obtain these values. The previous code shows how the values of the posterior probability matrix are computed by looping over the evidence items and the hypothesis alternatives.

The order of the index elements $e and $h in the posterior matrix might be puzzling until you realize that in PHP the evidence key should appear first in the posterior matrix because it is a lookup key. If you access the posterior matrix using an evidence key $e, it will return an array containing the probability of each hypothesis under consideration (such as, +cancer, -cancer) given the particular evidence key you have supplied (like +test). The code above computes the full posterior distribution over all evidence keys. To compute a row of the full posterior distribution for a particular evidence key, you would use this formula:

Figure 2. Formula to compute posterior distribution
Formula to compute posterior distribution



Page:   1  2  3  4  5  6  7  8  9  10  11 Next Page: Medical diagnosis wizard

The content shown in this page was first published by IBM developerWorks and is reprinted with permission from Paul Meagher (www.datavore.com)


Most Recent Website and Regional Updates

 Transparen Toronto Office Locations
Addresses of Transparen Corporation offices in Toronto, Ontario.

 
 High Scalability - Large Systems Optimization
Transparen Corporation lends its expertise to clients experiencing rapid and sudden growth in traffic or server utilization, bottlenecks, systems instability, downtime during peak traffic, or which would like to plan to avoid such issues.

 
 Throughput (or Bandwidth) vs. Latency
This document uses the example of Bill Gates purchasing Google to explain the difference between bandwidth (or throughput) and latency.

 
 Emergency Management Services
The prototypical emergency involves a shutdown of essential services for a finite period of time. What will your organization do when a world-wide financial crisis strikes?

 
 Fast RAID Server Data Recovery Service
Transparen's Vancouver International Response Team provides the option in Canada and USA to get a raid server back running in hours - eliminating costly waiting associated with typical RAID recoveries.

 
 Data Recovery Service
Have you deleted a mission critical file? Accidentally dropped a computer, or formatted a hard drive? No recent backup? Mistakes can happen, but the data might still be there.

 
 About Transparen
Transparen is committed to serving its clients.

 
 Short Term Forecast - Cape Fairweather to Cape Suckling Coastal Area (Alaska)
Short Term Forecast Issued At: 2009-01-07T14:45:00 Expired At: 2009-01-07T20:00:00 Issuing Weather Forecast Office Homepage: http://paya.arh.noaa.gov

 
 Special Weather Statement - Cape Fairweather to Cape Suckling Coastal Area (Alaska)
Special Weather Statement Issued At: 2009-01-07T00:29:00 Expired At: 2009-01-08T01:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Winter Weather Advisory - Taiya Inlet, Klondike Highway (Alaska)
URGENT - WINTER WEATHER MESSAGE Issued At: 2009-01-07T14:17:00 Expired At: 2009-01-08T15:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Special Weather Statement - Taiya Inlet, Klondike Highway (Alaska)
Special Weather Statement Issued At: 2009-01-07T00:29:00 Expired At: 2009-01-08T01:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Short Term Forecast - Taiya Inlet, Klondike Highway (Alaska)
Short Term Forecast Issued At: 2009-01-07T16:55:00 Expired At: 2009-01-07T22:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Winter Weather Advisory - Haines Borough, Lynn Canal (Alaska)
URGENT - WINTER WEATHER MESSAGE Issued At: 2009-01-07T14:17:00 Expired At: 2009-01-08T15:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Special Weather Statement - Haines Borough, Lynn Canal (Alaska)
Special Weather Statement Issued At: 2009-01-07T00:29:00 Expired At: 2009-01-08T01:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Winter Storm Watch - Haines Borough, Lynn Canal (Alaska)
URGENT - WINTER WEATHER MESSAGE Issued At: 2009-01-07T14:17:00 Expired At: 2009-01-10T03:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Short Term Forecast - Haines Borough, Lynn Canal (Alaska)
Short Term Forecast Issued At: 2009-01-07T16:55:00 Expired At: 2009-01-07T22:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Short Term Forecast - Glacier Bay (Alaska)
Short Term Forecast Issued At: 2009-01-07T16:55:00 Expired At: 2009-01-07T22:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Winter Storm Watch - Glacier Bay (Alaska)
URGENT - WINTER WEATHER MESSAGE Issued At: 2009-01-07T14:17:00 Expired At: 2009-01-10T03:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Special Weather Statement - Glacier Bay (Alaska)
Special Weather Statement Issued At: 2009-01-07T00:29:00 Expired At: 2009-01-08T01:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Wind Advisory - Glacier Bay (Alaska)
URGENT - WEATHER MESSAGE Issued At: 2009-01-07T16:05:00 Expired At: 2009-01-08T06:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Short Term Forecast - Eastern Chichagof Island (Alaska)
Short Term Forecast Issued At: 2009-01-07T16:55:00 Expired At: 2009-01-07T22:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Special Weather Statement - Eastern Chichagof Island (Alaska)
Special Weather Statement Issued At: 2009-01-07T00:29:00 Expired At: 2009-01-08T01:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Special Weather Statement - Salisbury Sound to Cape Fairweather Coastal Area (Alaska)
Special Weather Statement Issued At: 2009-01-07T00:29:00 Expired At: 2009-01-08T01:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Short Term Forecast - Salisbury Sound to Cape Fairweather Coastal Area (Alaska)
Short Term Forecast Issued At: 2009-01-07T16:55:00 Expired At: 2009-01-07T22:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Special Weather Statement - Cape Decision to Salisbury Sound Coastal Area (Alaska)
Special Weather Statement Issued At: 2009-01-07T00:29:00 Expired At: 2009-01-08T01:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Short Term Forecast - Cape Decision to Salisbury Sound Coastal Area (Alaska)
Short Term Forecast Issued At: 2009-01-07T16:55:00 Expired At: 2009-01-07T22:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Special Weather Statement - Eastern Baranof Island, Southern Admiralty Island (Alaska)
Special Weather Statement Issued At: 2009-01-07T00:29:00 Expired At: 2009-01-08T01:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Short Term Forecast - Eastern Baranof Island, Southern Admiralty Island (Alaska)
Short Term Forecast Issued At: 2009-01-07T16:55:00 Expired At: 2009-01-07T22:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Winter Storm Watch - Juneau Borough, Northern Admiralty Island (Alaska)
URGENT - WINTER WEATHER MESSAGE Issued At: 2009-01-07T14:17:00 Expired At: 2009-01-10T03:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Special Weather Statement - Juneau Borough, Northern Admiralty Island (Alaska)
Special Weather Statement Issued At: 2009-01-07T00:29:00 Expired At: 2009-01-08T01:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Wind Advisory - Juneau Borough, Northern Admiralty Island (Alaska)
URGENT - WEATHER MESSAGE Issued At: 2009-01-07T16:05:00 Expired At: 2009-01-08T06:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Short Term Forecast - Juneau Borough, Northern Admiralty Island (Alaska)
Short Term Forecast Issued At: 2009-01-07T16:55:00 Expired At: 2009-01-07T22:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Special Weather Statement - Inner Channels from Kupreanof Island to Etolin Island (Alaska)
Special Weather Statement Issued At: 2009-01-07T00:29:00 Expired At: 2009-01-08T01:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Short Term Forecast - Inner Channels from Kupreanof Island to Etolin Island (Alaska)
Short Term Forecast Issued At: 2009-01-07T16:55:00 Expired At: 2009-01-07T22:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Winter Storm Watch - Inner Channels from Kupreanof Island to Etolin Island (Alaska)
URGENT - WINTER WEATHER MESSAGE Issued At: 2009-01-07T14:17:00 Expired At: 2009-01-09T09:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Wind Advisory - Inner Channels from Kupreanof Island to Etolin Island (Alaska)
URGENT - WEATHER MESSAGE Issued At: 2009-01-07T16:05:00 Expired At: 2009-01-08T06:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Short Term Forecast - Dixon Entrance to Cape Decision Coastal Area (Alaska)
Short Term Forecast Issued At: 2009-01-07T18:15:00 Expired At: 2009-01-08T00:00:00 Issuing Weather Forecast Office Homepage: http://pant.arh.noaa.gov

 
 Winter Storm Watch - Dixon Entrance to Cape Decision Coastal Area (Alaska)
URGENT - WINTER WEATHER MESSAGE Issued At: 2009-01-07T14:17:00 Expired At: 2009-01-09T09:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Special Weather Statement - Dixon Entrance to Cape Decision Coastal Area (Alaska)
Special Weather Statement Issued At: 2009-01-07T00:29:00 Expired At: 2009-01-08T01:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Short Term Forecast - Southern Inner Channels (Alaska)
Short Term Forecast Issued At: 2009-01-07T18:15:00 Expired At: 2009-01-08T00:00:00 Issuing Weather Forecast Office Homepage: http://pant.arh.noaa.gov

 
 Winter Storm Watch - Southern Inner Channels (Alaska)
URGENT - WINTER WEATHER MESSAGE Issued At: 2009-01-07T14:17:00 Expired At: 2009-01-09T09:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Special Weather Statement - Southern Inner Channels (Alaska)
Special Weather Statement Issued At: 2009-01-07T00:29:00 Expired At: 2009-01-08T01:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Short Term Forecast - Misty Fjords (Alaska)
Short Term Forecast Issued At: 2009-01-07T18:15:00 Expired At: 2009-01-08T00:00:00 Issuing Weather Forecast Office Homepage: http://pant.arh.noaa.gov

 
 Winter Storm Watch - Misty Fjords (Alaska)
URGENT - WINTER WEATHER MESSAGE Issued At: 2009-01-07T14:17:00 Expired At: 2009-01-09T15:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Special Weather Statement - Misty Fjords (Alaska)
Special Weather Statement Issued At: 2009-01-07T00:29:00 Expired At: 2009-01-08T01:00:00 Issuing Weather Forecast Office Homepage: http://pajk.arh.noaa.gov

 
 Short Term Forecast - Northeast Prince William Sound (Alaska)
Short Term Forecast Issued At: 2009-01-07T13:45:00 Expired At: 2009-01-07T20:00:00 Issuing Weather Forecast Office Homepage: http://pavw.arh.noaa.gov

 
 Wind Chill Advisory - Northeast Prince William Sound (Alaska)
URGENT - WINTER WEATHER MESSAGE Issued At: 2009-01-07T13:29:00 Expired At: 2009-01-09T21:00:00 Issuing Weather Forecast Office Homepage: http://pafc.arh.noaa.gov

 
 Wind Chill Advisory - Copper River Basin (Alaska)
URGENT - WINTER WEATHER MESSAGE Issued At: 2009-01-07T13:29:00 Expired At: 2009-01-09T21:00:00 Issuing Weather Forecast Office Homepage: http://pafc.arh.noaa.gov

 
 Wind Chill Advisory - Susitna Valley (Alaska)
URGENT - WINTER WEATHER MESSAGE Issued At: 2009-01-07T13:29:00 Expired At: 2009-01-09T21:00:00 Issuing Weather Forecast Office Homepage: http://pafc.arh.noaa.gov

 
 Wind Chill Advisory - Kuskokwim Delta (Alaska)
URGENT - WINTER WEATHER MESSAGE Issued At: 2009-01-07T13:14:00 Expired At: 2009-01-08T02:00:00 Issuing Weather Forecast Office Homepage: http://pafc.arh.noaa.gov

 
 Short Term Forecast - Pribilof Islands (Alaska)
Short Term Forecast Issued At: 2009-01-07T15:17:00 Expired At: 2009-01-07T21:00:00 Issuing Weather Forecast Office Homepage: http://pasn.arh.noaa.gov

 
 Short Term Forecast - Northern Arctic Coast (Alaska)
Short Term Forecast Issued At: 2009-01-07T17:56:00 Expired At: 2009-01-07T23:00:00 Issuing Weather Forecast Office Homepage: http://pabr.arh.noaa.gov

 
 Wind Chill Advisory - Lower Yukon Valley (Alaska)
URGENT - WINTER WEATHER MESSAGE Issued At: 2009-01-07T13:11:00 Expired At: 2009-01-08T03:00:00 Issuing Weather Forecast Office Homepage: http://pafg.arh.noaa.gov

 
 Short Term Forecast - Middle Tanana Valley (Alaska)
Short Term Forecast Issued At: 2009-01-07T16:41:00 Expired At: 2009-01-07T21:00:00 Issuing Weather Forecast Office Homepage: http://pafg.arh.noaa.gov

 
 Dense Fog Advisory - Middle Tanana Valley (Alaska)
URGENT - WEATHER MESSAGE Issued At: 2009-01-07T12:01:00 Expired At: 2009-01-08T15:00:00 Issuing Weather Forecast Office Homepage: http://pafg.arh.noaa.gov

 

Google
 
Web transparen.com

Contact Information

Related Information

 
   
 
E C M | © 2003-2007 Transparen Corp.      

Standardized Services: Data Recovery Service / Creative Services / Premium Web Hosting Services / System Administration Tech Support Services
Recent Projects: Full-Service Mortgage and Financing Company / System to manage flights from Vancouver to Tofino / Photo exchange verification service
Our Vancouver BC Server Proudly Hosts: automated parking and revenue control systems, leafside lane at southlands, cost effective alternative power sources, Higher Grade Learning Centres, pacific forage bag supply, sunburst medical, neosonic design, roger mahler photography - passionate, intriguing, desirable, the connection between east and west, affordable flights to victoria and tofino, low interest mortgage brokers in vancouver, richmond, surrey, toronto, Toronto Calgary and Vancouver IT staffing and talent search
* Adak * Akhiok * Akiak * Akutan * Alakanuk * Aleknagik * Allakaket * Ambler * Anaktuvuk Pass * Anchorage (municipality) * Anderson * Angoon * Aniak * Anvik * Atka * Atqasuk * Barrow * Bettles * Bethel * Brevig Mission * Buckland * Chefornak * Chevak * Chignik * Chuathbaluk * Clark's Point * Coffman Cove * Cold Bay * Cordova * Craig * Deering * Delta Junction * Dillingham * Diomede * Eagle * Eek * Egegik * Ekwok * Elim * Emmonak * Fairbanks * False Pass * Fort Yukon * Galena * Gambell * Golovin * Goodnews Bay * Grayling * Gustavus * Haines * Holy Cross * Homer * Hoonah * Hooper Bay * Houston * Hughes * Huslia * Hydaburg * Juneau (City and Borough) * Kachemak * Kake * Kaktovik * Kaltag * Kasaan * Kenai * Ketchikan * Kiana * King Cove * Kivalina * Klawock * Kobuk * Kodiak * Kotlik * Kotzebue * Koyuk * Koyukuk * Kupreanof * Kwethluk * Larsen Bay * Lower Kalskag * Manokotak * Marshall * McGrath * Mekoryuk * Mountain Village * Napakiak * Napaskiak * Nenana * New Stuyahok * Newhalen * Nightmute * Nikolai * Nome * Nondalton * Noorvik * North Pole * Nuiqsut * Nulato * Nunam Iqua (formerly Sheldon Point) * Nunapitchuk * Old Harbor * Ouzinkie * Palmer * Pelican * Petersburg * Pilot Point * Pilot Station * Platinum * Point Hope * Port Alexander * Port Heiden * Port Lions * Quinhagak * Ruby * Russian Mission * St. George * St. Mary's * St. Michael * St. Paul * Sand Point * Savoonga * Saxman * Scammon Bay * Selawik * Seldovia * Seward * Shageluk * Shaktoolik * Shishmaref * Shungnak * Sitka (City and Borough) * Skagway * Soldotna * Stebbins * Tanana * Teller * Tenakee Springs * Thorne Bay * Togiak * Toksook Bay * Unalakleet * Unalaska * Upper Kalskag * Valdez * Wainwright * Wales * Wasilla * White Mountain * Whittier * Wrangell * Yakutat (City and Borough)