Class WeightedLeastDifferenceSelector
java.lang.Object
net.simplace.sim.control.FWSimulationControlContainer
net.simplace.sim.control.FWSimulationSelector
net.simplace.sim.control.selectors.WeightedLeastDifferenceSelector
- All Implemented Interfaces:
FWSimFieldContainer
- Direct Known Subclasses:
LeastDifferenceSelector
Selects the simulation with the best error/deviation for multiple
target variables. The general error is the weighted sum of the
errors.
WIKI_START
== Configuration ==
User has to specify
- the frequency at which values should be compared
- the calculation method cMode (Bias,MRE,MAE,RMAE,MSE,RMSE,index,rc etc.)
- the number of target variables cNumberOfVariables (up to 20)
- for each target variable a pair of SimVariables cObserved{i}/cSimulated{i}
- for each target variable the weight for the error cWeight{i}
- {i} ranges from 1 to cNumberOfVariables
== Outputs ==
- the selected simulation id as a one size CHARARRAY `selectedsimulations`
- the best `ErrorValue` achieved as DOUBLE
- all simulations weighted sum of errors `ErrorValues` as DOUBLEARRAY
- for each target variable all simulations error `ErrorValuesVariable{i}` as DOUBLEARRAY
== Description ==
For a simulation the calculated values of different variables \(i = 1, ... cNumberOfVariables\)
are compared to reference (measured) values (e.g. Yield, LAI, Biomass). The selector can handle
maximum 20 different variables. Each variable exists pairwise in the simulation as observed\simulated.
Observed variables normally come from a resource (datafile), where simulated ones are calculated.
(Notice: The selector works also, if both variables come from resources or if both are simulated.)
For each of these variables \(n\) samples are produced by the simulation (\(n\) is determined by
the simulated time span and the selectors frequence information).
Let \(\mathcal{E}: \mathbb{R}^n \times \mathbb{R}^n\ \rightarrow \mathbb{R}\) be the selected calculation method - e.g.
the bias \(E(o,s)=\sum_{j=1}^n o_j - s_j\)
The weighted difference is then
WIKI_END
\[
E = \frac{1}{\omega}\sum_{i=1}^{cNumberOfVariables} cWeight_i \mathcal{E}(cObserved_i,cSimulated_i)
\]
where \(\omega\) is the sum of weights:
\[
\omega = \sum_{i=1}^{cNumberOfVariables} cWeight_i
\]
WIKI_START
If \(k= 1, ... l\) simulations are performed within a project,
then the selector calculates all weighted errors \(E_k\) and selects
the simulation with the best error. (The best error depends on the calculation method
for RMSE it's the one closest to 0, for agreement index closest to 1 etc.)
The output `NuberOfValues` counts the number of simulations used for comparison.
Normally it's equal to \(l\), but it can be lower because simulations that produce
no usable result (i.e. \(E_k\) could not be calculated) are skipped.
== Example ==
{{{
| <selector id="Selector" class="net.simplace.sim.control.selectors.WeightedLeastDifferenceSelector"
| frequence="COMPLEX" rule="${observations.HasData}" >
| RRMSE
| 1
|
|
|
| 0.8
|
|
|
| 0.2
|
}}}
WIKI_END
WIKI_START
== Error methods ==
- `Bias` - mean error
- `SignedBias` - mean error, selects the smallest signed bias
- `MRE` - mean relative error
- `MAE` - mean absolute error
- `RMAE` - relative mean absolute error
- `MSE` - mean squared error
- `RMSE` - root mean squared error
- `RRMSE` - relative root mean squared error
- `SMAPE` - symmetric mean absolute percentage error
- `EF` - model efficiency
- `r` - Correlation Coefficient
- `rc` - Concordance Correlation Coefficient
- `index` - Agreement Index
- `NONE` - Void Error Calculator
WIKI_END
- Author:
- Gunther Krauss
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected FWSimVariable<String>
protected FWSimVariable<Integer>
protected ArrayList<FWSimVariable<Double>>
protected ErrorCalculationMethod[]
protected FWSimVariable<String>
protected FWSimVariable<Double>
protected FWSimVariable<Double[]>
protected ArrayList<FWSimVariable<Double[]>>
protected ArrayList<FWSimVariable<String>>
protected ArrayList<FWSimVariable<String>>
protected int
protected int
protected FWSimVariable<Integer>
protected double
Fields inherited from class net.simplace.sim.control.FWSimulationSelector
iFrequence, iGlobalModeSimulationIDMap, iSelectStatement
Fields inherited from class net.simplace.sim.control.FWSimulationControlContainer
iCache, iCals, iConstraint, iContainerElement, iControlMap, iFieldMap, iInputMap, iInputs, iName, iParams, iSession, iSimulationMap
-
Constructor Summary
ConstructorDescriptionWeightedLeastDifferenceSelector
(org.jdom2.Element aSimulationSelectorElement, FWSimSession aSession) -
Method Summary
Methods inherited from class net.simplace.sim.control.FWSimulationSelector
createSelectStatement, createSimulationSelector, createSimulationSelector, selectSimulations
Methods inherited from class net.simplace.sim.control.FWSimulationControlContainer
addProcessTime, addVariable, checkCondition, evaluate, getContentType, getCreateFormXML, getEditFormXML, getFieldMap, getFrequence, getInputVariables, getName, getOrderNumber, getOutputVariables, getVariable, getVarMap, isConditionCheck, readInputCalAndConstraint, removeVariable, setPropertyValue, toXML
-
Field Details
-
maxnumber
protected int maxnumber -
number
protected int number -
weightsum
protected double weightsum -
cNumberOfVariables
-
iObserved
-
iSimulated
-
cWeight
-
cMode
-
NumberOfValues
-
ErrorValue
-
ErrorValues
-
IndividualErrorValues
-
ErrorMethod
-
errorCalculator
-
-
Constructor Details
-
WeightedLeastDifferenceSelector
public WeightedLeastDifferenceSelector(org.jdom2.Element aSimulationSelectorElement, FWSimSession aSession) - Parameters:
aSimulationSelectorElement
-aSession
-
-
-
Method Details
-
createVariables
- Returns:
- variables from the field map
-
init
public void init()Description copied from class:FWSimulationControlContainer
The model initialization function. Will be called only once, before running the model using process().- Specified by:
init
in classFWSimulationControlContainer
-
select
- Specified by:
select
in classFWSimulationSelector
-