This algorithm computes the score given a GMM and UBM using the Linear Scoring

This algorithm is a legacy one. The API has changed since its implementation. New versions and forks will need to be updated.

Algorithms have at least one input and one output. All algorithm endpoints are organized in groups. Groups are used by the platform to indicate which inputs and outputs are synchronized together. The first group is automatically synchronized with the channel defined by the block in which the algorithm is deployed.

Group: probes

Endpoint Name Data Format Nature
comparison_ids system/array_1d_text/1 Input
keystroke tutorial/atvs_keystroke/1 Input
probe_client_id system/text/1 Input
scores elie_khoury/string_probe_scores/1 Output

Group: templates

Endpoint Name Data Format Nature
template_client_id system/text/1 Input
template_id system/text/1 Input
model_template aythamimm/keystroke_model/6 Input

Parameters allow users to change the configuration of an algorithm when scheduling an experiment

Name Description Type Default Range/Choices
field string given_name given_name, family_name, email, nationality, id_number, all_five
xxxxxxxxxx
214
 
1
import numpy
2
3
def scaled_distance(in1,in2,in3):    
4
    dif=[]
5
    mean_gal_features=in1
6
    std_gal_features=in2
7
    probe_features=in3
8
    l_features=len(probe_features)
9
       
10
    std_threshold=0.2*numpy.mean(std_gal_features);
11
    for i in range( l_features):
12
        if std_gal_features[i] < std_threshold:
13
            std_gal_features[i]=std_threshold    
14
    
15
    for i_dif in range(l_features):
16
        dif.append((abs(mean_gal_features[i_dif]-probe_features[i_dif]))/std_gal_features[i_dif])            
17
    score = 1/numpy.average(dif)    
18
    return score
19
20
class Algorithm:
21
22
    def __init__(self):        
23
        self.templates = None   
24
        self.field='given_name'
25
    
26
    def setup(self, parameters):         
27
        self.field = parameters.get('field', self.field)
28
        
29
        return True
30
    
31
    def process(self, inputs, outputs):
32
33
        # retrieve all the templates once
34
        if self.templates is None:
35
            self.templates = {}
36
            group = inputs.groupOf('model_template')
37
38
            while group.hasMoreData():
39
                group.next()
40
41
                template_id = group['template_id'].data.text                
42
                
43
                if self.field == 'given_name':
44
                    template1=group['model_template'].data.given_name_average
45
                    template2=group['model_template'].data.given_name_std
46
                if self.field == 'family_name':
47
                    template1=group['model_template'].data.family_name_average
48
                    template2=group['model_template'].data.family_name_std
49
                if self.field == 'email':
50
                    template1=group['model_template'].data.email_average
51
                    template2=group['model_template'].data.email_std
52
                if self.field == 'nationality':
53
                    template1=group['model_template'].data.nationality_average
54
                    template2=group['model_template'].data.nationality_std
55
                if self.field == 'id_number':
56
                    template1=group['model_template'].data.id_number_average
57
                    template2=group['model_template'].data.id_number_std
58
                if self.field == 'all_five':
59
                    template11=group['model_template'].data.given_name_average
60
                    template12=group['model_template'].data.given_name_std                
61
                    template21=group['model_template'].data.family_name_average
62
                    template22=group['model_template'].data.family_name_std              
63
                    template31=group['model_template'].data.email_average
64
                    template32=group['model_template'].data.email_std                
65
                    template41=group['model_template'].data.nationality_average
66
                    template42=group['model_template'].data.nationality_std
67
                    template51=group['model_template'].data.id_number_average
68
                    template52=group['model_template'].data.id_number_std 
69
                
70
                if self.field != 'all_five':
71
                    self.templates[template_id] = dict(
72
                        client_id = group['template_client_id'].data.text,                    
73
                        model_average = template1,
74
                        model_std = template2,                      
75
                    )
76
                if self.field == 'all_five':
77
                    self.templates[template_id] = dict(
78
                        client_id = group['template_client_id'].data.text,                    
79
                        model_average1 = template11,
80
                        model_std1 = template12,
81
                        model_average2 = template21,
82
                        model_std2 = template22,
83
                        model_average3 = template31,
84
                        model_std3 = template32,
85
                        model_average4 = template41,
86
                        model_std4 = template42,
87
                        model_average5 = template51,
88
                        model_std5 = template52,
89
                    )
90
91
        # process the probe
92
        comparison_ids = inputs['comparison_ids'].data.text
93
        data = inputs['keystroke'].data     
94
        if self.field == 'given_name':
95
            f1 = data.holdtime.given_name
96
            f2 = data.rplatency.given_name
97
        if self.field == 'family_name':
98
            f1 = data.holdtime.family_name
99
            f2 = data.rplatency.family_name
100
        if self.field == 'email':
101
            f1 = data.holdtime.email
102
            f2 = data.rplatency.email
103
        if self.field == 'nationality':
104
            f1 = data.holdtime.nationality
105
            f2 = data.rplatency.nationality        
106
        if self.field == 'id_number':
107
            f1 = data.holdtime.id_number
108
            f2 = data.rplatency.id_number
109
        if self.field == 'all_five':
110
            f11 = data.holdtime.given_name
111
            f12 = data.rplatency.given_name        
112
            f21 = data.holdtime.family_name
113
            f22 = data.rplatency.family_name      
114
            f31 = data.holdtime.email
115
            f32 = data.rplatency.email       
116
            f41 = data.holdtime.nationality
117
            f42 = data.rplatency.nationality 
118
            f51 = data.holdtime.id_number
