Skip to content
Snippets Groups Projects
Commit a82f4727 authored by Baptiste Bauvin's avatar Baptiste Bauvin
Browse files

Added a global SVM method

parent c8524de9
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,8 @@ def weightedLinear(monoViewDecisions, weights):
# The SVMClassifier is here used to find the right weights for linear fusion
# Here we have a function to train it, one to fuse.
# And one to do both.
def SVMForLinearFusionTrain(monoViewDecisions, labels):
SVMClassifier = SVC()
SVMClassifier.fit(monoViewDecisions, labels)
......@@ -40,6 +42,11 @@ def SVMForLinearFusionFuse(monoViewDecisions, SVMClassifier):
labels = SVMClassifier.predict(monoViewDecisions)
return labels
def SVMForLinearFusion(monoViewDecisions, labels):
SVMClassifier = SVMForLinearFusionTrain(monoViewDecisions, labels)
fusedLabels = SVMForLinearFusionFuse(monoViewDecisions, SVMClassifier)
return fusedLabels
# For majority voting, we have a problem : we have 5 fetures and 101 classes
# on Calthech, so if each feature votes for one class, we can't find a good
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment