Comments on: Stochastic Optimization in R by Parallel Tempering http://www.lindonslog.com/programming/stochastic-optimization-r-rmpi-parallel-tempering/ Sun, 27 Nov 2016 15:23:00 +0000 hourly 1 https://wordpress.org/?v=4.6.1 By: Raymond http://www.lindonslog.com/programming/stochastic-optimization-r-rmpi-parallel-tempering/#comment-366 Thu, 17 Jul 2014 06:23:40 +0000 http://www.lindonslog.com/?p=910#comment-366 I read thro this and gone back to your earlier R mpi post,
Sorry, still not sure how to ‘spread’ R process 2 PC (you got cabbage and lettuce).
Shall I just run mpi.bcast…something, it will automatically bcast to all nodes but when did you define the nodes that are avaliable?

]]>
By: fndtenorio http://www.lindonslog.com/programming/stochastic-optimization-r-rmpi-parallel-tempering/#comment-92 Mon, 14 Oct 2013 21:12:07 +0000 http://www.lindonslog.com/?p=910#comment-92 You can ask for the paper here:
nashjc( at )uottawa( dot)ca

]]>
By: fndtenorio http://www.lindonslog.com/programming/stochastic-optimization-r-rmpi-parallel-tempering/#comment-90 Mon, 14 Oct 2013 20:30:42 +0000 http://www.lindonslog.com/?p=910#comment-90 Sure. The problem above is to approximate the function y = 1 / (1 + (5*xi)^2) using a polynomial of degree n. Using n = 10:

require(gaoptim)
require(pracma)

n <- 10 # polynomial of degree 10
m <- 101 # no. of data points
xi <- seq(-1, 1, length = m)
yi <- 1 / (1 + (5*xi)^2)

pfn <- function(p) max(abs(polyval(c(p), xi) – yi))
pfninv <- function(p){ 1/pfn(p) }

## set up a matrix for the polynomial data
ndeg <- 10
ndim <- ndeg + 1
ga = GAReal(pfninv, lb = rep(-1000, ndim), ub = rep(1000, ndim), selection = 'uniform')

ga$evolve(200)
print(ga)

You can use least squares and compare with a GA solution. I received a paper on this, i can send you, just need the email.

]]>
By: admin http://www.lindonslog.com/programming/stochastic-optimization-r-rmpi-parallel-tempering/#comment-89 Mon, 14 Oct 2013 16:33:17 +0000 http://www.lindonslog.com/?p=910#comment-89 Hi Fernando, I can’t get this piece of code as it is here to run – is it missing something? Would you mind posting it again? Parallel tempering does have some issues, specifically the devil is in the details with tuning parameters such as the choice of temperature set and also how large the proposed moves are within each tempered distribution. That being said there are adaptive ideas out there which adjust the proposal size so that you get an acceptance rate of around 40% within each distribution and also rules of thumb about how to choose the temperatures (i.e. geometric). I’m keen to learn about other methods though, so if these genetic algorithms perform well I’ll take a look at them 🙂

]]>
By: fndtenorio http://www.lindonslog.com/programming/stochastic-optimization-r-rmpi-parallel-tempering/#comment-88 Mon, 14 Oct 2013 15:55:57 +0000 http://www.lindonslog.com/?p=910#comment-88 I’m not a expert either, stochastic optimization is natural to understand but very hard to describe the math behind. Sometimes is very hard to design a fitness function, and there’s no guarantee of convergence, limiting the use in real time applications. If the search space is very very large, then it get’s worse. For example, the GA technique is probably fail to solve the Runge function polynomial approximation:

# ga fail (answer is a minimum maximal abs deviation of around 0.06)
require(pracma)
n = 10
m = 101
xi = seq(-1, 1, length = m)
yi <- 1 / (1 + (5*xi)^2)
pfn <- function(p) max(abs(polyval(c(p), xi) – yi))

But there's always a better choice i guess!

]]>
By: admin http://www.lindonslog.com/programming/stochastic-optimization-r-rmpi-parallel-tempering/#comment-86 Mon, 14 Oct 2013 00:14:40 +0000 http://www.lindonslog.com/?p=910#comment-86 I gave your package a try and I have also uploaded the parallel tempering optimization results for your test (“Wild”) function. I don’t have much experience with genetic algorithms, how well do these genetic algorithms perform in higher dimensional spaces? Do they have any shortcomings?

]]>
By: fndtenorio http://www.lindonslog.com/programming/stochastic-optimization-r-rmpi-parallel-tempering/#comment-84 Sun, 13 Oct 2013 21:39:18 +0000 http://www.lindonslog.com/?p=910#comment-84 Genetic algorithms cracks this very fast:

require(gaoptim)
energy.inv = function(theta){-energy(theta)}
ga = GAReal(energy.inv, -100, 100, selection = ‘uniform’)
ga$evolve(100)
print(ga$bestIndividual())

Nice job anyway!

]]>