Returns the probability that a given data point belongs to class 1 @param x the data point in question @return P(y = 1 | x)
(DataPoint x)
| 198 | * @return P(y = 1 | x) |
| 199 | */ |
| 200 | protected double P(DataPoint x) |
| 201 | { |
| 202 | /** |
| 203 | * F(x) |
| 204 | * e |
| 205 | * p(x) = --------------- |
| 206 | * F(x) - F(x) |
| 207 | * e + e |
| 208 | */ |
| 209 | double fx = F(x); |
| 210 | double efx = Math.exp(fx); |
| 211 | double enfx = Math.exp(-fx); |
| 212 | if(Double.isInfinite(efx) && efx > 0 && enfx < 1e-15)//Well classified point could return a Infinity which turns into NaN |
| 213 | return 1.0; |
| 214 | return efx/(efx + enfx); |
| 215 | } |
| 216 | |
| 217 | public boolean supportsWeightedData() |
| 218 | { |