plot_ParamsPerIter: Plot Parameter Values against the Iteration Number

Description Usage Arguments Author(s) See Also Examples

View source: R/plot_ParamsPerIter.R

Description

Function to plot the value of each parameter against the iteration number

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
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" )

Arguments

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 params (by default its column names)

main

character, title for the plot

xlab

character, title for the x axis. See plot

nrows

numeric, number of rows to be used in the plotting window. If nrows is set to auto, the number of rows is automatically computed depending on the number of columns of params

cex

numeric, magnification for text and symbols relative to the default. See par

cex.main

numeric, magnification to be used for main titles relative to the current setting of cex. See par

cex.axis

numeric, magnification to be used for axis annotation relative to the current setting of cex. See par

cex.lab

numeric, magnification to be used for x and y labels relative to the current setting of cex. See par

col

specification for the default plotting colour. See par

lty

line type. See par

verbose

logical, if TRUE, progress messages are printed

...

further arguments passed to the plot function or from other methods.

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 do.png=TRUE
numeric with the width of the device. See png

png.height

OPTIONAL. Only used when do.png=TRUE
numeric with the height of the device. See png

png.res

OPTIONAL. Only used when do.png=TRUE
numeric with the nominal resolution in ppi which will be recorded in the PNG file, if a positive integer of the device. See png

png.fname

OPTIONAL. Only used when do.png=TRUE
character, with the filename used to store the PNG file

Author(s)

Mauricio Zambrano-Bigiarini, mzb.devel@gmail.com

See Also

plot_results, plot_2parOF, plot_NparOF, plot_GofPerParticle

Examples

 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
# 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)

hydroPSO documentation built on April 29, 2020, 9:37 a.m.