# Red Analyze Tool Filter Variables

The variables below can be used to filter out the result of processing. For more information about how to use filters, see Filter Grammar.

Red Analyze Tool View Variables | Data Type | Notes
--- | --- | ---
good | Boolean | Returns views that are labeled as good. Example: "good and score<=0.2"
negative | Returns the same results as good.
bad | Returns views that are labeled as bad. Example: "bad and score>=0.8"
positive | Returns the same results as bad.
mismatch |
recall | Floating Point | Returns the recall as the processing result. Example: "recall >= 0.7"
precision | Returns the precision as the processing result. Example: "precision>= 0.7"
f_score | Returns the f-score as the processing result. Example: "f-score>= 0.75"
T1 | Returns the lower threshold value. Example: "T1>= 0.4"
T2 | Returns the upper threshold value. Example: "T2>= 0.6"
score | Returns the highest defect probability. Example: "score>= 0.5"
deviation | Returns the same results as score.

### Region Filter

Region filters can be set upon before processing so it can affect the result of processing. Therefore, whether a captured region in a view is marked as a defect region or not is decided by the region filter once it is set upon. To activate a region filter, you should re-process the tool after you set a region filter phrase.

The variables below can be used to directly affect the processing outcome. For more information about how to use filters, see Filter Grammar.

Red Analyze Tool - Region Axis Variables |  |
score | Floating Point | Returns the highest defect probability among those probabilities of pixels in the region.
deviation | Returns the same results as score.
holes |
area | Returns the number of pixels in the defect region. Example: "area>= 150"
perimeter |
compactness | Returns the equivalent of: 4 * π * area / perimeter^2.
coverage | Returns the overlapping ratio between labeled area and marked area.? Example: "coverage>= 0.5"
x | Returns the x-axis position of the center of the defect region. Example: "x>150"
y | Returns the y-axis position of the center of the defect region. Example: "y>50"
name | String |

### Region Filter and Confusion Matrix

If the Count is set to Views or Untrained Views, the confusion matrix will be calculated based on views, not regions. By contrast, if it is set to Regions or Untrained Regions, the confusion matrix will be calculated based on regions, not views. See Confusion Matrix for the details.

Region filters can be applied to the result of the confusion matrix. Set a region filter phrase, re-process the tool, and you will see the region filer applies to the confusion matrix.

Note: Region filter can also be applied with "filtered()" expression.
e.g> "filtered(region!/score) < T1"
e.g> "filtered(score[labeled]) in [T1, T2]"

##### Confusion Matrix - Views/Untrained Views

Region filters affect producing the processing result. The role of a region filter is that it decides the marking region. For example, in Views/Untrained Views if "area>150" is set in the region filter and the tool is re-processed, only the views that have marking regions of more than 150 pixels can be marked as "Bad" or "Inter," otherwise good.

##### Confusion Matrix - Regions/Untrained Regions

Region filters affect producing the processing result. The role of a region filter is that it decides the marking region. For example, in Regions/Untrained Regions if "area>150" is set in the region filter and the tool is re-processed, the views whose marking regions area is under 150 pixels will lose those marking regions in the processed result.

For a view, if all marking regions overlapped with the pixel-wise labeled defect regions were lost by the region filter, this view will not populate the "Bad"(actual) - "Bad" predicted pair.