Пример #1
0
    def evaluate(self):
        eers = []

        if len(self.subjects) > 4:

            for idx, subject in enumerate(self.subjects):
                genuine_user_data = self.data.loc[self.data.subject == subject, \
                                             "H.period":"H.Return"]
                imposter_data = self.data.loc[self.data.subject != subject, :]

                self.train = genuine_user_data[:200]
                self.test_genuine = genuine_user_data[200:]
                #self.test_imposter = imposter_data.groupby("subject"). \
                #                    head(5).loc[:, "H.period":"H.Return"]
                self.test_imposter = self.attacker[idx]

                self.training()
                self.testing()
                eers.append(evaluateEERGMM(self.user_scores, \
                                         self.imposter_scores))

        else:
            genuine_user_data = self.data.loc[self.data.subject == self.subjects, \
                                "H.period":"H.Return"]
            imposter_data = self.data.loc[
                self.data.subject != self.subjects, :]
            # generated_data = attacker_data

            self.train = genuine_user_data[:200]
            self.test_genuine = genuine_user_data[200:]
            self.test_imposter = imposter_data.groupby("subject"). \
                                     head(6).loc[:, "H.period":"H.Return"]
            self.test_imposter = self.attacker

            self.training()
            self.testing()
            eers.append(evaluateEERGMM(self.user_scores, \
                                    self.imposter_scores))

        return np.mean(eers)
Пример #2
0
    def evaluate(self):
        eers = []
 
        for subject in subjects:        000
            genuine_user_data = data.loc[data.subject == "s002", \
                                         "H.period":"UD.l.Return"]
            imposter_data = data.loc[data.subject != subject, :]
            self.train = genuine_user_data[:200]
            self.test_genuine = genuine_user_data[200:]
            self.test_imposter = imposter_data.groupby("subject"). \
                                 head(5).loc[:, "H.period":"UD.l.Return"]
 
            self.training()
            self.testing()
            eers.append(evaluateEERGMM(self.user_scores, \
                                     self.imposter_scores))
    def evaluate(self):
        eers = []

        for subject in subjects:
            genuine_user_data = data.loc[data.subject == subject, \
                                         "H.period":"H.Return"]
            imposter_data = data.loc[data.subject != subject, :]

            self.train = genuine_user_data[:200]
            self.test_genuine = genuine_user_data[200:]
            self.test_imposter = imposter_data.groupby("subject"). \
                                 head(5).loc[:, "H.period":"H.Return"]

            self.training()
            self.testing()

            if isinstance(self, GMMDetector):
                eers.append(evaluateEERGMM(self.user_scores, \
                                     self.imposter_scores))
            else:
                eers.append(evaluateEER(self.user_scores, \
                                     self.imposter_scores))
        return np.mean(eers), np.std(eers)
Пример #4
0
    def evaluate(self):
        fpr = []

        if isinstance(self.subjects, list):
            for idx, subject in enumerate(self.subjects):
                genuine_user_data = self.data.loc[self.data.user_id == subject, \
                                                  ["stroke duration", 'start $x$', 'start $y$', 'stop $x$', 'stop $y$',
                                                   'length of trajectory', 'mid-stroke pressure',
                                                   'mid-stroke area covered',
                                                   '20\%-perc. pairwise velocity', '50\%-perc. pairwise velocity',
                                                   '20\%-perc. dev. from end-to-end line',
                                                   '50\%-perc. dev. from end-to-end line',
                                                   '80\%-perc. dev. from end-to-end line']]
                imposter_data = self.data.loc[self.data.user_id != subject, :]
                # generated_data = attacker_data
                genuine_user_data = normalize_df(genuine_user_data[:400])

                self.train = genuine_user_data[:200]
                self.test_genuine = genuine_user_data[200:400]
                # self.test_imposter = normalize(imposter_data.groupby("user_id"). \
                #                          tail(10).loc[:, ["stroke duration", 'start $x$', 'start $y$', 'stop $x$', 'stop $y$',
                #                                          'length of trajectory', 'mid-stroke pressure', 'mid-stroke area covered',
                #                                          '20\%-perc. pairwise velocity', '50\%-perc. pairwise velocity',
                #                                          '20\%-perc. dev. from end-to-end line', '50\%-perc. dev. from end-to-end line',
                #                                          '80\%-perc. dev. from end-to-end line']])
                # print(idx)
                # self.test_imposter = normalize_np(self.attacker[idx])
                self.test_imposter = self.attacker[idx]
                self.training()
                self.testing()
                # eers.append(evaluateEER(self.u_scores, \
                #                         self.i_scores))
                fpr.append(
                    evaluateEERGMM(self.user_scores, self.imposter_scores))
                # print(evaluateFAR(self.u_scores, self.i_scores))

        else:
            genuine_user_data = self.data.loc[self.data.user_id == self.subjects, \
                                              ["stroke duration", 'start $x$', 'start $y$', 'stop $x$', 'stop $y$',
                                               'length of trajectory', 'mid-stroke pressure',
                                               'mid-stroke area covered',
                                               '20\%-perc. pairwise velocity', '50\%-perc. pairwise velocity',
                                               '20\%-perc. dev. from end-to-end line',
                                               '50\%-perc. dev. from end-to-end line',
                                               '80\%-perc. dev. from end-to-end line']]
            imposter_data = self.data.loc[
                self.data.user_id != self.subjects, :]
            # generated_data = attacker_data
            genuine_user_data = normalize_df(genuine_user_data[:400])

            self.train = genuine_user_data[:200]
            self.test_genuine = genuine_user_data[200:400]
            # self.test_imposter = imposter_data.groupby("subject"). \
            #                          head(6).loc[:, "H.period":"H.Return"]
            self.test_imposter = self.attacker

            self.training()
            self.testing()
            fpr.append(evaluateEERGMM(self.user_scores, self.imposter_scores))

        return np.mean(fpr)