Doctest failure for PowerTransformer on mac?
See original GitHub issueSubsequent to #12522 it seems I get the following test failure when running on my own machine. @NicolasHug is this level of imprecision surprising?
____________________________________ [doctest] sklearn.preprocessing.data.PowerTransformer ____________________________________
2521
2522 Examples
2523 --------
2524 >>> import numpy as np
2525 >>> from sklearn.preprocessing import PowerTransformer
2526 >>> pt = PowerTransformer()
2527 >>> data = [[1, 2], [3, 2], [4, 5]]
2528 >>> print(pt.fit(data))
2529 PowerTransformer(copy=True, method='yeo-johnson', standardize=True)
2530 >>> print(pt.lambdas_)
Expected:
[ 1.38668178 -3.10053309]
Got:
[ 1.38668178 -3.10053332]
show_versions
System:
python: 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:52:12) [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)]
machine: Darwin-17.7.0-x86_64-i386-64bit
executable: /Users/joel/anaconda3/envs/scipy3k/bin/python
BLAS:
cblas_libs: mkl_rt, pthread
lib_dirs: /Users/joel/anaconda3/envs/scipy3k/lib
macros: SCIPY_MKL_H=None, HAVE_CBLAS=None
Python deps:
pandas: 0.23.4
pip: 18.0
sklearn: 0.20.1 # at 19c3008
setuptools: 37.0.0
Cython: 0.28.5
scipy: 1.0.0
numpy: 1.14.1
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Python doctest says failed but returns correct value
Indeed as @user2357112 pointed out you have space in the expected output for your second test case. I tested with this code and...
Read more >doctest — Test interactive Python examples — Python 3.11.1 ...
Source code: Lib/doctest.py The doctest module searches for pieces of text that ... Running doctest.testfile("example.txt") then finds the error in this ...
Read more >scikit-learn user guide
Error caused by file path length limit on Windows ... 1.2.16 Why do I sometime get a crash/freeze with n_jobs > 1 under...
Read more >Python's doctest: Document and Test Your Code at Once
Displaying no output means that doctest ran all your test cases and didn't find any failing tests. If you want doctest to be...
Read more >Automated testing with doctest
Thanks to packages like doctest for Python, Mocha and Jasmine for Javascript etc., ... def runDoctests(): import sys import doctest failed, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I pushed a fix in #12595.
I believe we cannot easily run the doctests on windows because of difference in the way the numpy array dtypes are displayed on windows and reworking the doctests to make them platform agnostic would be too tedious and hurt readability of the documentation.
I think we should consider that the goal of the doctests is only to test that the examples in the documentation are up to date with the code.
Checking that the code runs correctly on all platform should be the responsibility of the regular test suite.