<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Thanks for your answers.<br>
<br>
DBSCAN has the correct doc because the fit_predict method is not
inherited, but it has its own implementation (because of the
additional parameter sample_weight).<br>
<br>
I have forked the sklearn repo. I work in a virtualenv (virtualenv
venv3 --no-site-packages --python python3.5).<br>
<b>python3 setup.py install</b> completes, but <b>make test-code</b>
and <b>make doc-noplot</b> fail.<br>
<br>
<div>Do you have any idea about the origin of these errors ? <br>
I intend to install work on the python3 version. When I run make
test-code, I am surprise that there are references to
/usr/lib/python2.7/.<br>
<br>
</div>
<div>Thanks for your help, <br>
<br>
</div>
<div>Anaël Beaugnon<br>
<font size="+1"><b><br>
<br>
</b><b>make doc-noplot</b></font><br>
<br>
Exception occurred:<br>
File "/usr/lib/python3.5/zipfile.py", line 1435, in write<br>
st = os.stat(filename)<br>
FileNotFoundError: [Errno 2] No such file or directory:
'/<dir>/scikit-learn/doc/auto_examples/plot_digits_pipe.ipynb'<br>
The full traceback has been saved in
/tmp/sphinx-err-ivjeif0v.log, if you want to report the issue to
the developers.<br>
Please also report this if it was a user error, so that a better
error message can be provided next time.<br>
A bug report can be filed in the tracker at
<a class="moz-txt-link-rfc2396E" href="https://github.com/sphinx-doc/sphinx/issues"><https://github.com/sphinx-doc/sphinx/issues></a>. Thanks!<br>
<br>
File /tmp/sphinx-err-ivjeif0v.log<br>
<br>
# Sphinx version: 1.7.4<br>
# Python version: 3.5.3 (CPython)<br>
# Docutils version: 0.14<br>
# Jinja2 version: 2.10<br>
# Last messages:<br>
<br>
# Loaded extensions:<br>
Traceback (most recent call last):<br>
File
"/<dir>/scikit-learn/venv3/lib/python3.5/site-packages/sphinx/cmdline.py",
line 303, in main<br>
args.warningiserror, args.tags, args.verbosity, args.jobs)<br>
File
"/<dir>/scikit-learn/venv3/lib/python3.5/site-packages/sphinx/application.py",
line 233, in __init__<br>
self._init_builder()<br>
File
"/<dir>/scikit-learn/venv3/lib/python3.5/site-packages/sphinx/application.py",
line 311, in _init_builder<br>
self.emit('builder-inited')<br>
File
"/<dir>/scikit-learn/venv3/lib/python3.5/site-packages/sphinx/application.py",
line 444, in emit<br>
return self.events.emit(event, self, *args)<br>
File
"/<dir>/scikit-learn/venv3/lib/python3.5/site-packages/sphinx/events.py",
line 79, in emit<br>
results.append(callback(*args))<br>
File
"/<dir>/scikit-learn/venv3/lib/python3.5/site-packages/sphinx_gallery/gen_gallery.py",
line 247, in generate_gallery_rst<br>
download_fhindex = generate_zipfiles(gallery_dir)<br>
File
"/<dir>/scikit-learn/venv3/lib/python3.5/site-packages/sphinx_gallery/downloads.py",
line 115, in generate_zipfiles<br>
jy_zipfile = python_zip(listdir, gallery_dir, ".ipynb")<br>
File
"/<dir>/scikit-learn/venv3/lib/python3.5/site-packages/sphinx_gallery/downloads.py",
line 69, in python_zip<br>
zipf.write(file_src, os.path.relpath(file_src,
gallery_path))<br>
File "/usr/lib/python3.5/zipfile.py", line 1435, in write<br>
st = os.stat(filename)<br>
FileNotFoundError: [Errno 2] No such file or directory:
'/<dir>/scikit-learn/doc/auto_examples/plot_digits_pipe.ipynb'<br>
<br>
<br>
<b><font size="+1">make test-code</font></b><br>
<br>
=======================================================================
ERRORS
=======================================================================<br>
_________________________________________________________________ ERROR
collecting
__________________________________________________________________<br>
/usr/lib/python2.7/dist-packages/py/_path/common.py:366: in
visit<br>
for x in Visitor(fil, rec, ignore, bf, sort).gen(self):<br>
/usr/lib/python2.7/dist-packages/py/_path/common.py:405: in gen<br>
if p.check(dir=1) and (rec is None or rec(p))])<br>
/usr/lib/python2.7/dist-packages/_pytest/main.py:682: in
_recurse<br>
ihook = self.gethookproxy(path)<br>
/usr/lib/python2.7/dist-packages/_pytest/main.py:587: in
gethookproxy<br>
my_conftestmodules = pm._getconftestmodules(fspath)<br>
/usr/lib/python2.7/dist-packages/_pytest/config.py:339: in
_getconftestmodules<br>
mod = self._importconftest(conftestpath)<br>
/usr/lib/python2.7/dist-packages/_pytest/config.py:364: in
_importconftest<br>
raise ConftestImportFailure(conftestpath, sys.exc_info())<br>
E ConftestImportFailure: ImportError('No module named
_check_build\n___________________________________________________________________________\nContents
of
/<dir>/scikit-learn/sklearn/__check_build:\n__pycache__
setup.py
__init__.pyc\n_check_build.pyx
_check_build.cpython-35m-x86_64-linux-gnu.so_check_build.c\n__init__.py\n___________________________________________________________________________\nIt
seems that scikit-learn has not been built correctly.\n\nIf you
have installed scikit-learn from source, please do not
forget\nto build the package before using it: run `python
setup.py install` or\n`make` in the source directory.\n\nIf you
have used an installer, please check that it is suited for
your\nPython version, your operating system and your
platform.',)<br>
E File "/<dir>/scikit-learn/sklearn/__init__.py", line
63, in <module><br>
E from . import __check_build<br>
E File
"/<dir>/scikit-learn/sklearn/__check_build/__init__.py",
line 46, in <module><br>
E raise_build_error(e)<br>
E File
"/<dir>/scikit-learn/sklearn/__check_build/__init__.py",
line 41, in raise_build_error<br>
E %s""" % (e, local_dir, ''.join(dir_content).strip(),
msg))<br>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Interrupted: 1 errors during collection
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br>
============================================================== 1
error in 0.27 seconds
===============================================================<br>
</div>
<div><br>
<br>
</div>
<br>
<br>
Le 23/05/2018 à 18:09, Andreas Mueller a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:7b82776f-45f1-74ff-6e78-beb6a3a52e6b@gmail.com">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<p>+1 for a PR on fit_predict docs. This is probably due to the
inheritance structure.<br>
Though it's weird that DBSCAN has the correct docs.</p>
<p>I'm not sure about renaming affinity, but we can discuss that.
I agree it's misleading.<br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 5/23/18 8:01 AM, Tom DLT wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAGKmC=uHk3ueK2otf1ibCc8UG_MYvwvi8-muiDm4DRB1NUjyng@mail.gmail.com">
<div dir="ltr">Hi <span
style="color:rgb(0,0,0);font-size:12.8px">Anaël,</span>
<div><font color="#000000"><span style="font-size:12.8px"><br>
</span></font>
<div><font color="#000000"><span style="font-size:12.8px">Thanks
for spotting these inconsistencies.</span></font></div>
<div><font color="#000000"><span style="font-size:12.8px">You
are very welcome to open pull-requests and/or issues
on the GitHub tracker (cf. <a
href="http://scikit-learn.org/stable/developers/contributing.html#contributing-code"
moz-do-not-send="true">http://scikit-learn.org/stable/developers/contributing.html#contributing-code</a>)</span></font></div>
<div><font color="#000000"><span style="font-size:12.8px">The
documentation issue should be straightforward.</span></font></div>
</div>
<div><font color="#000000"><span style="font-size:12.8px">The
parameter renaming would need a proper deprecation cycle
(cf <a
href="http://scikit-learn.org/stable/developers/contributing.html#deprecation"
moz-do-not-send="true">http://scikit-learn.org/stable/developers/contributing.html#deprecation</a>).</span></font></div>
<div><font color="#000000"><span style="font-size:12.8px"><br>
</span></font></div>
<div><font color="#000000"><span style="font-size:12.8px">See
you on GitHub,</span></font></div>
<div><font color="#000000"><span style="font-size:12.8px"><br>
</span></font></div>
<div><font color="#000000"><span style="font-size:12.8px">Tom</span></font></div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">2018-05-23 11:50 GMT+02:00 Beaugnon
Anael <span dir="ltr"><<a
href="mailto:anael.beaugnon@ssi.gouv.fr" target="_blank"
moz-do-not-send="true">anael.beaugnon@ssi.gouv.fr</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<p> </p>
<div class="m_-8919457297840734704moz-text-html"
lang="x-unicode">
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>Dear all,<br>
<br>
</div>
Three clustering
algorithms can take as
input distance or
similarity matrices
instead of the
observations (<a
href="http://scikit-learn.org/stable/modules/generated/sklearn.cluster.AgglomerativeClustering.html#sklearn.cluster.AgglomerativeClustering"
target="_blank"
moz-do-not-send="true">AgglomerativeClustering</a>,
<a
href="http://scikit-learn.org/stable/modules/generated/sklearn.cluster.AffinityPropagation.html#sklearn.cluster.AffinityPropagation"
target="_blank"
moz-do-not-send="true">AffinityPropagation</a>,
and <a
href="http://scikit-learn.org/stable/modules/generated/sklearn.cluster.DBSCAN.html#sklearn.cluster.DBSCAN"
target="_blank"
moz-do-not-send="true">DBSCAN</a>),
but there are
inconsistencies in their
documentations.<br>
<br>
<br>
</div>
<b>DBSCAN :</b><br>
The documentation
explains clearly how to run
DBSCAN with a precomputed
distance matrix.<br>
</div>
Constructor:<i> <br>
metric: If metric is
“precomputed”, X is assumed
to be a distance matrix and
must be square.<br>
</i></div>
fit / fit_predict <i>: <br>
X: A feature array, or
array of distances between
samples if <code
class="m_-8919457297840734704gmail-docutils
m_-8919457297840734704gmail-literal"><span
class="m_-8919457297840734704gmail-pre">metric='precomputed'</span></code>.<br>
<br>
<br>
</i></div>
<b>AffinityPropagation :<br>
</b></div>
Constructor:<br>
affinity: <i>Which affinity
to use. At the moment <code
class="m_-8919457297840734704gmail-docutils
m_-8919457297840734704gmail-literal"><span
class="m_-8919457297840734704gmail-pre">precomputed</span></code>
and <code
class="m_-8919457297840734704gmail-docutils
m_-8919457297840734704gmail-literal"><span
class="m_-8919457297840734704gmail-pre">euclidean</span></code>
are supported. <code
class="m_-8919457297840734704gmail-docutils
m_-8919457297840734704gmail-literal"><span
class="m_-8919457297840734704gmail-pre">euclidean</span></code>
uses the negative squared
euclidean distance between points.<br>
</i></div>
fit : <i><br>
X: </i><i>Data matrix or,
if affinity is <code
class="m_-8919457297840734704gmail-docutils
m_-8919457297840734704gmail-literal"><span
class="m_-8919457297840734704gmail-pre">precomputed</span></code>,
matrix of similarities / affinities.<br>
</i></div>
fit_predict :<i><br>
</i></div>
<i> X: Input data. <span
style="color:rgb(204,0,0)"> </span></i><span
style="color:rgb(11,83,148)"><br>
X can also be a matrix of
similarities ? fit and fit_predict
should share the same documentation for
the input X ?</span><i><span
style="color:rgb(204,0,0)"><span
style="color:rgb(11,83,148)"><br>
</span><br>
<br>
</span></i></div>
<b>AgglomerativeClustering :<br>
</b> Constructor:<br>
<i>affinity: Metric used to compute
the linkage. Can be “euclidean”, “l1”,
“l2”, “manhattan”, “cosine”, or
‘precomputed’. If linkage is “ward”, only
“euclidean” is accepted</i>. <br>
<span style="color:rgb(11,83,148)">The
name of the parameter 'affinity' seems
misleading, since it does not correspond
to similarity functions, but to distance
functions.</span><br>
fit : <i><br>
X: </i><i>The samples a.k.a.
observations.</i> <br>
fit_predict :<i><br>
</i><i> X: </i><i>Input data. <br>
</i><span style="color:rgb(11,83,148)">
The documentation of fit and
fit_predict does not specify that X can
also be a matrix of distances.<br>
<br>
</span></div>
<span style="color:rgb(11,83,148)">The user
may be confused whether he/she should
provide a distance or a similarity matrix to
AgglomerativeClustering.<br>
</span></div>
<span style="color:rgb(204,0,0)"><span
style="color:rgb(11,83,148)">The
documentation of fit and fit_predict can be
easily updated. As for the name of the
'affinity' parameter, it is more difficult
since it involves an API change.</span><br>
<br>
</span><span style="color:rgb(0,0,0)"><br>
What do you think of these potential updates
of the documentation ?<br>
<br>
</span></div>
<span style="color:rgb(0,0,0)">Cheers,<br>
<br>
</span></div>
<span style="color:rgb(0,0,0)">Anaël Beaugnon<br>
</span>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div><i> </i></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</blockquote>
</body>
</html>