MAXINDEX
Applies to PredictiveInsight only.
Syntax
MAXINDEX(data [, n])
Parameters
data
The start of a data range for which to compute the index of the n th maximum value for each row. This can be a column, or an expression evaluating to a column. For the format definition of data, see the "Macro Function Parameters" section in the chapter in this guide for your IBM® product.
n
Number, greater than zero. The default value is one, which returns the index of the highest value for each row. (Two returns the index for the second highest value, three the index for the third highest value, etc.)
Description
MAXINDEX finds the n th maximum value in each row of the specified data range and returns a column index for its location. It returns a new column containing a single value representing the index of the n th maximum value for each row. A value of one indicates the first cell in the first column. If there is more than one maximum value, the first column containing the n th maximum is returned.
*
If you have multiple columns, each one representing a separate output class, you can use MAXINDEX to select the "winning class." You can then train with a single output column rather than multiple output columns. For example, V4 = MAXINDEX(V1:V3) would do the following:
V1 V2 V3 V4 0 1 0 2 1 0 0 1 0 0 1 3
Examples
Creates a new column named TEMP containing the value two (since the maximum value is five, which occurs in the second column).
Creates a new column named TEMP containing a one for each row of column V1.
Creates a new column named TEMP with each value representing the index of the maximum value of the corresponding row across the columns V6, V7, and V8. A one is returned if the maximum is in column V6, a two if the maximum is in column V7, and a three if the maximum is in column V8.
Creates a new column named TEMP, where the cells in rows 1-5 contain a value representing the index of the maximum value of the corresponding row across columns V1 through V3. The other cells in TEMP are empty.
Related Functions