[pymvpa] probabilities from GNB

Yaroslav Halchenko debian at onerussian.com
Thu Apr 26 17:11:36 BST 2018


On Thu, 26 Apr 2018, Richard Dinga wrote:

> Hi,
> I am trying to get a probability prediction for each sample from
> cross-validation. I used .ca.stats.sets to get those, however, for GNB
> these all look like this:

> print cvte.ca.stats.sets[0][2]
> [[-1009.22758728 -1079.77409491]
>  [ -795.59690176 -1038.32481958]
>  [ -875.73917377 -1189.377741  ]
>  ...,
>  [-1483.49338276  -856.61441132]
>  [-1308.29372328  -815.90664933]
>  [-1169.79999768  -737.54291075]]

> I thought these are log probabilities, but after exponentiation, they are
> all 0, although based on accuracy and AUC the classifier works fine.

> Any idea how to fix this or is this as good as it can get? My ultimate goal
> is to get GNB probabilities from GNB searchlight. Trying the same thing
> using SMLR seems to produce valid probabilities (in a sane range and rows
> sums to 1).

> Best regards,
> Richard


Try using setting normalize=True for your GNB.  Here is from GNB? in ipython,
check other parameters which might be relevant:

normalize : bool, optional
  Normalize (log)prob by P(data). Requires probabilities thus for
  `logprob` case would require exponentiation of 'logprob's, thus
  disabled by default since does not impact classification output.
  Constraints: value must be convertible to type bool. [Default:
  False]



-- 
Yaroslav O. Halchenko
Center for Open Neuroscience     http://centerforopenneuroscience.org
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419
WWW:   http://www.linkedin.com/in/yarik        



More information about the Pkg-ExpPsy-PyMVPA mailing list