## Performance constraints

To express application-specific rquirements perClass Mira allows definition of constraints in confusion matrix.

By double-clicking on any field of the matrix, we create respective constrain for the current value. For error (off-diagonal) elements the means that only solutions with error less or equal than current value are allowed.

For accuracies (diagonal) elements it is values higher or equal.

Each field with a constrain shows a small square in its left upper corner. Note, that due to equal sign in constrain definition our current solution does not change by creating a constrain. We only limit a subset of admissible solutions (see the text in the upper part of the confusion matrix widget showing that now 5178 solutions from the total 6000 are valid.)

We may install multiple constraints by double clicking. To remove a constrain, double click again.

To change any constrain value, we may use Ctrl+mouse wheel on the specific field. This may lead to a new, better, operating point.

Note, that we may not minimze all errors simultaneously. Lowering the error between class 4 (green stem/leaves) and decision 5 (green tomato) the opposite error (class 5 vs decision 4) will increase. If we also install the constrain on class 5 vs decision 4 we may reach the situation where this constrain cannot be lowered further (by doing so, there would be no more solutions left). To explore fully these situations, constraints may be disabled by clicking on the small square in the left-upper corner. Only the constraints with green square are used in performance optimization, not the red square constraints.

Best practice procedure:

- Install constraints of interest by double-clicking
- Tune the constraints' values using Ctrol+mouse wheel
- If the errors cannot be lowered further as desired:
- either increase value of other constraints (Ctrl+mouse wheel)
- or disable other constraints and lower the error value of the more important ones

Example of multiple constraints:

Note, that re-training a model does not change the optimization options (operating poionts) only updates the model and selects one of existing points.

When selecting a new model via Model search, also new set of operating points (solutions) are created.

In both cases, there may be no solution that fulfills all enabled constraints. In this situation, all constraints are disabled. You may re-enable some of them and/or update value of others to find a desired solution.