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

Added feature importances on coef_ compatible algorithms

parent 88d015a9
No related branches found
No related tags found
No related merge requests found
......@@ -22,8 +22,8 @@ Classification:
nb_folds: 2
nb_class: 2
classes:
type: ["multiview","monoview"]
algos_monoview: ["decision_tree", "adaboost"]
type: ["monoview"]
algos_monoview: ["all", ]
algos_multiview: ["weighted_linear_early_fusion"]
stats_iter: 2
metrics: ["accuracy_score", "f1_score"]
......
......@@ -63,6 +63,7 @@ class Lasso(LassoSK, BaseMonoviewClassifier):
neg_y = np.copy(y)
neg_y[np.where(neg_y == 0)] = -1
super(Lasso, self).fit(X, neg_y)
self.feature_importances_ = self.coef_/np.sum(self.coef_)
return self
def predict(self, X):
......
......@@ -79,6 +79,8 @@ class SGD(SGDClassifier, BaseMonoviewClassifier):
interpret_string str to interpreted
"""
interpret_string = ""
import numpy as np
self.feature_importances_ = (self.coef_/np.sum(self.coef_)).reshape(self.coef_.shape[1])
return interpret_string
......
......@@ -34,6 +34,12 @@ class SVMLinear(SVCClassifier, BaseMonoviewClassifier):
self.param_names = ["C", "random_state"]
self.distribs = [CustomUniform(loc=0, state=1), [random_state]]
def getInterpret(self, directory, y_test):
interpret_string = ""
import numpy as np
self.feature_importances_ = (self.coef_/np.sum(self.coef_)).reshape((self.coef_.shape[1],))
return interpret_string
# def formatCmdArgs(args):
# """Used to format kwargs for the parsed args"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment