Commit f1f528e4 authored by Guillaume HEUSCH's avatar Guillaume HEUSCH
Browse files

[algorithm] added two output units to MLP binary classifier

parent 8b6edd8e
......@@ -38,8 +38,10 @@ class MLP(Algorithm):
# The data
batch_size = len(training_features[0]) + len(training_features[1])
label_real = numpy.ones((len(training_features[0]), 1), dtype='float64')
label_attack = numpy.zeros((len(training_features[1]), 1), dtype='float64')
label_real = numpy.zeros((len(training_features[0]), 2), dtype='float64')
label_real[:, 0] = 1
label_attack = numpy.zeros((len(training_features[1]), 2), dtype='float64')
label_attack[:, 1] = 1
real = numpy.array(training_features[0])
attack = numpy.array(training_features[1])
......@@ -53,7 +55,7 @@ class MLP(Algorithm):
shape.append(input_dim)
for i in range(len(self.hidden_units)):
shape.append(self.hidden_units[i])
shape.append(1)
shape.append(2)
shape = tuple(shape)
self.mlp = bob.learn.mlp.Machine(shape)
......@@ -85,4 +87,8 @@ class MLP(Algorithm):
return self.mlp(feature)
def score(self, toscore):
#print(toscore)
#print(toscore[0])
#import sys
#sys.exit()
return [toscore[0]]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment