How to use the biosppy.biometrics.SubjectError function in biosppy

To help you get started, we’ve selected a few biosppy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PIA-Group / BioSPPy / biosppy / biometrics.py View on Github external
"""Set the authentication threshold of a subject.

        Parameters
        ----------
        subject : hashable
            Subject identity.
        threshold : int, float
            Threshold value.
        ready : bool, optional
            If True, `subject` is the internal classifier label.

        """

        if not ready:
            if not self.check_subject(subject):
                raise SubjectError(subject)
            subject = self._subject2label[subject]

        try:
            self._thresholds[subject]['auth'] = threshold
        except KeyError:
            self._thresholds[subject] = {'auth': threshold, 'id': None}
github PIA-Group / BioSPPy / biosppy / biometrics.py View on Github external
----------
        subject : hashable
            Subject identity.
        ready : bool, optional
            If True, `subject` is the internal classifier label.

        Returns
        -------
        threshold : int, float
            Threshold value.

        """

        if not ready:
            if not self.check_subject(subject):
                raise SubjectError(subject)
            subject = self._subject2label[subject]

        return self._thresholds[subject].get('id', None)
github PIA-Group / BioSPPy / biosppy / biometrics.py View on Github external
"""Set the identification threshold of a subject.

        Parameters
        ----------
        subject : hashable
            Subject identity.
        threshold : int, float
            Threshold value.
        ready : bool, optional
            If True, `subject` is the internal classifier label.

        """

        if not ready:
            if not self.check_subject(subject):
                raise SubjectError(subject)
            subject = self._subject2label[subject]

        try:
            self._thresholds[subject]['id'] = threshold
        except KeyError:
            self._thresholds[subject] = {'auth': None, 'id': threshold}
github PIA-Group / BioSPPy / biosppy / biometrics.py View on Github external
----------
        subject : hashable
            Subject identity.
        ready : bool, optional
            If True, `subject` is the internal classifier label.

        Returns
        -------
        threshold : int, float
            Threshold value.

        """

        if not ready:
            if not self.check_subject(subject):
                raise SubjectError(subject)
            subject = self._subject2label[subject]

        return self._thresholds[subject].get('auth', None)
github PIA-Group / BioSPPy / biosppy / biometrics.py View on Github external
Authentication threshold.

        Returns
        -------
        decision : array
            Authentication decision for each input sample.

        """

        # check train state
        if not self.is_trained:
            raise UntrainedError

        # check subject
        if not self.check_subject(subject):
            raise SubjectError(subject)

        label = self._subject2label[subject]

        # check threshold
        if threshold is None:
            threshold = self.get_auth_thr(label, ready=True)

        # prepare data
        aux = self._prepare(data, targets=label)

        # authenticate
        decision = self._authenticate(aux, label, threshold)

        return decision
github PIA-Group / BioSPPy / biosppy / biometrics.py View on Github external
SubjectError
            If the subject to remove is not enrolled.

        Notes
        -----
        * When using deferred calls, a dismiss overrides a previous enroll
          for the same subject.

        """

        # check inputs
        if subject is None:
            raise TypeError("Please specify the subject identity.")

        if not self.check_subject(subject):
            raise SubjectError(subject)

        label = self._subject2label[subject]
        del self._subject2label[subject]
        del self._thresholds[label]
        self._nbSubjects -= 1
        self.io_del(label)

        if deferred:
            self._defer(label, 'dismiss')
        else:
            self._train(None, [label])
            self._check_state()
            self.update_thresholds()