119
            f52 = data.rplatency.id_number 
120
        
121
        if self.field != 'all_five':
122
            feature_vector=[]
123
            l_f=len(f1)
124
            for i_k in range(l_f):
125
                feature_vector.append(float(f1[i_k]))
126
            
127
            l_f=len(f2)
128
            for i_k in range(l_f):
129
                feature_vector.append(float(f2[i_k]))        
130
            
131
            probe_features=feature_vector
132
            
133
        if self.field == 'all_five':
134
            feature_vector1=[]
135
            l_f=len(f11)
136
            for i_k in range(l_f):
137
                feature_vector1.append(float(f11[i_k]))
138
        
139
            l_f=len(f12)
140
            for i_k in range(l_f):
141
                feature_vector1.append(float(f12[i_k]))        
142
            
143
            feature_vector2=[]
144
            l_f=len(f21)
145
            for i_k in range(l_f):
146
                feature_vector2.append(float(f21[i_k]))
147
        
148
            l_f=len(f22)
149
            for i_k in range(l_f):
150
                feature_vector2.append(float(f22[i_k]))  
151
            
152
            feature_vector3=[]
153
            l_f=len(f31)
154
            for i_k in range(l_f):
155
                feature_vector3.append(float(f31[i_k]))
156
        
157
            l_f=len(f32)
158
            for i_k in range(l_f):
159
                feature_vector3.append(float(f32[i_k]))  
160
            
161
            feature_vector4=[]
162
            l_f=len(f41)
163
            for i_k in range(l_f):
164
                feature_vector4.append(float(f41[i_k]))
165
        
166
            l_f=len(f42)
167
            for i_k in range(l_f):
168
                feature_vector4.append(float(f42[i_k]))  
169
            
170
            feature_vector5=[]
171
            l_f=len(f51)
172
            for i_k in range(l_f):
173
                feature_vector5.append(float(f51[i_k]))
174
        
175
            l_f=len(f52)
176
            for i_k in range(l_f):
177
                feature_vector5.append(float(f52[i_k])) 
178
        
179
            probe_features1=feature_vector1
180
            probe_features2=feature_vector2
181
            probe_features3=feature_vector3
182
            probe_features4=feature_vector4
183
            probe_features5=feature_vector5
184
        
185
        scores = []
186
        for comparison_id in comparison_ids:
187
            template_client_identity = self.templates[comparison_id]['client_id']            
188
            
189
            if self.field != 'all_five':
190
                score=scaled_distance(self.templates[comparison_id]['model_average'],self.templates[comparison_id]['model_std'],probe_features);
191
                
192
            if self.field == 'all_five':
193
                score=[]
194
                score.append(scaled_distance(self.templates[comparison_id]['model_average1'],self.templates[comparison_id]['model_std1'],probe_features1))
195
                score.append(scaled_distance(self.templates[comparison_id]['model_average2'],self.templates[comparison_id]['model_std2'],probe_features2))
196
                score.append(scaled_distance(self.templates[comparison_id]['model_average3'],self.templates[comparison_id]['model_std3'],probe_features3))
197
                score.append(scaled_distance(self.templates[comparison_id]['model_average4'],self.templates[comparison_id]['model_std4'],probe_features4))
198
                score.append(scaled_distance(self.templates[comparison_id]['model_average5'],self.templates[comparison_id]['model_std5'],probe_features5))
199
                score=numpy.average(score)
200
                
201
            scores.append({
202
                'template_identity': template_client_identity,
203
                'score': score,
204
            })
205
206
        outputs['scores'].write({
207
                'client_identity': inputs['probe_client_id'].data.text,
208
                'scores': scores
209
            },
210
            end_data_index=inputs['probe_client_id'].data_index_end
211
        )
212
213
        return True
214

The code for this algorithm in Python
The ruler at 80 columns indicate suggested POSIX line breaks (for readability).
The editor will automatically enlarge to accomodate the entirety of your input
Use keyboard shortcuts for search/replace and faster editing. For example, use Ctrl-F (PC) or Cmd-F (Mac) to search through this box

For a given set of feature vectors, a Gaussian Mixture Model (GMM) of the target client and an UBM-GMM, this algorithm computes the scoring using the linear scoring implemented on the `Bob https://www.idiap.ch/software/bob/docs/releases/last/sphinx/html/machine/generated/bob.machine.linear_scoring.html?highlight=linear%20scoring#bob.machine.linear_scoring`_

This algorithm relies on the `Bob &amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;http://www.idiap.ch/software/bob/&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;`_ library.

Docutils System Messages

System Message: ERROR/3 (<string>, line 1); backlink

Unknown target name: "bob https://www.idiap.ch/software/bob/docs/releases/last/sphinx/html/machine/generated/bob.machine.linear_scoring.html?highlight=linear%20scoring#bob.machine.linear_scoring".

System Message: ERROR/3 (<string>, line 3); backlink

Unknown target name: "bob &amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;http://www.idiap.ch/software/bob/&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;".

Experiments

Updated Name Databases/Protocols Analyzers
aythamimm/aythamimm/btas15_keystroke_experiments/6/BTAS_2015_Kesytroke_Experiment atvskeystroke/1@A aythamimm/analyzer_keystroke/70
Created with Raphaël 2.1.2[compare]aythamimm/manhattan_scaled_scoring/632015Jul29

This table shows the number of times this algorithm has been successfully run using the given environment. Note this does not provide sufficient information to evaluate if the algorithm will run when submitted to different conditions.

Terms of Service | Contact Information | BEAT platform version 2.2.1b0 | © Idiap Research Institute - 2013-2025