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

Merge branch 'develop'

parents 013f4022 c07e8d96
No related branches found
No related tags found
No related merge requests found
Pipeline #4903 failed
Showing
with 74 additions and 238 deletions
.. |pipeline| image:: https://gitlab.lis-lab.fr/baptiste.bauvin/summit/badges/master/pipeline.svg .. |pipeline| image:: https://gitlab.lis-lab.fr/baptiste.bauvin/summit/badges/master/pipeline.svg
:alt: Pipeline status :alt: Pipeline status
.. image:: https://img.shields.io/badge/License-GPL%20v3-blue.svg .. |license| image:: https://img.shields.io/badge/License-GPL%20v3-blue.svg
:target: http://www.gnu.org/licenses/gpl-3.0 :target: http://www.gnu.org/licenses/gpl-3.0
:alt: License: GPL v3 :alt: License: GPL v3
|pipeline| .. |coverage| image:: https://gitlab.lis-lab.fr/baptiste.bauvin/summit/badges/master/coverage.svg
.. image:: https://gitlab.lis-lab.fr/baptiste.bauvin/summit/badges/master/coverage.svg
:target: http://baptiste.bauvin.pages.lis-lab.fr/summit/coverage/index.html :target: http://baptiste.bauvin.pages.lis-lab.fr/summit/coverage/index.html
:alt: Coverage :alt: Coverage
|pipeline| |license| |coverage|
Supervised MultiModal Integration Tool's Readme Supervised MultiModal Integration Tool's Readme
=============================================== ===============================================
...@@ -109,7 +111,7 @@ For your first go with SuMMIT, you can run it on simulated data with ...@@ -109,7 +111,7 @@ For your first go with SuMMIT, you can run it on simulated data with
This will run the benchmark of `documentation's Example 1 <http://baptiste.bauvin.pages.lis-lab.fr/summit/tutorials/example1.html>`_. This will run the benchmark of `documentation's Example 1 <http://baptiste.bauvin.pages.lis-lab.fr/summit/tutorials/example1.html>`_.
For more information about the examples, see the `documentation <http://baptiste.bauvin.pages.lis-lab.fr/summit/>`_. For more information about the examples, see the `documentation <http://baptiste.bauvin.pages.lis-lab.fr/summit/index.html>`_.
Results will, by default, be stored in the results directory of the installation path : Results will, by default, be stored in the results directory of the installation path :
``path/to/summit/multiview_platform/examples/results``. ``path/to/summit/multiview_platform/examples/results``.
......
.. toctree::
:maxdepth: 1
autoapi/summit/multiview_platform/monoview_classifiers/index
autoapi/summit/multiview_platform/multiview_classifiers/index
\ No newline at end of file
...@@ -20,7 +20,8 @@ This documentation consists in a short read me, with instructions to install and ...@@ -20,7 +20,8 @@ This documentation consists in a short read me, with instructions to install and
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
classifiers autoapi/summit/multiview_platform/monoview_classifiers/index
autoapi/summit/multiview_platform/multiview_classifiers/index
Read me Read me
......
""" Ada"""
import os import os
import time import time
...@@ -19,38 +18,7 @@ classifier_class_name = "Adaboost" ...@@ -19,38 +18,7 @@ classifier_class_name = "Adaboost"
class Adaboost(AdaBoostClassifier, BaseMonoviewClassifier): class Adaboost(AdaBoostClassifier, BaseMonoviewClassifier):
""" """
This class implement a Classifier with adaboost algorithm inherit from sklearn This class is an adaptation of scikit-learn's `AdaBoostClassifier <https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.AdaBoostClassifier.html#sklearn.ensemble.AdaBoostClassifier>`_
AdaBoostClassifier
Parameters
----------
random_state : int seed, RandomState instance, or None (default=None)
The seed of the pseudo random number multiview_generator to use when
shuffling the data.
n_estimators : int number of estimators
base_estimator :
kwargs : others arguments
Attributes
----------
param_name :
classed_params :
distribs :
weird_strings :
plotted_metric : selection of metric to plot
plotted_metric_name : name of the metric to plot
step_predictions :
""" """
...@@ -75,23 +43,6 @@ class Adaboost(AdaBoostClassifier, BaseMonoviewClassifier): ...@@ -75,23 +43,6 @@ class Adaboost(AdaBoostClassifier, BaseMonoviewClassifier):
self.step_predictions = None self.step_predictions = None
def fit(self, X, y, sample_weight=None): def fit(self, X, y, sample_weight=None):
"""
Fit adaboost model
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
y : { array-like, shape (n_samples,)
Target values class labels in classification
sample_weight :
Returns
-------
self : object
Returns self.
"""
begin = time.time() begin = time.time()
AdaBoostClassifier.fit(self, X, y, sample_weight=sample_weight) AdaBoostClassifier.fit(self, X, y, sample_weight=sample_weight)
end = time.time() end = time.time()
...@@ -104,21 +55,6 @@ class Adaboost(AdaBoostClassifier, BaseMonoviewClassifier): ...@@ -104,21 +55,6 @@ class Adaboost(AdaBoostClassifier, BaseMonoviewClassifier):
return self return self
def predict(self, X): def predict(self, X):
"""
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
Training vectors, where n_samples is the number of samples
and n_features is the number of features.
For kernel="precomputed", the expected shape of X is
(n_samples, n_samples).
Returns
-------
predictions : ndarray of shape (n_samples, )
The estimated labels.
"""
begin = time.time() begin = time.time()
pred = AdaBoostClassifier.predict(self, X) pred = AdaBoostClassifier.predict(self, X)
end = time.time() end = time.time()
......
...@@ -11,9 +11,15 @@ classifier_class_name = "DecisionTree" ...@@ -11,9 +11,15 @@ classifier_class_name = "DecisionTree"
class DecisionTree(DecisionTreeClassifier, BaseMonoviewClassifier): class DecisionTree(DecisionTreeClassifier, BaseMonoviewClassifier):
"""
This class is an adaptation of scikit-learn's `DecisionTreeClassifier <https://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeClassifier.html>`_
"""
def __init__(self, random_state=None, max_depth=None, def __init__(self, random_state=None, max_depth=None,
criterion='gini', splitter='best', **kwargs): criterion='gini', splitter='best', **kwargs):
DecisionTreeClassifier.__init__(self, DecisionTreeClassifier.__init__(self,
max_depth=max_depth, max_depth=max_depth,
criterion=criterion, criterion=criterion,
......
...@@ -24,6 +24,11 @@ class CustomDecisionTreeGB(DecisionTreeClassifier): ...@@ -24,6 +24,11 @@ class CustomDecisionTreeGB(DecisionTreeClassifier):
class GradientBoosting(GradientBoostingClassifier, BaseMonoviewClassifier): class GradientBoosting(GradientBoostingClassifier, BaseMonoviewClassifier):
"""
This class is an adaptation of scikit-learn's `GradientBoostingClassifier <https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingClassifier.html>`_
"""
def __init__(self, random_state=None, loss="exponential", max_depth=1.0, def __init__(self, random_state=None, loss="exponential", max_depth=1.0,
n_estimators=100, n_estimators=100,
......
...@@ -12,17 +12,9 @@ classifier_class_name = "KNN" ...@@ -12,17 +12,9 @@ classifier_class_name = "KNN"
class KNN(KNeighborsClassifier, BaseMonoviewClassifier): class KNN(KNeighborsClassifier, BaseMonoviewClassifier):
""" """
Implement extention of KNeighborsClassifier of sklearn This class is an adaptation of scikit-learn's `KNeighborsClassifier <https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KNeighborsClassifier.html>`_
for the usage of the summit.
Parameters
----------
random_state
n_neighbors
weights
algorithm
p
kwargs
""" """
def __init__(self, random_state=None, n_neighbors=5, def __init__(self, random_state=None, n_neighbors=5,
......
...@@ -13,36 +13,8 @@ classifier_class_name = "Lasso" ...@@ -13,36 +13,8 @@ classifier_class_name = "Lasso"
class Lasso(LassoSK, BaseMonoviewClassifier): class Lasso(LassoSK, BaseMonoviewClassifier):
""" """
This class is an adaptation of scikit-learn's `Lasso <https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Lasso.html>`_
Parameters
----------
random_state :
alpha : float, optional
Constant that multiplies the L1 term. Defaults to 1.0.
``alpha = 0`` is equivalent to an ordinary least square, solved
by the :class:`LinearRegression` object. For numerical
reasons, using ``alpha = 0`` is with the Lasso object is
not advised
and you should prefer the LinearRegression object. (default( : 10)
max_iter : int The maximum number of iterations (default : 10)
warm_start : bool, optional
When set to True, reuse the solution of the previous call to fit as
initialization, otherwise, just erase the previous solution.
kwargs : others arguments
Attributes
----------
param_name :
classed_params :
distribs :
weird_strings :
""" """
......
...@@ -11,47 +11,15 @@ classifier_class_name = "RandomForest" ...@@ -11,47 +11,15 @@ classifier_class_name = "RandomForest"
class RandomForest(RandomForestClassifier, BaseMonoviewClassifier): class RandomForest(RandomForestClassifier, BaseMonoviewClassifier):
"""RandomForest Classifier Class """
This class is an adaptation of scikit-learn's `RandomForestClassifier <https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html>`_
Parameters
----------
random_state : int seed, RandomState instance, or None (default=None)
The seed of the pseudo random number multiview_generator to use when
shuffling the data.
n_estimators : int (default : 10) number of estimators
max_depth : int , optional (default : None) maximum of depth
criterion : criteria (default : 'gini')
kwargs : others arguments
Attributes
----------
param_names :
distribs :
classed_params :
weird_strings :
""" """
def __init__(self, random_state=None, n_estimators=10, def __init__(self, random_state=None, n_estimators=10,
max_depth=None, criterion='gini', **kwargs): max_depth=None, criterion='gini', **kwargs):
"""
Parameters
----------
random_state
n_estimators
max_depth
criterion
kwargs
"""
RandomForestClassifier.__init__(self, RandomForestClassifier.__init__(self,
n_estimators=n_estimators, n_estimators=n_estimators,
max_depth=max_depth, max_depth=max_depth,
...@@ -68,17 +36,7 @@ class RandomForest(RandomForestClassifier, BaseMonoviewClassifier): ...@@ -68,17 +36,7 @@ class RandomForest(RandomForestClassifier, BaseMonoviewClassifier):
def get_interpretation(self, directory, base_file_name, y_test, def get_interpretation(self, directory, base_file_name, y_test,
multiclass=False): multiclass=False):
"""
Parameters
----------
directory
y_test
Returns
-------
string for interpretation interpret_string
"""
interpret_string = "" interpret_string = ""
interpret_string += self.get_feature_importance(directory, interpret_string += self.get_feature_importance(directory,
base_file_name) base_file_name)
......
...@@ -12,30 +12,8 @@ classifier_class_name = "SGD" ...@@ -12,30 +12,8 @@ classifier_class_name = "SGD"
class SGD(SGDClassifier, BaseMonoviewClassifier): class SGD(SGDClassifier, BaseMonoviewClassifier):
""" """
This class is an adaptation of scikit-learn's `SGDClassifier <https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.SGDClassifier.html>`_
Parameters
----------
random_state : int seed, RandomState instance, or None (default=None)
The seed of the pseudo random number multiview_generator to use when
shuffling the data.
loss : str , (default = "hinge")
penalty : str, (default = "l2")
alpha : float, (default = 0.0001)
kwargs : other arguments
Attributes
----------
param_names :
distribs :
classed_params :
weird_strings :
""" """
......
...@@ -11,20 +11,10 @@ classifier_class_name = "SVMLinear" ...@@ -11,20 +11,10 @@ classifier_class_name = "SVMLinear"
class SVMLinear(SVCClassifier, BaseMonoviewClassifier): class SVMLinear(SVCClassifier, BaseMonoviewClassifier):
"""SVMLinear """
This class is an adaptation of scikit-learn's `SVC <https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html>`_
Parameters
----------
random_state : int seed, RandomState instance, or None (default=None)
The seed of the pseudo random number multiview_generator to use when
shuffling the data.
C : float, optional (default=1.0)
Penalty parameter C of the error term.
kwargs : others arguments
Here, it is the linear kernel version
""" """
def __init__(self, random_state=None, C=1.0, **kwargs): def __init__(self, random_state=None, C=1.0, **kwargs):
......
...@@ -13,30 +13,9 @@ classifier_class_name = "SVMPoly" ...@@ -13,30 +13,9 @@ classifier_class_name = "SVMPoly"
class SVMPoly(SVCClassifier, BaseMonoviewClassifier): class SVMPoly(SVCClassifier, BaseMonoviewClassifier):
""" """
Class of SVMPoly for SVC Classifier This class is an adaptation of scikit-learn's `SVC <https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html>`_
Parameters Here, it is the polynomial kernel version
----------
random_state : int seed, RandomState instance, or None (default=None)
The seed of the pseudo random number multiview_generator to use when
shuffling the data.
C : float, optional (default=1.0)
Penalty parameter C of the error term.
degree :
kwargs : others arguments
Attributes
----------
param_names : list of parameters names
distribs : list of random_state distribution
""" """
def __init__(self, random_state=None, C=1.0, degree=3, **kwargs): def __init__(self, random_state=None, C=1.0, degree=3, **kwargs):
......
...@@ -12,24 +12,9 @@ classifier_class_name = "SVMRBF" ...@@ -12,24 +12,9 @@ classifier_class_name = "SVMRBF"
class SVMRBF(SVCClassifier, BaseMonoviewClassifier): class SVMRBF(SVCClassifier, BaseMonoviewClassifier):
""" """
class SVMRBF for classifier SVCC This class is an adaptation of scikit-learn's `SVC <https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html>`_
Parameters Here, it is the RBF kernel version
----------
random_state : int seed, RandomState instance, or None (default=None)
The seed of the pseudo random number multiview_generator to use when
shuffling the data.
C :
kwargs : others arguments
Attributes
----------
param_names : list of parameters names
distribs : list of random_state distribution
""" """
def __init__(self, random_state=None, C=1.0, **kwargs): def __init__(self, random_state=None, C=1.0, **kwargs):
......
...@@ -8,6 +8,11 @@ classifier_class_name = "BayesianInferenceClassifier" ...@@ -8,6 +8,11 @@ classifier_class_name = "BayesianInferenceClassifier"
class BayesianInferenceClassifier(LateFusionClassifier): class BayesianInferenceClassifier(LateFusionClassifier):
"""
"""
def __init__(self, random_state, classifiers_names=None, def __init__(self, random_state, classifiers_names=None,
classifier_configs=None, nb_cores=1, weights=None, classifier_configs=None, nb_cores=1, weights=None,
rs=None): rs=None):
......
...@@ -8,6 +8,11 @@ classifier_class_name = "DifficultyFusion" ...@@ -8,6 +8,11 @@ classifier_class_name = "DifficultyFusion"
class DifficultyFusion(GlobalDiversityFusionClassifier): class DifficultyFusion(GlobalDiversityFusionClassifier):
"""
This classifier is inspired by Kuncheva, Ludmila & Whitaker, Chris. (2000). Measures of Diversity in Classifier Ensembles.
It find the subset of monoview classifiers with the best difficulty
"""
def diversity_measure(self, classifiers_decisions, combination, y): def diversity_measure(self, classifiers_decisions, combination, y):
_, nb_view, nb_samples = classifiers_decisions.shape _, nb_view, nb_samples = classifiers_decisions.shape
scores = np.zeros((nb_view, nb_samples), dtype=int) scores = np.zeros((nb_view, nb_samples), dtype=int)
......
...@@ -8,6 +8,11 @@ classifier_class_name = "DisagreeFusion" ...@@ -8,6 +8,11 @@ classifier_class_name = "DisagreeFusion"
class DisagreeFusion(CoupleDiversityFusionClassifier): class DisagreeFusion(CoupleDiversityFusionClassifier):
"""
This classifier is inspired by Kuncheva, Ludmila & Whitaker, Chris. (2000). Measures of Diversity in Classifier Ensembles.
It find the subset of monoview classifiers with the best disagreement
"""
def diversity_measure(self, first_classifier_decision, def diversity_measure(self, first_classifier_decision,
second_classifier_decision, _): second_classifier_decision, _):
return np.logical_xor(first_classifier_decision, return np.logical_xor(first_classifier_decision,
......
...@@ -8,6 +8,13 @@ classifier_class_name = "DoubleFaultFusion" ...@@ -8,6 +8,13 @@ classifier_class_name = "DoubleFaultFusion"
class DoubleFaultFusion(CoupleDiversityFusionClassifier): class DoubleFaultFusion(CoupleDiversityFusionClassifier):
"""
This classifier is inspired by
Kuncheva, Ludmila & Whitaker, Chris. (2000). Measures of Diversity in
Classifier Ensembles.
It find the subset of monoview classifiers with the best double fault
"""
def diversity_measure(self, first_classifier_decision, def diversity_measure(self, first_classifier_decision,
second_classifier_decision, y): second_classifier_decision, y):
return np.logical_and(np.logical_xor(first_classifier_decision, y), return np.logical_and(np.logical_xor(first_classifier_decision, y),
......
...@@ -8,6 +8,11 @@ classifier_class_name = "EntropyFusion" ...@@ -8,6 +8,11 @@ classifier_class_name = "EntropyFusion"
class EntropyFusion(GlobalDiversityFusionClassifier): class EntropyFusion(GlobalDiversityFusionClassifier):
"""
This classifier is inspired by Kuncheva, Ludmila & Whitaker, Chris. (2000). Measures of Diversity in Classifier Ensembles.
It find the subset of monoview classifiers with the best entropy
"""
def diversity_measure(self, classifiers_decisions, combination, y): def diversity_measure(self, classifiers_decisions, combination, y):
_, nb_view, nb_samples = classifiers_decisions.shape _, nb_view, nb_samples = classifiers_decisions.shape
scores = np.zeros((nb_view, nb_samples), dtype=int) scores = np.zeros((nb_view, nb_samples), dtype=int)
......
...@@ -12,6 +12,11 @@ class VotingIndecision(Exception): ...@@ -12,6 +12,11 @@ class VotingIndecision(Exception):
class MajorityVoting(LateFusionClassifier): class MajorityVoting(LateFusionClassifier):
"""
This classifier is a late fusion that builds a majority vote between the views
"""
def __init__(self, random_state, classifiers_names=None, def __init__(self, random_state, classifiers_names=None,
classifier_configs=None, weights=None, nb_cores=1, rs=None): classifier_configs=None, weights=None, nb_cores=1, rs=None):
self.need_probas = False self.need_probas = False
......
...@@ -8,6 +8,11 @@ classifier_class_name = "SVMJumboFusion" ...@@ -8,6 +8,11 @@ classifier_class_name = "SVMJumboFusion"
class SVMJumboFusion(BaseJumboFusion): class SVMJumboFusion(BaseJumboFusion):
"""
This classifier learns monoview classifiers on each view and then uses an
SVM on their decisions to aggregate them.
"""
def __init__(self, random_state=None, classifiers_names=None, def __init__(self, random_state=None, classifiers_names=None,
classifier_configs=None, nb_cores=1, weights=None, classifier_configs=None, nb_cores=1, weights=None,
nb_monoview_per_view=1, C=1.0, kernel="rbf", degree=2, nb_monoview_per_view=1, C=1.0, kernel="rbf", degree=2,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment