HSMclass: HSMclass

Description Usage Arguments Value References Examples

Description

Identification of optimal classification schemes by Heuritic Search Method (HSM) by Simulated Annealing

Usage

1
2
3
HSMclass(refdata, predictions, nclasses, moveinterval = 10, iterations,
  coolfactor, InitTemp, weight.norefs, weight.classwidth,
  bestever.iteration = 10, progressbar = TRUE, trace = FALSE)

Arguments

refdata

vector containing the values of the continuous response variable used in the prediction model

predictions

predictions for the response values of the prediction model. Note:(refdata and predictions have to correspond to each other)

nclasses

number of classes for which an optimal classification scheme should be computed

moveinterval

controls if classes should be whole numbers (default is 10).

iterations

number of iterations used in heuristic

coolfactor

cooling factor of Simulated Annealing algorithm

InitTemp

intial Temperature of Simulated Annealing algorithm

weight.norefs

weight for maximizing number of reference data pefor each class

weight.classwidth

weight for minimizing the classwidth for each class

bestever.iteration

number of times the heuristic is repeatedly applied. If > 1, the best solution over all runs will be chosen as the optimal solution. Defaults to 10.

progressbar

Shows the progress of the heuristic. Defaults to TRUE.

trace

logical. If TRUE, prints current solution- and penalty-term values to the console.

Value

HSMclass returns an object of class "hsmclass".

An object of class "hsmclass" returns a list of the following components:

best.classbreaks

codevector containing the class break values of the optimal classification scheme

best.classwidth

codevector containing the class width of each class

no.refs.best

codevector containing the number of reference data in each class

BestSolution

value of best solution found by heuristic

Solutions

codevector containing all solution values of heuristic

bestever.iterationmode

codevector containing the class break values of the optimal classification scheme

Temperature

codevector containing the temperature values of the Simulated Annealing algorithm

deltaF

codevector containing the differences between new solution and best solution at the respective iteration of the heuristic

p

codevector containing the p-values (...). Improvement of Sol.Best always yields p = 1

moved.per.iteration

codevector containing the number of classbreaks moved for respective iteration

comp.time

information about the computation time

call

the function call passed to function HSMclass

settings

a list containing the function's inputs:

  • refdata:

  • predictions:

  • nclasses:

  • iterations:

  • moveinterval:

  • coolfactor:

  • InitTemp:

  • weight.norefs:

  • weight.classwidth:

References

Hill, A., Breschan, J., & Mandallaz, D. (2014). Accuracy assessment of timber volume maps using forest inventory data and LiDAR canopy height models. Forests, 5(9), 2253-2275.

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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# ------------------------------------------------#
## PERFORM OPTIMIZATION OF CLASSIFICATION SCHEME:

#----
# 1.) Example: optimization for 6 classes:
#----

hsm.1<- HSMclass(refdata = refdata.gr, predictions = predictions.gr,
                 nclasses = 6,iterations = 1000, coolfactor=0.99,
                 InitTemp = 80, weight.norefs = 2, weight.classwidth = 2)
summary(hsm.1)


#----
# 2.) Example: optimization for 6 classes, run heuristic 100 times
#----           and pick best solution over all runs:
 ## Not run: 
 hsm.2<- HSMclass(refdata = refdata.gr, predictions = predictions.gr,
                  nclasses = 6,
                  iterations = 1000, coolfactor=0.99, InitTemp = 80,
                  weight.norefs = 2, weight.classwidth = 2,
                  bestever.iteration = 100)
summary(hsm.2)

## End(Not run)


# ------------------------------------------------#
##  PERFORM ENTIRE ANALYSIS:

# define a set of equidistant intervals to evaluate:
equal.intervals<- seq(100,300,20)

# define corresponding number of classes:
n.classes<- ceiling(max(refdata.gr, predictions.gr)/equal.intervals)

# Chain of analysis:
# --> 1. Identify optimal classification scheme for all given number of classes
# --> 2. Calculate classification accuracy for equidistant class intervals
# --> 3. Calculate classification accuracy for corresponding optimal no. of classes

## Not run: 
acc.equal<- list()
acc.opti<-  list()

lapply(seq_along(n.classes), function(x){

  hsm<- HSMclass(refdata.gr, predictions.gr, nclasses = n.classes[x],
                 iterations = 1000, coolfactor = 0.99, InitTemp = 80,
                 weight.norefs = 2, weight.classwidth = 2)

 acc.equal[[x]]<- classAccuracy(refdata.gr, predictions.gr, equal.int = equal.intervals[x])
 acc.opti[[x]]<- classAccuracy(hsm)

})

## End(Not run)

AndreasChristianHill/classoptimr documentation built on May 29, 2019, 12:23 p.m.