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

Docs auto

parent a952ed41
No related branches found
No related tags found
No related merge requests found
.. |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
: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/pipeline.svg
:alt: Pipeline status
|pipeline|
.. image:: https://gitlab.lis-lab.fr/baptiste.bauvin/summit/badges/master/coverage.svg
......@@ -20,13 +20,8 @@ This project aims to be an easy-to-use solution to run a prior benchmark on a da
Getting Started
---------------
Prerequisites (will be automatically installed)
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
SuMMIT has been designed and uses continuous integration for Linux platforms (ubuntu 18.04), but we try to keep it as compatible as possible with Mac and Windows.
Last tests on each platform :
+----------+-------------------+
| Platform | Last positive test|
+==========+===================+
......@@ -38,11 +33,14 @@ Last tests on each platform :
+----------+-------------------+
Prerequisites
<<<<<<<<<<<<<
To be able to use this project, you'll need :
* `Python 3 <https://docs.python.org/3/>`_
And the following python modules :
And the following python modules will be automatically installed :
* `numpy <http://www.numpy.org/>`_, `scipy <https://scipy.org/>`_,
* `matplotlib <http://matplotlib.org/>`_ - Used to plot results,
......@@ -82,6 +80,7 @@ To run the test suite of SuMMIT, run :
cd path/to/summit
pytest
The coverage report is automatically generated and stored in the ``htmlcov/`` directory
Running on simulated data
<<<<<<<<<<<<<<<<<<<<<<<<<
......
API Documentation
=================
Multiview dataset management module
-----------------------------------
.. automodule:: summit.multiview_platform.utils.dataset
:members:
:inherited-members:
.. toctree::
:maxdepth: 3
api_files/dataset
autoapi/summit/multiview_platform/monoview_classifiers/index
autoapi/summit/multiview_platform/multiview_classifiers/index
Multiview dataset management module
-----------------------------------
.. automodule:: summit.multiview_platform.utils.dataset
:members:
:inherited-members:
\ No newline at end of file
......@@ -54,11 +54,20 @@ extensions = ['sphinx.ext.autodoc',
# 'sphinx.ext.ifconfig',
# 'sphinx.ext.viewcode',
# 'sphinx.ext.githubpages',
'sphinx.ext.napoleon',]
'sphinx.ext.napoleon',
'autoapi.extension'
]
autoapi_type = 'python'
autoapi_dirs = [os.path.join(repo_path, "summit", "multiview_platform", "monoview_classifiers", ""),
os.path.join(repo_path, "summit", "multiview_platform", "multiview_classifiers", "")]
autoapi_options = ["members", "show-module-summary", 'undoc-members']
autoapi_ignore = ["*additions*"]
autoapi_keep_files = False
auto_api_add_toctree_entry = False
autoapi_template_dir = os.path.join(repo_path, "docs", "source", "templates_autoapi")
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ['_templates', 'templates_autoapi']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
......@@ -193,6 +202,9 @@ rst_prolog = """
.. role:: yaml(code)
:language: yaml
.. role:: mod(code)
:language: python
.. |platf| replace:: SuMMIT
.. |HP| replace:: hyper-parameter
......
......@@ -12,12 +12,19 @@ This documentation consists in a short read me, with instructions to install and
All the content labelled WIP is Work In Progress
.. toctree::
:maxdepth: 1
:maxdepth: 2
tutorials/index
.. toctree::
:maxdepth: 3
api
Read me
=========
.. include:: readme_link.rst
......
{% if not obj.display %}
:orphan:
{% endif %}
:mod:`{{ obj.name }}`
======={{ "=" * obj.name|length }}
.. py:module:: {{obj.name}}
{% if obj.docstring %}
.. autoapi-nested-parse::
{{ obj.docstring|prepare_docstring|indent(3) }}
{% endif %}
{% block subpackages %}
{% set visible_subpackages = obj.subpackages|selectattr("display")|list %}
{% if visible_subpackages %}
Subpackages
-----------
.. toctree::
:titlesonly:
:maxdepth: 3
{% for subpackage in visible_subpackages %}
{{ subpackage.short_name }}/index.rst
{% endfor %}
{% endif %}
{% endblock %}
{% block submodules %}
{% set visible_submodules = obj.submodules|selectattr("display")|list %}
{% if visible_submodules %}
Submodules
----------
.. toctree::
:titlesonly:
:maxdepth: 1
{% for submodule in visible_submodules %}
{{ submodule.short_name }}/index.rst
{% endfor %}
{% endif %}
{% endblock %}
{% block content %}
{% if obj.all is not none %}
{% set visible_children = obj.children|selectattr("short_name", "in", obj.all)|list %}
{% elif obj.type is equalto("package") %}
{% set visible_children = obj.children|selectattr("display")|list %}
{% else %}
{% set visible_children = obj.children|selectattr("display")|rejectattr("imported")|list %}
{% endif %}
{% if visible_children %}
{{ obj.short_name }}
{{ "-" * obj.short_name|length }}
{% set visible_classes = visible_children|selectattr("type", "equalto", "class")|list %}
{% set visible_functions = visible_children|selectattr("type", "equalto", "function")|list %}
{% if "show-module-summary" in autoapi_options and (visible_classes or visible_functions) %}
{% block classes %}
{% if visible_classes %}
Classes
~~~~~~~
.. autoapisummary::
{% for klass in visible_classes %}
{{ klass.id }}
{% endfor %}
{% endif %}
{% endblock %}
{% block functions %}
{% if visible_functions %}
Functions
~~~~~~~~~
.. autoapisummary::
{% for function in visible_functions %}
{{ function.id }}
{% endfor %}
{% endif %}
{% endblock %}
{% endif %}
{% for obj_item in visible_children %}
{{ obj_item.rendered|indent(0) }}
{% endfor %}
{% endif %}
{% endblock %}
{% if not obj.display %}
:orphan:
{% endif %}
:mod:`{{ obj.name }}`
======={{ "=" * obj.name|length }}
.. py:module:: {{obj.name}}
{% if obj.docstring %}
.. autoapi-nested-parse::
{{ obj.docstring|prepare_docstring|indent(3) }}
{% endif %}
{% block subpackages %}
{% set visible_subpackages = obj.subpackages|selectattr("display")|list %}
{% if visible_subpackages %}
Subpackages
-----------
.. toctree::
:titlesonly:
:maxdepth: 3
{% for subpackage in visible_subpackages %}
{{ subpackage.short_name }}/index.rst
{% endfor %}
{% endif %}
{% endblock %}
{% block submodules %}
{% set visible_submodules = obj.submodules|selectattr("display")|list %}
{% if visible_submodules %}
{% if obj.short_name is equalto("monoview_classifiers") %}
Available monoview classifiers
------------------------------
{% elif obj.short_name is equalto("multiview_classifiers") %}
Available multiview classifiers
-------------------------------
{% endif %}
.. toctree::
:titlesonly:
:maxdepth: 1
{% for submodule in visible_submodules %}
{{ submodule.short_name }}/index.rst
{% endfor %}
{% endif %}
{% endblock %}
{% block content %}
{% if obj.all is not none %}
{% set visible_children = obj.children|selectattr("short_name", "in", obj.all)|list %}
{% elif obj.type is equalto("package") %}
{% set visible_children = obj.children|selectattr("display")|list %}
{% else %}
{% set visible_children = obj.children|selectattr("display")|rejectattr("imported")|list %}
{% endif %}
{% if visible_children %}
{{ obj.short_name }}
{{ "-" * obj.short_name|length }}
{% set visible_classes = visible_children|selectattr("type", "equalto", "class")|list %}
{% set visible_functions = visible_children|selectattr("type", "equalto", "function")|list %}
{% if "show-module-summary" in autoapi_options and (visible_classes or visible_functions) %}
{% block classes %}
{% if visible_classes %}
Classes
~~~~~~~
.. autoapisummary::
{% for klass in visible_classes %}
{{ klass.id }}
{% endfor %}
{% endif %}
{% endblock %}
{% block functions %}
{% if visible_functions %}
Functions
~~~~~~~~~
.. autoapisummary::
{% for function in visible_functions %}
{{ function.id }}
{% endfor %}
{% endif %}
{% endblock %}
{% endif %}
{% for obj_item in visible_children %}
{{ obj_item.rendered|indent(0) }}
{% endfor %}
{% endif %}
{% endblock %}
:orphan:
============================
Hyper-parameter 101
============================
......
docs/source/tutorials/images/example_0/zoom_plotly.gif

297 KiB

......@@ -58,7 +58,7 @@ def setup_package():
install_requires=requirements,
extras_requires={
'dev': ['pytest', 'pytest-cov'],
'doc': ['sphinx', 'numpydoc', 'docutils']},
'doc': ['sphinx', 'numpydoc', 'docutils', 'sphinx-autoapi']},
# Il est d'usage de mettre quelques metadata à propos de sa lib
# Pour que les robots puissent facilement la classer.
......
""" Ada"""
import os
import time
......
......@@ -75,7 +75,7 @@ class Dataset():
def to_numpy_array(self, sample_indices=None, view_indices=None):
"""
To concatenate the needed views in one big numpy array while saving the
Concatenates the needed views in one big numpy array while saving the
limits of each view in a list, to be able to retrieve them later.
Parameters
......@@ -192,15 +192,6 @@ class RAMDataset(Dataset):
return self.view_names[view_idx]
def init_attrs(self):
"""
Used to init the two attributes that are modified when self.dataset
changes
Returns
-------
"""
self.nb_view = len(self.views)
self.view_dict = dict((view_ind, self.view_names[view_ind])
for view_ind in range(self.nb_view))
......@@ -239,10 +230,6 @@ class RAMDataset(Dataset):
pass
def get_nb_class(self, sample_indices=None):
"""
Gets the number of class of the dataset
"""
sample_indices = self.init_sample_indices(sample_indices)
return len(np.unique(self.labels[sample_indices]))
......@@ -277,9 +264,9 @@ class RAMDataset(Dataset):
class HDF5Dataset(Dataset):
"""
Class of Dataset
Dataset class
This class is used to encapsulate the multiview dataset while keeping it stored on the disk instead of in RAM.
This is used to encapsulate the multiview dataset while keeping it stored on the disk instead of in RAM.
Parameters
......@@ -311,7 +298,7 @@ class HDF5Dataset(Dataset):
The name for each unique value of the labels given in labels.
is_temp : bool
Used if a temporary dataset has to be used by the benchmark.
Used if a temporary dataset has to be stored by the benchmark.
Attributes
----------
......@@ -327,7 +314,7 @@ class HDF5Dataset(Dataset):
"""
# The following methods use hdf5
# The following methods use h5py
def __init__(self, views=None, labels=None, are_sparse=False,
file_name="dataset.hdf5", view_names=None, path="",
......@@ -379,7 +366,7 @@ class HDF5Dataset(Dataset):
for i in range(labels.shape[0])]
def get_v(self, view_index, sample_indices=None):
r""" Extract the view and returns a numpy.ndarray containing the description
""" Extract the view and returns a numpy.ndarray containing the description
of the samples specified in sample_indices
Parameters
......@@ -452,14 +439,14 @@ class HDF5Dataset(Dataset):
Returns
-------
int
"""
return self.dataset["Metadata"].attrs["datasetLength"]
def get_view_dict(self):
"""
Returns the dictionary with view indices as keys and their corresponding
names as values
Returns the dictionary containing view indices as keys and their
corresponding names as values
"""
view_dict = {}
for view_index in range(self.nb_view):
......@@ -481,7 +468,8 @@ class HDF5Dataset(Dataset):
Returns
-------
list
seleted labels' names
"""
selected_labels = self.get_labels(sample_indices)
if decode:
......@@ -609,11 +597,6 @@ class HDF5Dataset(Dataset):
def add_gaussian_noise(self, random_state, path,
noise_std=0.15):
"""In this function, we add a guaussian noise centered in 0 with specified
std to each view, according to it's range (the noise will be
mutliplied by this range) and we crop the noisy signal according to the
view's attributes limits.
This is done by creating a new dataset, to keep clean data."""
noisy_dataset = h5py.File(path + self.get_name() + "_noised.hdf5", "w")
self.dataset.copy("Metadata", noisy_dataset)
self.dataset.copy("Labels", noisy_dataset)
......@@ -643,7 +626,7 @@ class HDF5Dataset(Dataset):
# The following methods are hdf5 free
def get_name(self):
"""Ony works if there are not multiple dots in the files name"""
"""Gets the name of the dataset hdf5 file"""
return os.path.split(self.dataset.filename)[-1].split('.')[0]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment