直接上代码
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)
# MaxAbs标准化
# # 建立MinMaxScaler对象
minmax= preprocessing.MaxAbsScaler()
# 标准化处理
data_minmax = minmax.fit_transform(x)
m, n = shape(data_minmax)
w = ones((1,1))
data_minmax = np.insert(data_minmax, 0, values=w, axis=1)
# print(data_maxabs)
x_train, x_test, y_train, y_test = train_test_split(