{"action":"created","issue":{"url":"https://api.github.com/repos/jpmml/jpmml-evaluator/issues/8","labels_url":"https://api.github.com/repos/jpmml/jpmml-evaluator/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/jpmml/jpmml-evaluator/issues/8/comments","events_url":"https://api.github.com/repos/jpmml/jpmml-evaluator/issues/8/events","html_url":"https://github.com/jpmml/jpmml-evaluator/pull/8","id":69726580,"number":8,"title":"Allow the computation of averaged class probabilities in pure PMML.","user":{"login":"rriegs","id":1546204,"avatar_url":"https://avatars.githubusercontent.com/u/1546204?v=3","gravatar_id":"","url":"https://api.github.com/users/rriegs","html_url":"https://github.com/rriegs","followers_url":"https://api.github.com/users/rriegs/followers","following_url":"https://api.github.com/users/rriegs/following{/other_user}","gists_url":"https://api.github.com/users/rriegs/gists{/gist_id}","starred_url":"https://api.github.com/users/rriegs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rriegs/subscriptions","organizations_url":"https://api.github.com/users/rriegs/orgs","repos_url":"https://api.github.com/users/rriegs/repos","events_url":"https://api.github.com/users/rriegs/events{/privacy}","received_events_url":"https://api.github.com/users/rriegs/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-21T02:33:46Z","updated_at":"2015-04-21T17:59:04Z","closed_at":"2015-04-21T17:59:04Z","pull_request":{"url":"https://api.github.com/repos/jpmml/jpmml-evaluator/pulls/8","html_url":"https://github.com/jpmml/jpmml-evaluator/pull/8","diff_url":"https://github.com/jpmml/jpmml-evaluator/pull/8.diff","patch_url":"https://github.com/jpmml/jpmml-evaluator/pull/8.patch"},"body":"This commit enables the use of `<OutputField feature=\"probability\">` in classification-type MiningModels with `multipleModelMethod=\"average\"` or `\"weightedAverage\"`.\r\n\r\nAs you mentioned in https://groups.google.com/d/msg/jpmml/Du0QMIYyvko/LV1wc9fsAFQJ and first implemented in 7a4291cdd335d0193289fe6dbe424287988aa783, certain `multipleModelMethod` aggregations can result in non-probability distributions (i.e. values not summing to 1 or not in the range [0,1]), especially if their inputs are non-probability distributions.  However, averages (and weighted averages with weights summing to 1) of probability distributions are always themselves probability distributions.  This can be shown algebraically:\r\n\r\nFor a set of n distributions each over m categories, probabilities p_{i,j} have the property that\r\n\r\n    sum_{1 <= j <= m} p_{i,j} = 1 for all 1 <= i <= n.   // Eqn 1\r\n\r\nThus, for a set of n weights w_i (canonically equal to 1/n), themselves with the property that\r\n\r\n    sum_{1 <= i <= n} w_i = 1,                           // Eqn 2\r\n\r\nwe have\r\n\r\n    sum_{1 <= j <= m} sum_{1 <= i <=n} w_i p_{i,j}       // the sum of the averaged probabilities\r\n    = sum_{1 <= i <= n} (w_i sum_{1 <= j <= m} p_{i,j})  // by the distributive property\r\n    = sum_{1 <= i <= n} w_i                              // by Eqn 1\r\n    = 1                                                  // by Eqn 2\r\n\r\nFor weighted averages with weights not summing to 1, it can also be shown that normalizing the final result is equivalent to normalizing the weights.\r\n\r\nAccordingly, **I would like to request that averages and weighted averages of probability distributions be treated as yielding probability distributions.**  The upshot of this request is that classification-type models with `multipleModelMethod=\"average\"` would be able to yield meaningful OutputFields with `feature=\"probability\"` in pure PMML.  This is important, for example, for obtaining more accurate probability estimates in ensemble methods such as random forests.\r\n\r\nThe `aggregateProbabilities` function **already normalizes the weights of weighted averages and ensures that its inputs have probability type,** so all code change may be focused on a single case statement."},"comment":{"url":"https://api.github.com/repos/jpmml/jpmml-evaluator/issues/comments/94890015","html_url":"https://github.com/jpmml/jpmml-evaluator/pull/8#issuecomment-94890015","issue_url":"https://api.github.com/repos/jpmml/jpmml-evaluator/issues/8","id":94890015,"user":{"login":"vruusmann","id":3462679,"avatar_url":"https://avatars.githubusercontent.com/u/3462679?v=3","gravatar_id":"","url":"https://api.github.com/users/vruusmann","html_url":"https://github.com/vruusmann","followers_url":"https://api.github.com/users/vruusmann/followers","following_url":"https://api.github.com/users/vruusmann/following{/other_user}","gists_url":"https://api.github.com/users/vruusmann/gists{/gist_id}","starred_url":"https://api.github.com/users/vruusmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vruusmann/subscriptions","organizations_url":"https://api.github.com/users/vruusmann/orgs","repos_url":"https://api.github.com/users/vruusmann/repos","events_url":"https://api.github.com/users/vruusmann/events{/privacy}","received_events_url":"https://api.github.com/users/vruusmann/received_events","type":"User","site_admin":false},"created_at":"2015-04-21T17:59:04Z","updated_at":"2015-04-21T17:59:04Z","body":"I merged this pull request manually as commit a0b58990cb.\r\n\r\nThe updated version has been released as `pmml-evaluator` version 1.1.18. It should be available in the Maven Central repository in a couple of hours time."}}