摘要:
#归一化数值 防止特征值权值过大 方法:newdata = (olddata - min)/(max - min) a = np.array([[1,0.1,7],[1.5,0.1,2],[1.6,0.4,3],[1.2,0.4,4],[1.3,0.5,12]]) # a # [[ 1. 0.1 7. ] # [ 1.5 0.1 ... 阅读全文
posted @ 2019-03-26 22:25
山…隹
阅读(164)
评论(0)
推荐(0)
摘要:
a = np.arange(0,20,1) b = np.array([1,1,2,3,4,3,2,1,2,3,4,5,1,2,3,2,2,1,1,3]) print(len(b)) fig = plt.figure() #创建一个figure图对象 ax1 = fig.add_subplot(221) #创建一个2行2列4个子... 阅读全文
posted @ 2019-03-26 18:48
山…隹
阅读(160)
评论(0)
推荐(0)
摘要:
# # kNN 分类算法 a = np.array([[1,1],[1.2,1.5],[0.3,0.4],[0.2,0.5]]) #构造样本数据 labels = ['A','A','B','B'] # print(a.shape[0]) # 行数 shape(1)表示列数 diffMat = np.tile (np.array([[1.5,1.2... 阅读全文
posted @ 2019-03-26 13:09
山…隹
阅读(148)
评论(0)
推荐(0)
摘要:
mport numpy as np #数据包 import scipy from scipy import stats import matplotlib as mpl import matplotlib.pyplot as plt #画图 # # 1. 数据的形成 x = np.arange(0,51,10).reshape((-1,1)) # b # [[... 阅读全文
posted @ 2019-03-26 13:07
山…隹
阅读(191)
评论(0)
推荐(0)

浙公网安备 33010602011771号