11,731 reputation
24980
bio website
location
age
visits member for 2 years, 10 months
seen yesterday

All code in my contributions on Mathematica.SE, unless otherwise specified, is dual-licensed under CC-by-SA 3.0 and your choice of any one of the following:


1d
comment How to properly (efficiently) define a mixture distribution and optimize the likelihood?
Does Maple do any better on any of these problems, by the way?
1d
comment How to properly (efficiently) define a mixture distribution and optimize the likelihood?
Well, I'm not going to say that you're wrong, because this is your decision to make. But, differential evolution doesn't work like it seems that you think it works; not at all. There are entire books about it that you may find useful. Not that DE is necessarily the best method in general, but I would be confident in saying that it's the best method that's been implemented in Mathematica, if you get the tuning parameters right (even though the implementation is not perfect). Using random search is rather like using Nelder-Mead as in the linked question. They are both pseudo-local optimizers.
1d
comment How to properly (efficiently) define a mixture distribution and optimize the likelihood?
Changing the number of search points does not help for differential evolution. In fact, it can even make matters worse to choose an excessive number. There are also no universal values of the tuning parameters that will work for every problem--global optimization is an open question and major field of research, and you just cannot expect to solve it so easily. Normally one either knows something a priori about the problem, or otherwise, another way to approach it is to meta-optimize the tuning parameters, as I did here.
1d
comment Lower branch of Lambert W function in mathematica
+1, I had exactly the same problem before... the $-1^\text{th}$ branch of this function also comes up when one tries to find the relationship between the pulse energy and pulse duration for a Q-switched laser.
1d
comment How to properly (efficiently) define a mixture distribution and optimize the likelihood?
... work perfectly fine, as expected, although it certainly would help NMaximize if your function also did not return nonsense values like Indeterminate for certain values of the parameters.
1d
comment How to properly (efficiently) define a mixture distribution and optimize the likelihood?
I don't understand how this question differs from the last one that I already answered as a comment, apart from the part about the mixture distribution? I already told you that "SearchPoints" has hardly any useful effect for differential evolution and to modify "ScalingFactor" and "CrossProbability" instead. NMaximize[{mylik[B1997, kB1997], cons}, pars, Method -> {"DifferentialEvolution", "ScalingFactor" -> 0.90, "CrossProbability" -> 0.05}] and NMaximize[{mylik[link3, klink3], cons}, pars, Method -> {"DifferentialEvolution", "ScalingFactor" -> 0.90, "CrossProbability" -> 0.05}] ...
1d
comment Why some built-in functions are slow
+1, but I think this should compare with the same length list having many and few duplicates as well as duplicated items. Without having tested it, I think you might be seeing trade-offs between the $O(n^2 \log{n})$ average case behavior of Union (worst case for pathological lists: $O(n^3)$), the $O(n)$ average case for DeleteDuplicates, and the $O(n^2)$ worst case for the same, which will happen if there are many different duplicated items. (I am guessing about the complexity of Union. It could be just $O(n \log{n})$ average case and $O(n^2)$ worst case, as for quicksort.)
Dec
16
comment How to calculate math expectation
Mathematica 9 can't evaluate this without some help. I didn't try version 10.
Dec
16
comment How to obtain this optimization result?
In the first instance you might like to try "ScalingFactor" between 0.5 and 1, and "CrossProbability" either 0 to 0.1 or 0.9 to 1. (Try both possibilities. Small values are better for separable functions; large ones, for unseparable functions. Intermediate values do not work well in general, but despite this, the default in Mathematica is 0.5.)
Dec
16
comment How to obtain this optimization result?
Generally it is not necessary to use extremely large numbers of search points (at least not with differential evolution; with RandomSearch this may be beneficial). However, the values of the tuning parameters $F$ ("ScalingFactor") and $C$ ("CrossProbability") are absolutely critical to the success or otherwise of differential evolution. Did you adjust those?
Dec
16
comment How to obtain this optimization result?
Try differential evolution, as per this. Your code produces a torrent of errors on my computer, so I can't tell you experimentally what parameter values will be most suitable for differential evolution, but those given in that answer should give acceptable results in many cases.
Dec
15
comment Import/Export a FIT file, Fitness file created by Garmin GPS's and others
Please provide a specification for the file format, otherwise it is a bit much to expect someone to write the format converter...
Dec
12
comment NMinimize tries to find the fit to paramters which are not in the objective function
You asked it to find a value for y. However, since there is nothing to determine y, the fact is that the value it found is completely arbitrary. The reason for it being the same each time is because the random seed is always initialized to the same value on entry to NMinimize, in order for its results to be reproducible.
Dec
12
comment Better answer to Santa's riddle about sum of a number's divisors?
Reduce[x1 x2 x3 == 2450 && 30 > x1 >= x2 >= x3 > 0, {x1, x2, x3}, Integers] (caribou lifespan is approx. 20 years in captivity so we require age less than 30, if we assume that the units are years). This gives a single result of ages 7, 14, and 25, which makes the tree have a height of 46 and Santa is older than 25.
Dec
9
comment Ticks option is ignored when plotting with Frame->True
@YvesKlett I understood the question as meaning that when Frame -> True, the axis ticks are (incorrectly?) no longer drawn and Ticks specification is ignored.
Dec
9
revised Constrained Nonlinear Optimization with expectations functions in the constraints
edited tags
Dec
9
comment Constrained Nonlinear Optimization with expectations functions in the constraints
Very strongly related: (67567)
Dec
9
revised Constrained Nonlinear Optimization with expectations functions in the constraints
tidying up the question
Dec
8
comment Optimiazation method L-BFGS-B
Differential evolution (the most powerful method offered by NMinimize) was invented in 1995, while direct search methods started to be considered respectable for global optimization some time in the early 80s. (The Nelder-Mead method was invented in 1965.) So, really, a paper written in 2003 should not have used BFGS to try to find a global optimum, unless it was also known that the function is uniformly convex. But, if so, (L-)BFGS should not stop. So, it sounds like either a bug or a bad choice of method.
Dec
7
reviewed Close VertexConnectivity and FindVertexCut disagree