Skip to content

Commit

Permalink
tune documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed Jan 30, 2018
1 parent 5f1aba3 commit 7e239d4
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 17 deletions.
3 changes: 3 additions & 0 deletions _doc/examples/README.txt
@@ -0,0 +1,3 @@
====================
Galleries d'exemples
====================
6 changes: 6 additions & 0 deletions _doc/examples/lectures/README.txt
@@ -0,0 +1,6 @@

.. _l-gallery-examples:

Exemples longs
--------------

42 changes: 42 additions & 0 deletions _doc/examples/lectures/plot_nuage.py
@@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
"""
Corrélations
============
Dessine les corrélations pour un jeu de données.
"""

###############
# A remplacer.

import os
import sys
this = os.path.abspath(os.path.dirname(__file__))
if "papierstat" in this:
this = this.split("papierstat")[0].rstrip("\\/")
for module in ["papierstat"]:
try:
exec("import %s" % module)
except ImportError:
p = os.path.join(this, module, "src")
sys.path.append(p)
exec("import %s" % module)


#########################
# Récupération des données

from papierstat.datasets import load_wines_dataset
df = load_wines_dataset()
print(df.head(n=2).T)

####################
# Les corrélations avec :epkg:`seaborn`.

from seaborn import clustermap

clustermap(df.corr(), center=0, cmap="vlag",
linewidths=.75, figsize=(13, 13))

import matplotlib.pyplot as plt
plt.show()
4 changes: 2 additions & 2 deletions _doc/notebooks/lectures/wines_knn.ipynb
Expand Up @@ -175,8 +175,8 @@
}
],
"source": [
"from papierstat.datasets import load_wines_datasets\n",
"df = load_wines_datasets()\n",
"from papierstat.datasets import load_wines_dataset\n",
"df = load_wines_dataset()\n",
"df.head()"
]
},
Expand Down
4 changes: 2 additions & 2 deletions _doc/notebooks/lectures/wines_knn_eval.ipynb
Expand Up @@ -25,8 +25,8 @@
"metadata": {},
"outputs": [],
"source": [
"from papierstat.datasets import load_wines_datasets\n",
"df = load_wines_datasets()\n",
"from papierstat.datasets import load_wines_dataset\n",
"df = load_wines_dataset()\n",
"X = df.drop(['quality', 'color'], axis=1)\n",
"y = df['quality']"
]
Expand Down
4 changes: 2 additions & 2 deletions _doc/notebooks/lectures/wines_knn_split.ipynb
Expand Up @@ -24,8 +24,8 @@
"metadata": {},
"outputs": [],
"source": [
"from papierstat.datasets import load_wines_datasets\n",
"df = load_wines_datasets()\n",
"from papierstat.datasets import load_wines_dataset\n",
"df = load_wines_dataset()\n",
"X = df.drop(['quality', 'color'], axis=1)\n",
"y = df['quality']"
]
Expand Down
15 changes: 15 additions & 0 deletions _doc/sphinxdoc/source/biblio.rst
@@ -0,0 +1,15 @@

Bibliographie
=============

*Anti-sèches*

* `Anti-sèches de machine learning <http://www.xavierdupre.fr/app/ensae_teaching_cs/helpsphinx3/ii_antiseches.html>`_

*Blog*

* `Freakeconometrics <http://freakonometrics.hypotheses.org/>`_

*Livres*

* `The Elements of Statistical Learning <https://web.stanford.edu/~hastie/ElemStatLearn/>`_
1 change: 1 addition & 0 deletions _doc/sphinxdoc/source/index.rst
Expand Up @@ -18,6 +18,7 @@ Petit voyage au pays du machine learning
introduction
rappel
lectures/index
biblio
api/index
all_notebooks
i_ex
Expand Down
12 changes: 6 additions & 6 deletions _doc/sphinxdoc/source/lectures/step1.rst
Expand Up @@ -36,8 +36,8 @@ ci-dessous, pour deux vins.
:rst:

from pyquickhelper.pandashelper import df2rst
from papierstat.datasets import load_wines_datasets
df = load_wines_datasets()
from papierstat.datasets import load_wines_dataset
df = load_wines_dataset()
print(df2rst(df.head(n=2).T.reset_index(drop=False)))

On part du principe que si deux vins différents ont la même
Expand Down Expand Up @@ -75,14 +75,14 @@ Il peut être également obtenu avec le code suivant :
:rst:

from pyquickhelper.pandashelper import df2rst
from papierstat.datasets import load_wines_datasets
df = load_wines_datasets()
from papierstat.datasets import load_wines_dataset
df = load_wines_dataset()
print(df2rst(df.head()))

.. plot::

from papierstat.datasets import load_wines_datasets
df = load_wines_datasets()
from papierstat.datasets import load_wines_dataset
df = load_wines_dataset()

import matplotlib.pyplot as plt
plt.close('all')
Expand Down
6 changes: 3 additions & 3 deletions _unittests/ut_datasets/test_wines.py
Expand Up @@ -39,7 +39,7 @@

from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import ExtTestCase
from src.papierstat.datasets import load_wines_datasets
from src.papierstat.datasets import load_wines_dataset


class TestWines(ExtTestCase):
Expand All @@ -50,7 +50,7 @@ def test_wines_download(self):
self._testMethodName,
OutputPrint=__name__ == "__main__")

df = load_wines_datasets(download=True)
df = load_wines_dataset(download=True)
self.assertEqual(df.shape, (6497, 13))

def test_wines_local(self):
Expand All @@ -59,7 +59,7 @@ def test_wines_local(self):
self._testMethodName,
OutputPrint=__name__ == "__main__")

df = load_wines_datasets(download=False)
df = load_wines_dataset(download=False)
self.assertEqual(df.shape, (6497, 13))


Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Expand Up @@ -6,7 +6,7 @@ openpyxl
pandas_streaming
pycodestyle>=2.0.0
pydocstyle
pyquickhelper>=1.6.2283
pyquickhelper>=1.6.2284
sphinx-bootstrap-theme
sphinx-gallery
sphinx-redactor-theme
Expand Down
2 changes: 1 addition & 1 deletion src/papierstat/datasets/__init__.py
Expand Up @@ -16,7 +16,7 @@ def get_data_folder():
return os.path.abspath(this)


def load_wines_datasets(download=False):
def load_wines_dataset(download=False):
"""
Retourne le jeu de données
`wines quality <https://archive.ics.uci.edu/ml/datasets/wine+quality>`_.
Expand Down

0 comments on commit 7e239d4

Please sign in to comment.