You are here: Start » Filter Reference » Data Flow » Conditional Processing » ClassifyByRange

Module: | FoundationLite |
---|

Separates the elements of the input array into three output arrays, depending on whether the related values fall below, into or above the specified range.

### Applications

Name | Type | Description | |
---|---|---|---|

inArray | <T>Array | Elements to be classified | |

inValues | RealArray | Corresponding values to be compared against the range | |

inMinimum | Real* | Lowest value of the range | |

inMaximum | Real* | Highest value of the range | |

outAccepted | <T>Array | Array of elements corresponding to values matching the range | |

outRejected | <T>Array | Array of elements corresponding to values outside the range | |

outLower | <T>Array | Array of elements corresponding to values lower than inMinimum | |

outHigher | <T>Array | Array of elements corresponding to values higher than inMaximum | |

outIsAccepted | BoolArray | Represents whether corresponding values are in the range | |

outIsRejected | BoolArray | Represents whether corresponding values are outside the range |

The type of this filter is defined using the type variable **T** which represents any valid type. Read more.

### Description

The filter accepts an array of objects of type **T** (decided on filter creation) along with corresponding array of float values and splits the array of objects into three output arrays, depending on how each of the values fits the (**inMinimum**, **inMaximum**) range.

- Objects corresponding to values lower than
**inMinimum**are passed onto**outLower**and**outRejected**. - Objects corresponding to values that fit closed range (
**inMinimum**,**inMaximum**) are passed onto**outAccepted**. - Objects corresponding to values higher than
**inMaximum**are passed onto**outHigher**and**outRejected**.

In the special case of **inMinimum** being greater than **inMaximum**, first matching condition is applied, which means that objects corresponding to values higher than **inMaximum** and lower than **inMinimum** are passed onto **outLower**.

### Hints

- Also consider using the "select" function in formulas.
- Before using this filter you need to have an array of objects (to be classified) and an array of feature values that describe the objects.
- Connect the array of objects to the inArray input and connect the array of feature values to the inValues input.
- Set the range of inMinimum and inMaximum to define the accepted objects.
- Consider showing additional outputs: outLower, outHigher, outIsAccepted, outIsRejected.
- If you need the highest possible speed, also consider using a more simple filter SelectByRange.

### Examples

inArray = {"Alice", "Bill", "Frank", "Patricia", "Thomas"} inValues = {5.0, 4.0, 5.0, 8.0, 6.0} inMinimum = 5.0 inMaximum = 6.0 |
outLower = {"Bill"} outAccepted = {"Alice", "Frank", "Thomas"} outHigher = {"Patricia"} |

### Errors

This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

List of possible exceptions:

Error type | Description |
---|---|

DomainError |
Inconsistent array lengths on input in ClassifyByRange. |

DomainError |
Incorrect (NaN) float value on inValues input in ClassifyByRange. |

### Complexity Level

This filter is available on **Basic** Complexity Level.

### Filter Group

This filter is member of Classify filter group.

### See Also

- ClassifyByPredicate – Separates the elements of the input array into two output arrays. The first output array contains all the elements for which the associated predicate is True.

- SelectByRange – Selects the elements of the input that fall into the specified range.