03 2019 档案
摘要:import numpy as np import math #产生数据的函数 def createdatabase(): dataSet = [[1,1,'yes'],[1,1,'yes'],[1,0,'no'],[0,1,'no'],[0,1,'no']] labels = [['no surfacing'],['flippers']] return dataSet...
阅读全文
摘要:#归一化数值 防止特征值权值过大 方法: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 ...
阅读全文
摘要: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个子...
阅读全文
摘要:# # 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...
阅读全文
摘要: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 # [[...
阅读全文
摘要:需要稍作解释的就是write_merge方法: write_merge(x, x + m, y, w + n, string, sytle)x表示行,y表示列,m表示跨行个数,n表示跨列个数,string表示要写入的单元格内容,style表示单元格样式。其中,x,y,w,h,都是以0开始计算 的。
阅读全文
摘要:1. 下载thrift 作用:翻译python语言为hbase语言的工具 2. 运行时先启动hbase 再启动thrift,最后在pycharm中通过happybase包连接hbase 在hbase目录下分别运行下面命令行: start-hbase.sh hbase thrift -p 9090 s
阅读全文
摘要:进入hbase shell命令行 bin/hbase shell HBase Shell; enter 'help' for list of supported commands. Type "exit" to leave the HBase Shell Version 0.92.1, r12989
阅读全文
摘要:# -*- coding: utf-8 -*-import scrapyfrom scrapy.http import Request,FormRequestclass DbSpider(scrapy.Spider): name = 'db' allowed_domains = ['douban.com'] start_urls = ['https://accounts.d...
阅读全文