This is the main phytoclass algorithm. It performs simulated annealing algorithm for S and F matrices. See the examples (Fm, Sm) for how to set up matrices, and the vignette for more detailed instructions. Different pigments and phytoplankton groups may be used.
Source:R/simulated_annealing.R
simulated_annealing.Rd
This is the main phytoclass algorithm. It performs simulated annealing algorithm for S and F matrices. See the examples (Fm, Sm) for how to set up matrices, and the vignette for more detailed instructions. Different pigments and phytoplankton groups may be used.
Usage
simulated_annealing(
S,
Fmat = NULL,
user_defined_min_max = NULL,
do_matrix_checks = TRUE,
niter = 500,
step = 0.009,
weight.upper.bound = 30,
verbose = FALSE
)
Arguments
- S
Sample data matrix – a matrix of pigment samples
- Fmat
Pigment to Chl a matrix
- user_defined_min_max
data frame with some format as min_max built-in data
- do_matrix_checks
This should only be set to TRUE when using the default values. This will remove pigment columns that have column sums of 0. Set to FALSE if using customised names for pigments and phytoplankton groups
- niter
Number of iterations (default is 500)
- step
Step ratio used (default is 0.009)
- weight.upper.bound
Upper limit of the weights applied (default value is 30).
- verbose
Logical value. Output error and temperature at each iteration. Default value of FALSE
Value
A list containing
Fmat matrix
RMSE (Root Mean Square Error)
condition number
Class abundances
Figure (plot of results)
MAE (Mean Absolute Error)
Error
Examples
# Using the built-in matrices Sm and Fm
set.seed(5326)
sa.example <- simulated_annealing(Sm, Fm, niter = 5)
#>
#> Condition number = 393
#>
#> Current error: 0.0283
#> Neighbour's error: 0.0283
#> Temperature (%): 99.1
#>
#> Current error: 0.0229
#> Neighbour's error: 0.0229
#> Temperature (%): 98.21
#>
#> Current error: 0.0229
#> Neighbour's error: 0.0237
#> Temperature (%): 97.32
#>
#> Current error: 0.0203
#> Neighbour's error: 0.0203
#> Temperature (%): 96.45
#>
#> Current error: 0.0203
#> Neighbour's error: 0.0268
#> Temperature (%): 95.58
#>
sa.example$Figure