My recent update of GAPerm
, which can be used to
perform combinatorial optimization using the Genetic Algorithm approach.
The example below solves a TSP instance with
10 points around a circumference, then plots the results.
Enjoy it!
R, Machine learning and other cool stuff
My recent update of GAPerm
, which can be used to
perform combinatorial optimization using the Genetic Algorithm approach.
The example below solves a TSP instance with
10 points around a circumference, then plots the results.
Enjoy it!
Some days ago i've got stucked in what appears to be a simple task: read some El Nino data, and then plot it. The problem was the data file format, which you can find here: El Nino Data.
There's a mix between 'white space' and '.' characters, so read.csv
or read.table
won't work. It happens this is called a fixed width format, and R has the mighty read.fwf()
function to save us a lot of work. So let's put this into action together with ggplot2!
The code below shows how to use the read.fwf()
function and then it's pure ggplot2 stuff. You just need to call the function: plot.nino()
. Enjoy it!
In this post i want to introduce you to the so called Pacific Decadal Oscillation, or PDO for short. Just to give a short introduction to this huge (and complex) subject, the text below follows straight from Wikipedia.
... The PDO is a pattern of Pacific climate variability that shifts phases on at least inter-decadal time scale, usually about 20 to 30 years. The PDO is detected as warm or cool surface waters in the Pacific Ocean, north of 20° N. During a "warm", or "positive", phase, the west Pacific becomes cool and part of the eastern ocean warms; during a "cool" or "negative" phase, the opposite pattern occurs. ...
We already know that the Pacific Ocean is a pretty big place, so this kind of phenomena should be correlated with climate-dependent variables. To show this, i looked at a 120 months moving average of both the PDO and the Affluent Natural Energy (ANE for short) generated in the Brazilian southeast region. The ANE represents the energy that can be generated from the water that flows to the damns.
Due to it's climate and continental dimension, the Brazilian electricity generation system is characterized by the strong predominance of Hydroelectric generation (about 80% of the installed capacity). The code below plots the data from Jan-1931 to Nov-2012, and we see a strong correlation, despite the fact that the Pacific north of 20° N is far away from the Brazilian coastline.
The PDO and ANE data can be found at JISAO and ONS, respectively. Enjoy it!
Two days ago i just submitted my first R package: gaoptim. For my surprise, the next day it was already living on CRAN.
In this post i want to show you how to use gaoptim to perform a simple
function maximization. This same task could be accomplished with the function
optim()
from the stats
package, but this should serve
as a simple introduction to Genetic Algorithms, which are particularly good when you have a huge search space.
The R code below defines a 'wild' function, with global maximum at about -15.81515. Then we setup a GAReal
object and call the evolve()
function, passing the number of generations to evolve as argument. Finally, we plot the results.
Some planned features for the next package version are: