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

Doc auto classifiers

parent 1c9b41d7
No related branches found
No related tags found
No related merge requests found
Showing
with 74 additions and 238 deletions
.. |pipeline| image:: https://gitlab.lis-lab.fr/baptiste.bauvin/summit/badges/master/pipeline.svg
: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
:alt: License: GPL v3
|pipeline|
.. image:: https://gitlab.lis-lab.fr/baptiste.bauvin/summit/badges/master/coverage.svg
.. |coverage| 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
:alt: Coverage
|pipeline| |license| |coverage|
Supervised MultiModal Integration Tool's Readme
===============================================
......@@ -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>`_.
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 :
``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
.. toctree::
:maxdepth: 2
classifiers
autoapi/summit/multiview_platform/monoview_classifiers/index
autoapi/summit/multiview_platform/multiview_classifiers/index
Read me
......
""" Ada"""
import os
import time
......@@ -19,38 +18,7 @@ classifier_class_name = "Adaboost"
class Adaboost(AdaBoostClassifier, BaseMonoviewClassifier):
"""
This class implement a Classifier with adaboost algorithm inherit from sklearn
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 :
This class is an adaptation of scikit-learn's `AdaBoostClassifier <https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.AdaBoostClassifier.html#sklearn.ensemble.AdaBoostClassifier>`_
"""
......@@ -75,23 +43,6 @@ class Adaboost(AdaBoostClassifier, BaseMonoviewClassifier):
self.step_predictions = 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()
AdaBoostClassifier.fit(self, X, y, sample_weight=sample_weight)
end = time.time()
......@@ -104,21 +55,6 @@ class Adaboost(AdaBoostClassifier, BaseMonoviewClassifier):
return self
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()
pred = AdaBoostClassifier.predict(self, X)
end = time.time()
......
......@@ -11,9 +11,15 @@ classifier_class_name = "DecisionTree"
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,
criterion='gini', splitter='best', **kwargs):
DecisionTreeClassifier.__init__(self,
max_depth=max_depth,
criterion=criterion,
......
......@@ -24,6 +24,11 @@ class CustomDecisionTreeGB(DecisionTreeClassifier):
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,
n_estimators=100,
......
......@@ -12,17 +12,9 @@ classifier_class_name = "KNN"
class KNN(KNeighborsClassifier, BaseMonoviewClassifier):
"""
Implement extention of KNeighborsClassifier of sklearn
for the usage of the summit.
Parameters
----------
random_state
n_neighbors
weights
algorithm
p
kwargs
This class is an adaptation of scikit-learn's `KNeighborsClassifier <https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KNeighborsClassifier.html>`_
"""
def __init__(self, random_state=None, n_neighbors=5,
......
......@@ -13,36 +13,8 @@ classifier_class_name = "Lasso"
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"
class RandomForest(RandomForestClassifier, BaseMonoviewClassifier):
"""RandomForest Classifier Class
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 :
"""
This class is an adaptation of scikit-learn's `RandomForestClassifier <https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html>`_
weird_strings :
"""
def __init__(self, random_state=None, n_estimators=10,
max_depth=None, criterion='gini', **kwargs):
"""
Parameters
----------
random_state
n_estimators
max_depth
criterion
kwargs
"""
RandomForestClassifier.__init__(self,
n_estimators=n_estimators,
max_depth=max_depth,
......@@ -68,17 +36,7 @@ class RandomForest(RandomForestClassifier, BaseMonoviewClassifier):
def get_interpretation(self, directory, base_file_name, y_test,
multiclass=False):
"""
Parameters
----------
directory
y_test
Returns
-------
string for interpretation interpret_string
"""
interpret_string = ""
interpret_string += self.get_feature_importance(directory,
base_file_name)
......
......@@ -12,30 +12,8 @@ classifier_class_name = "SGD"
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"
class SVMLinear(SVCClassifier, BaseMonoviewClassifier):
"""SVMLinear
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
"""
This class is an adaptation of scikit-learn's `SVC <https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html>`_
Here, it is the linear kernel version
"""
def __init__(self, random_state=None, C=1.0, **kwargs):
......
......@@ -13,30 +13,9 @@ classifier_class_name = "SVMPoly"
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
----------
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
Here, it is the polynomial kernel version
"""
def __init__(self, random_state=None, C=1.0, degree=3, **kwargs):
......
......@@ -12,24 +12,9 @@ classifier_class_name = "SVMRBF"
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
----------
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
Here, it is the RBF kernel version
"""
def __init__(self, random_state=None, C=1.0, **kwargs):
......
......@@ -8,6 +8,11 @@ classifier_class_name = "BayesianInferenceClassifier"
class BayesianInferenceClassifier(LateFusionClassifier):
"""
"""
def __init__(self, random_state, classifiers_names=None,
classifier_configs=None, nb_cores=1, weights=None,
rs=None):
......
......@@ -8,6 +8,11 @@ classifier_class_name = "DifficultyFusion"
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):
_, nb_view, nb_samples = classifiers_decisions.shape
scores = np.zeros((nb_view, nb_samples), dtype=int)
......
......@@ -8,6 +8,11 @@ classifier_class_name = "DisagreeFusion"
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,
second_classifier_decision, _):
return np.logical_xor(first_classifier_decision,
......
......@@ -8,6 +8,13 @@ classifier_class_name = "DoubleFaultFusion"
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,
second_classifier_decision, y):
return np.logical_and(np.logical_xor(first_classifier_decision, y),
......
......@@ -8,6 +8,11 @@ classifier_class_name = "EntropyFusion"
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):
_, nb_view, nb_samples = classifiers_decisions.shape
scores = np.zeros((nb_view, nb_samples), dtype=int)
......
......@@ -12,6 +12,11 @@ class VotingIndecision(Exception):
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,
classifier_configs=None, weights=None, nb_cores=1, rs=None):
self.need_probas = False
......
......@@ -8,6 +8,11 @@ classifier_class_name = "SVMJumboFusion"
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,
classifier_configs=None, nb_cores=1, weights=None,
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