# Defining a Two-Sided Scoring Function

If you are using an edge pair model and you specify a two-sided size scoring method type, you can define a scoring function that scores edge pattern candidates that are smaller than the edge model differently from edge pattern candidates that are larger than the edge model. This type of scoring function is called a two-sided scoring function.

The following figure shows an example of a two-sided scoring function that is more tolerant of edge pattern candidates that are larger than the edge model than of edge pattern candidates that are smaller. If the edge pattern candidate is exactly the same size as the edge model, the raw score will be 0.0; if the edge pattern candidate is smaller than the edge model, the raw score will be less than 0; if the edge pattern candidate is larger than the edge model, the raw score will be greater than 0.

If you specify a two-sided scoring function, the raw score is normalized so that an edge pattern candidate that is smaller than the edge model by an amount equal to the size of the edge model receives a raw score of -1.0 and an edge pattern candidate that is larger than the edge model by an amount equal to the size of the edge model receives a raw score of 1.0.

The figure shows a two-sided scoring function with distinct values for y1 and y1h but the same values for y0 and y0h. While it is possible to specify different values for y0 and y0h, the resulting scoring function contains a discontinuity at x0b. The following figure shows a scoring function where y0h is different than y0.

You can also specify a two-sided scoring function for cases where raw score values outside of a range of values receive higher scores. The following figure shows an example of this type of two-sided scoring function.