New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

datasets.make_moons returns incorrect label when n_samples is odd #8198

Closed
levy5674 opened this Issue Jan 13, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@levy5674
Contributor

levy5674 commented Jan 13, 2017

Description

There is an indexing error in make_moons so that when n_samples is odd, x[n_samples // 2] is on the inner circle but y[n_samples // 2] == 0 labeling it as part of the outer circle.

Steps/Code to Reproduce

from sklearn.datasets import make_moons
from numpy import column_stack
column_stack(make_moons(3, shuffle=False))

Expected Results

array([[ 1. ,  0. ,  0. ],
       [ 0. ,  0.5,  1. ],
       [ 2. ,  0.5,  1. ]])

Actual Results

array([[ 1. ,  0. ,  0. ],
       [ 0. ,  0.5,  0. ],
       [ 2. ,  0.5,  1. ]])

Versions

Darwin-15.6.0-x86_64-i386-64bit
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)]
NumPy 1.11.2
SciPy 0.18.1
Scikit-Learn 0.18

levy5674 added a commit to levy5674/scikit-learn that referenced this issue Jan 13, 2017

levy5674 added a commit to levy5674/scikit-learn that referenced this issue Jan 14, 2017

levy5674 added a commit to levy5674/scikit-learn that referenced this issue Jan 16, 2017

@jnothman jnothman closed this in #8199 Jan 17, 2017

jnothman added a commit that referenced this issue Jan 17, 2017

raghavrv added a commit to raghavrv/scikit-learn that referenced this issue Jan 18, 2017

sergeyf added a commit to sergeyf/scikit-learn that referenced this issue Feb 28, 2017

Sundrique added a commit to Sundrique/scikit-learn that referenced this issue Jun 14, 2017

NelleV added a commit to NelleV/scikit-learn that referenced this issue Aug 11, 2017

paulha added a commit to paulha/scikit-learn that referenced this issue Aug 19, 2017

maskani-moh added a commit to maskani-moh/scikit-learn that referenced this issue Nov 15, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment