Skip to content

Commit

Permalink
Merge pull request #5 from INGEOTEC/develop
Browse files Browse the repository at this point in the history
Missing imports
  • Loading branch information
mgraffg authored Feb 22, 2024
2 parents 84f6aee + 8233485 commit 3f6ae38
Show file tree
Hide file tree
Showing 8 changed files with 321 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2

build:
os: "ubuntu-22.04"
tools:
python: "miniconda3-4.7"

conda:
environment: environment.yml
4 changes: 2 additions & 2 deletions CompStats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
# limitations under the License.
__version__ = '0.0.4'
from CompStats.bootstrap import StatisticSamples
from CompStats.measurements import CI
from CompStats.performance import performance, difference, plot_performance, plot_difference
from CompStats.measurements import CI, difference_p_value
from CompStats.performance import performance, difference, all_differences, plot_performance, plot_difference
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = CompStats
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
178 changes: 178 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config

# -- Path setup --------------------------------------------------------------

# 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('../..'))
import CompStats


# -- Project information -----------------------------------------------------

project = 'CompStats'
copyright = '2024, Sergio Nava, Mario Graff, Hugo Jair Escalante'
author = 'Sergio Nava-Muñoz, Mario Graff, Hugo Jair Escalante'

# The short X.Y version
version = CompStats.__version__
# The full version, including alpha/beta/rc tags
release = version


# -- 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.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
'sphinx.ext.intersphinx'
]

intersphinx_mapping = {}

# 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', '.md']
source_suffix = '.rst'

# The master toctree document.
master_doc = 'index'

# 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 = 'en'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path .
exclude_patterns = []

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
highlight_language = 'python'
# autoclass_content = 'both'
autodoc_member_order = 'bysource'
autodoc_class_signature = 'separated'
add_function_parentheses = False
add_module_names = 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 = '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 = {
"rightsidebar": "false",
"relbarbgcolor": "black",
"sidebarbgcolor": "white",
"sidebartextcolor": "black"
}

# 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']

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}


# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'CompStatsdoc'
html_logo = 'ingeotec.png'


# -- 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, 'CompStats.tex', 'CompStats Documentation',
'Sergio Nava-Muñoz, Mario Graff, Hugo Jair Escalante', '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, 'CompStats', 'CompStats 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, 'CompStats', 'CompStats Documentation',
author, 'CompStats', 'One line description of project.',
'Miscellaneous'),
]


# -- Extension configuration -------------------------------------------------
Binary file added docs/source/difference.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
112 changes: 112 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
.. _CompStats:

====================================
CompStats
====================================
.. image:: https://github.com/INGEOTEC/CompStats/actions/workflows/test.yaml/badge.svg
:target: https://github.com/INGEOTEC/CompStats/actions/workflows/test.yaml

.. image:: https://coveralls.io/repos/github/INGEOTEC/CompStats/badge.svg?branch=develop
:target: https://coveralls.io/github/INGEOTEC/CompStats?branch=develop

.. image:: https://badge.fury.io/py/CompStats.svg
:target: https://badge.fury.io/py/CompStats

.. image:: https://readthedocs.org/projects/compstats/badge/?version=latest
:target: https://compstats.readthedocs.io/en/latest/?badge=latest


CompStats

Quickstart Guide
====================================

The first step is to install CompStats, which is described below.

Installing CompStats
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The first step is to install the library, which can be done using the `conda package manager <https://conda-forge.org/>`_ with the following instruction.

.. code:: bash
conda install -c conda-forge CompStats
A more general approach to installing CompStats is through the use of the command pip, as illustrated in the following instruction.

.. code:: bash
pip install CompStats
Performance
^^^^^^^^^^^^^^^^^^^^^

.. code-block:: python
>>> from CompStats import performance, plot_performance
>>> from CompStats.tests.test_performance import DATA
>>> from sklearn.metrics import f1_score
>>> import pandas as pd
>>> df = pd.read_csv(DATA)
>>> score = lambda y, hy: f1_score(y, hy, average='weighted')
>>> perf = performance(df, score=score)
>>> ins = plot_performance(perf)
.. image:: performance.png


Performance Comparison
^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: python
>>> from CompStats import performance, difference, plot_difference
>>> from CompStats.tests.test_performance import DATA
>>> from sklearn.metrics import f1_score
>>> import pandas as pd
>>> df = pd.read_csv(DATA)
>>> score = lambda y, hy: f1_score(y, hy, average='weighted')
>>> perf = performance(df, score=score)
>>> diff = difference(perf)
>>> ins = plot_difference(diff)
.. image:: difference.png


The difference p-value can be estimated with the following instruction.


.. code-block:: python
>>> from CompStats.measurements import difference_p_value
>>> p_values = difference_p_value(diff)
>>> p_values['BoW']
0.22
>>> p_values['StackBoW']
0.104
Citing
==========

If you find CompStats useful for any academic/scientific purpose, we would appreciate citations to the following reference:

.. code:: bibtex
@article{Nava:2023,
title = {{Comparison of Classifiers in Challenge Scheme}},
year = {2023},
journal = {Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)},
author = {Nava-Mu{\~{n}}oz, Sergio and Graff Guerrero, Mario and Escalante, Hugo Jair},
pages = {89--98},
volume = {13902 LNCS},
publisher = {Springer Science and Business Media Deutschland GmbH},
url = {https://link.springer.com/chapter/10.1007/978-3-031-33783-3_9},
isbn = {9783031337826},
doi = {10.1007/978-3-031-33783-3{\_}9/COVER},
issn = {16113349},
keywords = {Bootstrap, Challenges, Performance}
}
Binary file added docs/source/ingeotec.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/performance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3f6ae38

Please sign in to comment.