from sklearn import datasets import matplotlib.pyplot as plt # 制作块数据 x, y = datasets.make_blobs(centers=2, random_state=1) # 制作双圆环数据 x, y = datasets.make_circles(noise=0.05) # 制作多分类数据集 | 简化版本为make_blobs x, y = datasets.make_classification(n_informative=2, n_redundant=0, n_repeated=0, random_state=5) # 制作交互的半圆 x, y = datasets.make_moons(noise=0.05) # 制作多目标分类 x, y = datasets.make_multilabel_classification(n_features=2, n_classes=4, n_labels=2) # _, axes = plt.subplots(2) # for idx, ax in enumerate(axes): # ax.axis("off") # ax.scatter(x[:, 0], x[:, 1], c=y[:, idx], s=50) # plt.scatter(x[:, 0], x[:, 1], c=y, s=50) # plt.show() # 制作线性回归 x, y = datasets.make_regression(n_features=1, n_targets=1, noise=6) # plt.scatter(x, y) # plt.show()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)