Skip to content
Snippets Groups Projects
Commit 17896c55 authored by Dominique Benielli's avatar Dominique Benielli
Browse files

doc passed

parent be3861e5
No related branches found
No related tags found
No related merge requests found
Pipeline #3919 failed
Showing
with 1 addition and 818 deletions
...@@ -17,6 +17,7 @@ Contributors: ...@@ -17,6 +17,7 @@ Contributors:
* Dominique Benielli <dominique.benielli_AT_univ-amu.fr> * Dominique Benielli <dominique.benielli_AT_univ-amu.fr>
* Riikka Huusari <rikka.huusari_AT_univ-amu.fr> * Riikka Huusari <rikka.huusari_AT_univ-amu.fr>
* Baptiste Bauvin <baptiste.bauvin_AT_univ-amu.fr> * Baptiste Bauvin <baptiste.bauvin_AT_univ-amu.fr>
* Hachem Kadri <hachem.kadri_AT_lis-lab.fr>
Description: Description:
----------- -----------
......
# -*- coding: utf-8 -*-
# import os, sys
#
# MultiviewPlatform documentation build configuration file, created by
# sphinx-quickstart on Mon Jan 29 17:13:09 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('../../multiconfusion'))
sys.path.insert(0, os.path.abspath('../..'))
file_loc = os.path.split(__file__)[0]
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(file_loc), '.')))
import multiconfusion
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
add_module_names = False
# sys.path.append(os.path.abspath('sphinxext'))
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc',
# 'sphinx.ext.doctest',
# 'sphinx.ext.intersphinx',
# 'sphinx.ext.todo',
# 'nbsphinx',
'sphinx.ext.coverage',
'sphinx.ext.imgmath',
# 'sphinx.ext.mathjax',
# 'sphinx.ext.ifconfig',
# 'sphinx.ext.viewcode',
# 'sphinx.ext.githubpages',
'sphinx.ext.napoleon',
'm2r',]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = {'.rst': 'restructuredtext', '.md': 'markdown'}
# source_suffix = '.rst'
source_suffix = ['.rst', '.md']
# source_parsers = {
# '.md': CommonMarkParser,
# }
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'MultiConfusion'
copyright = u'2019, Dominique Benielli'
author = u'Dominique Benielli'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u'0.0.0'
# The full version, including alpha/beta/rc tags.
release = u'0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = []
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
# html_theme = 'sphinx_rtd_theme'
html_theme = 'classic'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = []
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'MultiConfusiondoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'MultiConfusion.tex', u'MultiConfusion Documentation',
u'Dominique Benielli', 'manual'),
]
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'confusion', u'MultiConfusion Documentation',
[author], 1)
]
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'MultiConfusion', u'MultiConfusion Documentation',
author, 'MultiConfusion', 'One line description of project.',
'Miscellaneous'),
]
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
# def setup(app):
# app.add_config_value('recommonmark_config', {
# 'auto_toc_tree_section': 'Contents',
# }, True)
# app.add_transform(AutoStructify)
Credits
=======
**multiconfusion* is developped by the
`development team <https://developpement.lis-lab.fr/>`_ of the
`LIS <http://www.lis-lab.fr/>`_.
If you use **multiconfusion** in a scientific publication, please cite the
following paper::
@InProceedings{Koco:2011:BAM,
author={Ko\c{c}o, Sokol and Capponi, C{\'e}cile},
editor={Gunopulos, Dimitrios and Hofmann, Thomas and Malerba, Donato
and Vazirgiannis, Michalis},
title={A Boosting Approach to Multiview Classification with Cooperation},
booktitle={Proceedings of the 2011 European Conference on Machine Learning
and Knowledge Discovery in Databases - Volume Part II},
year={2011},
location={Athens, Greece},
publisher={Springer-Verlag},
address={Berlin, Heidelberg},
pages={209--228},
numpages = {20},
isbn={978-3-642-23783-6}
url={https://link.springer.com/chapter/10.1007/978-3-642-23783-6_14},
keywords={boosting, classification, multiview learning,
supervised learning},
}
References
----------
* Sokol Koço, Cécile Capponi,
`"A boosting approach to multiview classification with cooperation"
<https://link.springer.com/chapter/10.1007/978-3-642-23783-6_14>`_,
Proceedings of the 2011 European Conference on Machine Learning (ECML),
Athens, Greece, pp.209-228, 2011, Springer-Verlag.
* Sokol Koço,
`"Tackling the uneven views problem with cooperation based ensemble
learning methods" <http://www.theses.fr/en/2013AIXM4101>`_,
PhD Thesis, Aix-Marseille Université, 2013.
Copyright
---------
Université d'Aix Marseille (AMU) -
Centre National de la Recherche Scientifique (CNRS) -
Université de Toulon (UTLN).
Copyright © 2019-2020 AMU, CNRS, UTLN
License
-------
**multiconfusion** is free software: you can redistribute it and/or modify
it under the terms of the **GNU Lesser General Public License** as published by
the Free Software Foundation, either **version 3** of the License, or
(at your option) any later version.
.. Multiconfusion documentation master file, created by
sphinx-quickstart on Mon Sep 2 12:12:08 2019.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Mucumbo's documentation!
===================================
**multiconfusion** is a Python package implementing boost algorithms for
machine learning with multimodal with confusion matrix data.
It is compatible with `scikit-learn <http://scikit-learn.org/>`_, a popular
package for machine learning in Python.
.. toctree::
:maxdepth: 2
:caption: Contents:
install_devel
reference/index
credits
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Welcome to Multi-View Mu Cumbo's reference!
===========================================
.. toctree::
:maxdepth: 2
:caption: Contents:
modules
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
multiconfusion
==============
.. toctree::
:maxdepth: 3
.. automodule:: multiconfusion.cumbo
:members:
:inherited-members:
datasets
# -*- coding: utf-8 -*-
from datetime import date
import os
import sys
sys.path.insert(0, os.path.abspath('../metriclearning'))
sys.path.insert(0, os.path.abspath('../..'))
sys.path.insert(0, os.path.abspath("."))
sys.path.append(os.path.join(os.path.dirname(__name__), '..'))
sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'sphinxext'))
import metriclearning
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.imgmath',
'numpydoc',
# 'sphinx_gallery.gen_gallery'
]
# Add any paths that contain templates here, relative to this directory.
# templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
source_encoding = 'utf-8'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'metriclearning'
author = 'Dominique Benielli'
copyright = '2017-{}, LIS UMR 7020'.format(date.today().year)
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = metriclearning.__version__
# The full version, including alpha/beta/rc tags.
release = metriclearning.__version__
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
# language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
# today = ''
# Else, today_fmt is used as the format for a strftime call.
# today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = []
# The reST default role (used for this markup: `text`) to use for all
# documents.
# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
# keep_warnings = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'nature'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
# html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
# html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
# html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
# html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
# html_static_path = ['_static']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
# html_extra_path = []
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
# html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
# html_additional_pages = {}
# If false, no module index is generated.
# html_domain_indices = True
# If false, no index is generated.
# html_use_index = True
# If true, the index is split into individual pages for each letter.
# html_split_index = False
# If true, links to the reST sources are added to the pages.
# html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
# html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = '{}doc'.format(project)
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
'papersize': 'a4paper',
# The font size ('10pt', '11pt' or '12pt').
'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
# 'preamble': '',
# Latex figure (float) alignment
'figure_align': 'htbp'}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, '{}.tex'.format(project), '{} Documentation'.format(project),
author, 'manual')]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
# latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
# latex_use_parts = False
# If true, show page references after internal links.
# latex_show_pagerefs = False
# If true, show URL addresses after external links.
# latex_show_urls = False
# Documents to append as an appendix to all manuals.
# latex_appendices = []
# If false, no module index is generated.
# latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, project, '{} Documentation'.format(project),
[author], 1)
]
# If true, show URL addresses after external links.
# man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, project, '{} Documentation'.format(project), author, project,
'Multi-View Metric Learning in Vector-Valued Kernel Spaces for machine learning.',
'Miscellaneous')]
# Documents to append as an appendix to all manuals.
# texinfo_appendices = []
# If false, no module index is generated.
# texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
# texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
# texinfo_no_detailmenu = False
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
'sklearn': ('http://scikit-learn.org/stable', None)
}
numpydoc_show_class_members = False
sphinx_gallery_conf = {
'doc_module': (project,),
'backreferences_dir': 'backreferences',
# path to your examples scripts
'examples_dirs': '../examples',
# path where to save gallery generated examples
'gallery_dirs': 'auto_examples'}
# Generate the plots for the gallery
plot_gallery = 'True'
.. metriclearning documentation master file, created by
sphinx-quickstart on Mon Sep 2 12:12:08 2019.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to metriclearning's documentation!
==========================================
.. toctree::
:maxdepth: 2
:caption: Contents:
reference/index
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
datasets
========
.. automodule:: metriclearning.datasets.base
:members:
:undoc-members:
:show-inheritance:
.. automodule:: metriclearning.datasets.data_sample
:members:
:undoc-members:
:show-inheritance:
Welcome to Multi-View metriclearning's reference!
=================================================
.. toctree::
:maxdepth: 2
:caption: Contents:
modules
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
lpMKL
=====
.. automodule:: metriclearning.lpMKL
:members: MKL
:undoc-members:
:show-inheritance:
abstract mkernel
================
.. automodule:: metriclearning.mkernel
:members: MKernel
:undoc-members:
:show-inheritance:
metriclearning
==============
.. toctree::
:maxdepth: 3
mkernel
mvml
lpMKL
datasets
MVML of metriclearning
======================
.. automodule:: metriclearning.mvml
:members: MVML
:undoc-members:
:show-inheritance:
API Documentation
=================
multimodalboost.mumbo
---------------------
.. automodule:: multimodalboost.mumbo
:members:
:inherited-members:
File deleted
File deleted
:orphan:
.. _sphx_glr_auto_examples:
.. _examples:
Examples
========
The following toy examples illustrate how the MuMBo algorithm exploits
cooperation between views for classification.
.. raw:: html
<div class="sphx-glr-thumbcontainer" tooltip="In this toy example, we generate data from two classes, split between two two-dimensional views...">
.. only:: html
.. figure:: /auto_examples/images/thumb/sphx_glr_plot_2_views_2_classes_thumb.png
:ref:`sphx_glr_auto_examples_plot_2_views_2_classes.py`
.. raw:: html
</div>
.. toctree::
:hidden:
/auto_examples/plot_2_views_2_classes
.. raw:: html
<div class="sphx-glr-thumbcontainer" tooltip="In this toy example, we generate data from three classes, split between three two-dimensional v...">
.. only:: html
.. figure:: /auto_examples/images/thumb/sphx_glr_plot_3_views_3_classes_thumb.png
:ref:`sphx_glr_auto_examples_plot_3_views_3_classes.py`
.. raw:: html
</div>
.. toctree::
:hidden:
/auto_examples/plot_3_views_3_classes
.. raw:: html
<div class="sphx-glr-clear"></div>
.. only :: html
.. container:: sphx-glr-footer
:class: sphx-glr-footer-gallery
.. container:: sphx-glr-download
:download:`Download all examples in Python source code: auto_examples_python.zip <//home/dominique/projets/ANR-Lives/multimodal/multimodalboost/doc/auto_examples/auto_examples_python.zip>`
.. container:: sphx-glr-download
:download:`Download all examples in Jupyter notebooks: auto_examples_jupyter.zip <//home/dominique/projets/ANR-Lives/multimodal/multimodalboost/doc/auto_examples/auto_examples_jupyter.zip>`
.. only:: html
.. rst-class:: sphx-glr-signature
`Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
%% Cell type:code id: tags:
``` python
%matplotlib inline
```
%% Cell type:markdown id: tags:
\n==========================\n2 views, 2 classes example\n==========================\n\nIn this toy example, we generate data from two classes, split between two\ntwo-dimensional views.\n\nFor each view, the data are generated so that half of the points of each class\nare well separated in the plane, while the other half of the points are not\nseparated and placed in the same area. We also insure that the points that are\nnot separated in one view are well separated in the other view.\n\nThus, in the figure representing the data, the points represented by crosses\n(x) are well separated in view 0 while they are not separated in view 1, while\nthe points represented by dots (.) are well separated in view 1 while they are\nnot separated in view 0. In this figure, the blue symbols represent points\nof class 0, while red symbols represent points of class 1.\n\nThe MuMBo algorithm take adavantage of the complementarity of the two views to\nrightly classify the points.
%% Cell type:code id: tags:
``` python
# Université d'Aix Marseille (AMU) -\n# Centre National de la Recherche Scientifique (CNRS) -\n# Université de Toulon (UTLN).\n# Copyright © 2017-2018 AMU, CNRS, UTLN\n#\n# This file is part of multimodalboost.\n#\n# multimodalboost is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Lesser General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# multimodalboost is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU Lesser General Public License for more details.\n#\n# You should have received a copy of the GNU Lesser General Public License\n# along with multimodalboost. If not, see <http://www.gnu.org/licenses/>.\n#\n# Author: Florent JAILLET - Laboratoire d'Informatique et Systèmes - UMR 7020\n\nimport numpy as np\nfrom multimodalboost.mumbo import MumboClassifier\nfrom matplotlib import pyplot as plt\n\n\ndef generate_data(n_samples, lim):\n """Generate random data in a rectangle"""\n lim = np.array(lim)\n n_features = lim.shape[0]\n data = np.random.random((n_samples, n_features))\n data = (lim[:, 1]-lim[:, 0]) * data + lim[:, 0]\n return data\n\n\nseed = 12\nnp.random.seed(seed)\n\nn_samples = 100\n\nview_0 = np.concatenate((generate_data(n_samples, [[0., 1.], [0., 1.]]),\n generate_data(n_samples, [[1., 2.], [0., 1.]]),\n generate_data(n_samples, [[0., 1.], [0., 1.]]),\n generate_data(n_samples, [[0., 1.], [1., 2.]])))\n\nview_1 = np.concatenate((generate_data(n_samples, [[1., 2.], [0., 1.]]),\n generate_data(n_samples, [[0., 1.], [0., 1.]]),\n generate_data(n_samples, [[0., 1.], [1., 2.]]),\n generate_data(n_samples, [[0., 1.], [0., 1.]])))\n\nX = np.concatenate((view_0, view_1), axis=1)\n\ny = np.zeros(4*n_samples, dtype=np.int64)\ny[2*n_samples:] = 1\n\nviews_ind = np.array([0, 2, 4])\n\nn_estimators = 3\nclf = MumboClassifier(n_estimators=n_estimators)\nclf.fit(X, y, views_ind)\n\nprint('\nAfter 3 iterations, the MuMBo classifier reaches exact '\n 'classification for the\nlearning samples:')\nfor ind, score in enumerate(clf.staged_score(X, y)):\n print(' - iteration {}, score: {}'.format(ind + 1, score))\n\n\nprint('\nThe resulting MuMBo classifier uses three sub-classifiers that are '\n 'wheighted\nusing the following weights:\n'\n ' estimator weights: {}'.format(clf.estimator_weights_))\n\nprint('\nThe two first sub-classifiers use the data of view 0 to compute '\n 'their\nclassification results, while the third one uses the data of '\n 'view 1:\n'\n ' best views: {}'. format(clf.best_views_))\n\nprint('\nThe first figure displays the data, splitting the representation '\n 'between the\ntwo views.')\n\nfig = plt.figure(figsize=(10., 8.))\nfig.suptitle('Representation of the data', size=16)\nfor ind_view in range(2):\n ax = plt.subplot(2, 1, ind_view + 1)\n ax.set_title('View {}'.format(ind_view))\n ind_feature = ind_view * 2\n styles = ('.b', 'xb', '.r', 'xr')\n labels = ('non-separated', 'separated')\n for ind in range(4):\n ind_class = ind // 2\n label = labels[(ind + ind_view) % 2]\n ax.plot(X[n_samples*ind:n_samples*(ind+1), ind_feature],\n X[n_samples*ind:n_samples*(ind+1), ind_feature + 1],\n styles[ind],\n label='Class {} ({})'.format(ind_class, label))\n ax.legend()\n\nprint('\nThe second figure displays the classification results for the '\n 'sub-classifiers\non the learning sample data.\n')\n\nstyles = ('.b', '.r')\nfig = plt.figure(figsize=(12., 7.))\nfig.suptitle('Classification results on the learning data for the '\n 'sub-classifiers', size=16)\nfor ind_estimator in range(n_estimators):\n best_view = clf.best_views_[ind_estimator]\n y_pred = clf.estimators_[ind_estimator].predict(\n X[:, 2*best_view:2*best_view+2])\n background_color = (1.0, 1.0, 0.9)\n for ind_view in range(2):\n ax = plt.subplot(2, 3, ind_estimator + 3*ind_view + 1)\n if ind_view == best_view:\n ax.set_facecolor(background_color)\n ax.set_title(\n 'Sub-classifier {} - View {}'.format(ind_estimator, ind_view))\n ind_feature = ind_view * 2\n for ind_class in range(2):\n ind_samples = (y_pred == ind_class)\n ax.plot(X[ind_samples, ind_feature],\n X[ind_samples, ind_feature + 1],\n styles[ind_class],\n label='Class {}'.format(ind_class))\n ax.legend(title='Predicted class:')\n\nplt.show()
```
6bfb170b1af59e9ec2958eea239976e2
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment