Using log1p instead of log improves the accuracy of the 'subtract xmax'
algorithm when the largest x is very close to zero. Perhaps that is what
is missing in the Rf_logspace_add.
test <- function (x) {
x <- as.numeric(x)
i <- which.max(x)
rbind(Rmpfr = as.numeric(log(sum(exp(Rmpfr::m
It would be nice if the C functions Rf_logspace_sum, Rf_logspace_add, and
Rf_logspace_sub were available as R functions. (I wish the '_sub' were
'_subtract' because 'sub' means too many things in R.)
I think Rf_logspace_sum in R could be a little better. E.g., using the C
code
#include
#include
I am trying to deal with a maximisation problem in which it is possible
for the objective function to (quite legitimately) return the value
-Inf,
(Just to add to the pedantic part of the discuss by those of us that do
not qualify as younger and wiser:)
Setting log(0) to -Inf is often conveni
> William Dunlap via R-help
> on Sun, 6 Nov 2016 20:53:17 -0800 writes:
> Perhaps the C function Rf_logspace_sum(double *x, int n) would help in
> computing log(b). It computes log(sum(exp(x_i))) for i in 1..n, avoiding
> unnecessary under- and overflow.
Indeed!
I had t
Perhaps the C function Rf_logspace_sum(double *x, int n) would help in
computing log(b). It computes log(sum(exp(x_i))) for i in 1..n, avoiding
unnecessary under- and overflow.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Sun, Nov 6, 2016 at 5:25 PM, Rolf Turner wrote:
> On 07/11/16 13:07,
On 07/11/16 15:46, Charles C. Berry wrote:
On Mon, 7 Nov 2016, Rolf Turner wrote:
On 07/11/16 13:07, William Dunlap wrote:
Have you tried reparameterizing, using logb (=log(b)) instead of b?
Uh, no. I don't think that that makes any sense in my context.
The "b" values are probabilities and
On Mon, 7 Nov 2016, Rolf Turner wrote:
On 07/11/16 13:07, William Dunlap wrote:
Have you tried reparameterizing, using logb (=log(b)) instead of b?
Uh, no. I don't think that that makes any sense in my context.
The "b" values are probabilities and must satisfy a "sum-to-1" constraint.
To a
On 07/11/16 14:14, ProfJCNash wrote:
Rolf, What optimizers did you try? There are a few in the optimrx package on
R-forge that handle bounds, and it may be
useful to set bounds in this case. Transformations using log or exp can be
helpful if done carefully, but as you note,
they can make the
On 07/11/16 13:07, William Dunlap wrote:
Have you tried reparameterizing, using logb (=log(b)) instead of b?
Uh, no. I don't think that that makes any sense in my context.
The "b" values are probabilities and must satisfy a "sum-to-1"
constraint. To accommodate this constraint I re-parametr
Rolf, What optimizers did you try? There are a few in the optimrx package on
R-forge that handle bounds, and it may be
useful to set bounds in this case. Transformations using log or exp can be
helpful if done carefully, but as you note,
they can make the function more difficult to optimize.
Be
Have you tried reparameterizing, using logb (=log(b)) instead of b?
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Sun, Nov 6, 2016 at 1:17 PM, Rolf Turner wrote:
>
> I am trying to deal with a maximisation problem in which it is possible
> for the objective function to (quite legitimately) re
11 matches
Mail list logo