当前位置:网站首页>Make a skylearn high-dimensional dataset_ Circles and make_ moons

Make a skylearn high-dimensional dataset_ Circles and make_ moons

2022-06-25 08:59:00 Guoqingru

sklearn High dimensional dataset production make_circles and make_moons

 Insert picture description here

import pandas as pd
import matplotlib.pyplot as plt
from sklearn.datasets import make_circles
from sklearn.datasets import make_moons
 
# Generate the data  make_circles  and  make_moons, And display  X = 400x2, Y = {
    0, 1}400 , drawing :
# Return value x:[n_samples, 2] Array of shapes , Generated samples 
# y[n_samples] Array of shapes , Label of each sample (0 or 1
def draw_circle_and_moon():
    X_circle,Y_circle=make_circles(n_samples=400,noise=0.1,factor=0.1)
    plt.figure("circle")
    plt.scatter(X_circle[:,0],X_circle[:,1],s=100,marker="o",edgecolors='r',c=Y_circle)
    #c=Y_circle Color that divides the two label data 
    plt.title('data by make_circles()')
 
    X_moon,Y_moon=make_moons(n_samples=400,noise=0.1)
    plt.figure("moon")
    plt.scatter(X_moon[:,0],X_moon[:,1],s=100,marker="o",edgecolors='m',c=Y_moon)
    plt.title('data by make_moons()')
 
    plt.show()
 
draw_circle_and_moon()

 Insert picture description here

原网站

版权声明
本文为[Guoqingru]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206250815354707.html