MeanSquaredError (FPScript)
Calculates the mean squared error for a data set.
Syntax
MeanSquaredError(DataSet, [ Mode = PROCESS_COLUMNS ] [ , IntervalWidth ])
The syntax of the MeanSquaredError function consists of the following parts:
Part |
Description |
||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
DataSet |
The data set to be evaluated. All data structures are allowed. All numeric data types are permitted. For complex data types the absolute value is formed. If the argument is a list, then the function is executed for each element of the list and the result is also a list. |
||||||||||||||
Mode |
Specifies how data matrices and signal series are to be processed and whether to determine individual, moving or block values. The argument Mode can have the following values:
...plus an optional constant, which determines the calculation method:
If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated. If this argument is omitted, it will be set to the default value PROCESS_COLUMNS. |
||||||||||||||
IntervalWidth |
This argument is required for determining moving and block values. The interval width then specifies the number of values to be examined. The width should be an odd number. Otherwise, the interval is asymmetrical, and one more value is included in the calculation to the right of the center as opposed to the left. Permitted data structures are scalar value. All integral data types are permitted. The value must be greater or equal to 1. If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated. |
Remarks
The result always has the data type 64-bit floating point.
The mean squared error of a sample is defined as:
with the mean
For signals and signal series, the Y component is processed and the X or Z component is copied, if possible. When calculating moving and block values, the data structure of the result is that of the argument. If, on the other hand, DataSet is a data series or a signal, the result is a scalar value with the mean squared error searched for. Otherwise, the result is a data series or a signal with one mean squared error per column or row.
Available in
FlexPro Basic, Professional, Developer Suite
Examples
MeanSquaredError({1, 3, 5, 2, 4}) |
Results in 2. |
MeanSquaredError({{1, 3, 5, 2, 4}, {2, 6, 10, 4, 8}}) |
Results in {2, 8}. |
MeanSquaredError({{1, 3, 5, 2, 4}, {2, 6, 10, 4, 8}}, PROCESS_ROWS) |
Results in { 0.25, 2.25, 6.25, 1, 4 }. |
MeanSquaredError({1, 2, 3, 2, 1}, CALC_MOVING, 3) |
Results in { 0.25, 0.666666666666667, 0.2222222222222214, 0.666666666666667, 0.25 }. |
MeanSquaredError({1, 2, 3, 4, 4.5, 5}, CALC_BLOCK, 3) |
Results in { 0.666666666666667, 0.1666666666666679 }. |