View source: R/plot_ParamsPerIter.R
plot_ParamsPerIter | R Documentation |
Function to plot the value of each parameter against the iteration number
plot_ParamsPerIter(params,...)
## Default S3 method:
plot_ParamsPerIter(params, param.names=colnames(params),
main=NULL, xlab="Number of evaluations", nrows="auto", cex=0.5,
cex.main=1.2,cex.axis=1.7,cex.lab=1.5, col=rainbow(ncol(params)),
lty=3, verbose=TRUE, ..., do.png=FALSE, png.width=1500,
png.height=900, png.res=90, png.fname="Params_ValuePerRun.png" )
## S3 method for class 'matrix'
plot_ParamsPerIter(params, param.names=colnames(params),
main=NULL, xlab="Number of evaluations", nrows="auto", cex=0.5,
cex.main=1.2,cex.axis=1.7,cex.lab=1.5, col=rainbow(ncol(params)),
lty=3, verbose=TRUE, ..., do.png=FALSE, png.width=1500,
png.height=900, png.res=90, png.fname="Params_ValuePerRun.png" )
## S3 method for class 'data.frame'
plot_ParamsPerIter(params, param.names=colnames(params),
main=NULL, xlab="Number of evaluations", nrows="auto", cex=0.5,
cex.main=1.2,cex.axis=1.7,cex.lab=1.5, col=rainbow(ncol(params)),
lty=3, verbose=TRUE, ..., do.png=FALSE, png.width=1500,
png.height=900, png.res=90, png.fname="Params_ValuePerRun.png" )
params |
matrix or data.frame with the parameter values, where each row represent a different parameter set, and each column represent the value of a different model's parameter |
param.names |
character vector, names to be used for each model's parameter in |
main |
character, title for the plot |
xlab |
character, title for the x axis. See |
nrows |
numeric, number of rows to be used in the plotting window. If |
cex |
numeric, magnification for text and symbols relative to the default. See |
cex.main |
numeric, magnification to be used for main titles relative to the current setting of |
cex.axis |
numeric, magnification to be used for axis annotation relative to the current setting of |
cex.lab |
numeric, magnification to be used for x and y labels relative to the current setting of |
col |
specification for the default plotting colour. See |
lty |
line type. See |
verbose |
logical, if TRUE, progress messages are printed |
... |
further arguments passed to the |
do.png |
logical, indicates if all the figures have to be saved into PNG files instead of the screen device |
png.width |
OPTIONAL. Only used when |
png.height |
OPTIONAL. Only used when |
png.res |
OPTIONAL. Only used when |
png.fname |
OPTIONAL. Only used when |
A single figure with nparam
number of panels (nparam=ncol(params)
), where each panel has a plot the value of each parameter against the iteration number.
Mauricio Zambrano-Bigiarini, mzb.devel@gmail.com
plot_results
, plot_2parOF
, plot_NparOF
, plot_GofPerParticle
# Number of dimensions to be optimised
D <- 5
# Boundaries of the search space (Griewank test function)
lower <- rep(-600, D)
upper <- rep(600, D)
## Not run:
# Setting the user's home directory as working directory
setwd("~")
# Setting the seed
set.seed(100)
# Running PSO with the 'griewank' test function, writing the results to text files
hydroPSO(fn=griewank, lower=lower, upper=upper,
control=list(use.IW = TRUE, IW.type= "linear", IW.w= c(1.0, 0.4),
write2disk=TRUE) )
# reading the 'Particles.txt' output file of PSO
setwd("PSO.out")
particles <- read_particles(plot=FALSE)
# plotting the value of each parameter and the objective function against the
# iteration number
plot_ParamsPerIter(particles[["part.params"]])
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.