Description Usage Arguments Value Author(s) See Also Examples
The function read_particles
reads the ‘Particles.txt’ output file, which stores all the parameter sets tested during the optimisation along with their corresponding goodness-of-fit values
The function plot_particles
takes the parameter sets and their corresponding goodness-of-fit value, read by read_particles
, and produces the following plots:
1) Dotty plots
2) Histograms
3) Boxplots
4) Correlation matrix (optional)
5) Empirical CDFs
6) Parameter values vs Number of Model Evaluations
7) (pseudo) 3D dotty plots
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | read_particles(file="Particles.txt", verbose=TRUE, plot=TRUE,
gof.name="GoF", MinMax=NULL, beh.thr=NA, beh.col="red", beh.lty=1,
beh.lwd=2, nrows="auto", col="black", ylab=gof.name, main=NULL,
pch=19, cex=0.5, cex.main=1.5, cex.axis=1.5, cex.lab=1.5,
breaks="Scott", freq=TRUE, do.pairs=FALSE,
dp3D.names="auto", GOFcuts="auto",
colorRamp= colorRampPalette(c("darkred", "red", "orange", "yellow",
"green", "darkgreen", "cyan")), alpha=1, points.cex=0.7,
legend.pos="topleft", do.png=FALSE, png.width=1500,
png.height=900, png.res=90,
dotty.png.fname="Params_DottyPlots.png",
hist.png.fname="Params_Histograms.png",
bxp.png.fname="Params_Boxplots.png",
ecdf.png.fname="Params_ECDFs.png",
runs.png.fname="Params_ValuesPerRun.png",
dp3d.png.fname="Params_dp3d.png",
pairs.png.fname="Params_Pairs.png")
plot_particles(params, gofs, gof.name="GoF", MinMax=NULL, beh.thr=NA,
beh.col="red", beh.lty=1, beh.lwd=2, nrows="auto", col="black",
ylab=gof.name, main=NULL, pch=19, cex=0.5, cex.main=1.5,
cex.axis=1.5, cex.lab=1.5,
breaks="Scott", freq=TRUE, do.pairs=FALSE,
weights=NULL, byrow=FALSE, leg.cex=1.5,
dp3D.names="auto", GOFcuts="auto",
colorRamp= colorRampPalette(c("darkred", "red", "orange", "yellow",
"green", "darkgreen", "cyan")), alpha=1, points.cex=0.7,
legend.pos="topleft", verbose=TRUE,
do.png=FALSE, png.width=1500, png.height=900, png.res=90,
dotty.png.fname="Params_DottyPlots.png",
hist.png.fname="Params_Histograms.png",
bxp.png.fname="Params_Boxplots.png",
ecdf.png.fname="Params_ECDFs.png",
runs.png.fname="Params_ValuesPerRun.png",
dp3d.png.fname="Params_dp3d.png",
pairs.png.fname="Params_Pairs.png")
read_velocities(file="Velocities.txt", ... )
|
file |
character, name (including path) of the output file with the position and fitness value of each particle and for each iteration |
params |
data.frame whose rows represent the values of different parameter sets |
gofs |
OPTIONAL. numeric with the values of goodness-of-fit values for each parameter in |
verbose |
logical, if TRUE, progress messages are printed |
plot |
logical, indicates if the following figures has to be produced: dotty plots, histograms, empirical CDFs, Parameter Values Against Number of Model Evaluations, and 3D dotty plots of Parameter Values |
gof.name |
character, name to be given to the goodness-of-fit values in all the plots |
MinMax |
OPTIONAL. character, indicates if the optimum value in |
beh.thr |
numeric, used for selecting only the behavioural parameter sets, i.e. those with a goodness-of-fit value greater/less than or equal to |
beh.col |
OPTIONAL. Only used when |
beh.lty |
OPTIONAL. Only used when |
beh.lwd |
OPTIONAL. Only used when |
nrows |
OPTIONAL. Only used when |
col |
OPTIONAL. Only used when |
ylab |
OPTIONAL. Only used when |
main |
OPTIONAL. Only used when |
pch |
OPTIONAL. Only used when |
cex |
OPTIONAL. Only used when |
cex.main |
OPTIONAL. Only used when |
cex.axis |
OPTIONAL. Only used when |
cex.lab |
OPTIONAL. Only used when |
... |
OPTIONAL. Only used when |
breaks |
OPTIONAL. Only used when |
freq |
OPTIONAL. Only used when |
do.pairs |
OPTIONAL. Only used when |
weights |
OPTIONAL. Only used when |
byrow |
OPTIONAL. Only used when |
leg.cex |
OPTIONAL. Only used when |
dp3D.names |
character, name of all the parameters (usually only the most sensitive ones) that will be used for plotting pseudo-3D plots |
GOFcuts |
numeric, specifies at which values of the objective function |
colorRamp |
R function defining the colour ramp to be used for colouring the pseudo-3D dotty plots of Parameter Values, OR character representing those colours. See |
alpha |
numeric between 0 and 1 representing the transparency level to apply to the colors of the pseudo-3D dotty plots. See |
points.cex |
size of the points to be plotted |
legend.pos |
not used yet ... |
do.png |
logical, indicates if the plot with the convergence measures has to be saved into a PNG file instead of the screen device |
png.width |
OPTIONAL. Only used when |
png.height |
OPTIONAL. Only used when |
png.res |
OPTIONAL. Only used when |
dotty.png.fname |
OPTIONAL. Only used when |
hist.png.fname |
OPTIONAL. Only used when |
bxp.png.fname |
OPTIONAL. Only used when |
ecdf.png.fname |
OPTIONAL. Only used when |
runs.png.fname |
OPTIONAL. Only used when |
dp3d.png.fname |
OPTIONAL. Only used when |
pairs.png.fname |
OPTIONAL. Only used when |
read_particles
returns a list with four elements:
part.params |
numeric or matrix/data.frame with the parameter values for each particle and iteration |
part.gofs |
numeric vector with the goodness-of-fit value for each particle and iteration |
best.param |
numeric with the parameter values of the best particle. In order to be computed, the user has to provide a valid value for |
best.gof |
numeric with the best godness-of-fit value among all the particles. In order to be computed, the user has to provide a valid value for |
Mauricio Zambrano-Bigiarini, mzb.devel@gmail.com
read_results
, plot_results
, read_params
, plot_params
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## Not run:
# Setting the user home directory as working directory
setwd("~")
# Number of dimensions to be optimised
D <- 4
# Boundaries of the search space (Sphere test function)
lower <- rep(-100, D)
upper <- rep(100, D)
# Setting the seed
set.seed(100)
# Runing PSO with the 'Sphere' test function, writting the results to text files
hydroPSO(fn=sphere, lower=lower, upper=upper,
control=list(maxit=100, write2disk=TRUE, plot=TRUE) )
# reading the 'Particles.txt' output file of hydroPSO, and plotting dotty plots,
# histograms, eCDFs, ...
setwd("PSO.out")
particles <- read_particles()
# reading only the particles in 'Particles.txt' with a goodness-of-fit value
# lower than 'beh.thr'
particles <- read_particles(beh.thr=1000, MinMax="min")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.