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

hack to prevent libSVM to crach

parent efc25e19
No related tags found
No related merge requests found
Pipeline #24450 failed
...@@ -277,6 +277,12 @@ class SVM(Algorithm): ...@@ -277,6 +277,12 @@ class SVM(Algorithm):
machine = trainer.train(data) # train the machine machine = trainer.train(data) # train the machine
# TODO: find a proper way to handle this - Guillaume HEUSCH, 08-08-2018
if machine.shape[0] != data[0].shape[1]:
data[0] += 1
data[1] += 1
machine = trainer.train(data) # train the machine
precision_cv = self.comp_prediction_precision( precision_cv = self.comp_prediction_precision(
machine, np.copy(real_cv), np.copy(attack_cv)) machine, np.copy(real_cv), np.copy(attack_cv))
...@@ -369,6 +375,12 @@ class SVM(Algorithm): ...@@ -369,6 +375,12 @@ class SVM(Algorithm):
del attack del attack
machine = trainer.train(data) # train the machine machine = trainer.train(data) # train the machine
# TODO: find a proper way to handle this - Guillaume HEUSCH, 08-08-2018
if machine.shape[0] != data[0].shape[1]:
data[0] += 1
data[1] += 1
print("training again ...")
machine = trainer.train(data) # train the machine
if mean_std_norm_flag: if mean_std_norm_flag:
machine.input_subtract = features_mean # subtract the mean of train data machine.input_subtract = features_mean # subtract the mean of train data
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment