直接上代码
from sklearn.datasets import make_moons
from numpy import *
import numpy as np
import operator
from os import listdir
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn import preprocessing
#创建数据集
x, y = make_moons(n_samples=200, noise=0.15, random_state=0)
# Max-Min标准化
# 建立MinMaxScaler对象
minmax = preprocessing.MinMaxScaler()
# 标准化处理
data_minmax = minmax.fit_transform(x)
#

本文介绍了如何运用Python的sklearn库中的KNN(K近邻)分类器对make_moons数据集进行建模和预测。通过实例代码展示了数据预处理、模型训练和评估的全过程。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



