Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@levy5674

Description

@levy5674

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions