Creates the default confidence_to_alpha function.
(
confidence_to_alpha: bool,
pcutoff: float,
)
| 1427 | |
| 1428 | |
| 1429 | def _get_default_conf_to_alpha( |
| 1430 | confidence_to_alpha: bool, |
| 1431 | pcutoff: float, |
| 1432 | ) -> Callable[[float], float] | None: |
| 1433 | """Creates the default confidence_to_alpha function.""" |
| 1434 | if not confidence_to_alpha: |
| 1435 | return None |
| 1436 | |
| 1437 | def default_confidence_to_alpha(x): |
| 1438 | if pcutoff == 0: |
| 1439 | return x |
| 1440 | return np.clip((x - pcutoff) / (1 - pcutoff), 0, 1) |
| 1441 | |
| 1442 | return default_confidence_to_alpha |
| 1443 | |
| 1444 | |
| 1445 | if __name__ == "__main__": |
no outgoing calls
no test coverage detected