Learn R Programming

hydroPSO (version 0.3-1-1)

plot_NparOF: N 2-dimensional plots of Parameter Values against the Objective Function

Description

For n user-defined parameters, the function creates sum(1:(npar-1)) plot_2parOF plots, with the values of the objective function in a 2D box, where the boundaries of each parameter are used as axis The sum(1:(npar-1)) plots corresponds to all the possible combinations of 2 parameters among all the n parameters provided

Usage

plot_NparOF(params, gofs, param.names=colnames(params), 
         MinMax=c(NULL,"min","max"), beh.thr=NA, nrows="auto", 
         gof.name="GoF", main=paste(gof.name, "Surface"), GOFcuts="auto", 
         colorRamp= colorRampPalette(c("darkred", "red", "orange", "yellow", 
         "green", "darkgreen", "cyan")), points.cex=0.7, alpha=0.65, 
         axis.rot=c(0, 0), verbose=TRUE)

Arguments

params
matrix or data.frame with the parameter values
gofs
numeric with the values of goodness-of-fit values for each one of the parameters in params (in the same order!)
param.names
character, names for the parameters in params that have to be plotted (param.names can be a subset of params)
MinMax
character, indicates whether the optimum value in gofs corresponds to the minimum or maximum of the objective function. It is required when beh.thr is provided. Valid values are in: c(NULL, 'min', 'max') By default
beh.thr
OPTIONAL numeric, threshold value used for selecting parameter sets that have to be used in the analysis (behavioural parameters, using the GLUE terminology) If MinMax='min', only parameter sets with a goodness-of-fit value
nrows
numeric, number of rows to be used in the plotting window If nrows='auto' the number of columns is automatically computed depending on the number of parameters in params
gof.name
character, name of the objective function to be plotted. It has to correspond to the name of one column of params It is used as title for the legend of the final figure.
main
character, currently not used
GOFcuts
numeric, specifies at which values of the objective function given in gofs the colours of the plot have to change If GOFcuts="auto" and MinMax=NULL, the intervals are defined by the (unique values of the) gofs
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
points.cex
size of the points to be plotted
alpha
numeric between 0 and 1 representing the transparency level to apply to colorRamp, 0 means fully transparent and 1 means opaque
axis.rot
numeric vector of length 2 representing the angle (in degrees) by which the axis labels are to be rotated, left/bottom and right/top, respectively.
verbose
logical; if TRUE, progress messages are printed

See Also

plot_2parOF, read_results, plot_results, plot_GofPerParticle, plot_params, plot_ParamsPerIter

Examples

Run this code
# Number of dimensions to be optimised
D <- 5

# Boundaries of the search space (Rosenbrock test function)
lower <- rep(-30, D)
upper <- rep(30, D)

# Setting the user's home directory as working directory
setwd("~")

# Setting the seed
set.seed(100)

# Optimising the 'Rosenbrock' test function, and writing the results to text files
hydroPSO(fn=rosenbrock, lower=lower, upper=upper, control=list(write2disk=TRUE) ) 
  
# reading the 'Particles.txt' output file of hydroPSO
setwd("PSO.out")
particles <- read_particles(plot=FALSE)
               
# plotting the value of each parameter and the objective function against the 
# values of the objective function
plot_NparOF(params=particles[["part.params"]], gofs=particles[["part.gofs"]],
            gof.name="Rosenbrock", alpha=0.5)

Run the code above in your browser using DataLab