Skip to content
Snippets Groups Projects
Commit f1f528e4 authored by Guillaume HEUSCH's avatar Guillaume HEUSCH
Browse files

[algorithm] added two output units to MLP binary classifier

parent 8b6edd8e
No related branches found
No related tags found
1 merge request!33WIP: added LDA and MLP
...@@ -38,8 +38,10 @@ class MLP(Algorithm): ...@@ -38,8 +38,10 @@ class MLP(Algorithm):
# The data # The data
batch_size = len(training_features[0]) + len(training_features[1]) batch_size = len(training_features[0]) + len(training_features[1])
label_real = numpy.ones((len(training_features[0]), 1), dtype='float64') label_real = numpy.zeros((len(training_features[0]), 2), dtype='float64')
label_attack = numpy.zeros((len(training_features[1]), 1), 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]) real = numpy.array(training_features[0])
attack = numpy.array(training_features[1]) attack = numpy.array(training_features[1])
...@@ -53,7 +55,7 @@ class MLP(Algorithm): ...@@ -53,7 +55,7 @@ class MLP(Algorithm):
shape.append(input_dim) shape.append(input_dim)
for i in range(len(self.hidden_units)): for i in range(len(self.hidden_units)):
shape.append(self.hidden_units[i]) shape.append(self.hidden_units[i])
shape.append(1) shape.append(2)
shape = tuple(shape) shape = tuple(shape)
self.mlp = bob.learn.mlp.Machine(shape) self.mlp = bob.learn.mlp.Machine(shape)
...@@ -85,4 +87,8 @@ class MLP(Algorithm): ...@@ -85,4 +87,8 @@ class MLP(Algorithm):
return self.mlp(feature) return self.mlp(feature)
def score(self, toscore): def score(self, toscore):
#print(toscore)
#print(toscore[0])
#import sys
#sys.exit()
return [toscore[0]] return [toscore[0]]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment