当前位置: 首页 > news >正文

公司做网站该注意哪些广州新塘网站建设推广公司

公司做网站该注意哪些,广州新塘网站建设推广公司,免费搜索引擎入口,电商培训班训练集 测试集如果拿所有原始数据来训练#xff0c;存在的问题#xff1a;模型很差无法调整#xff1b;真实环境难以拿到真实 label#xff1b;所以将数据区分为 训练数据 和 测试数据(train test split)#xff1b;将训练数据来训练模型#xff1b;然后用测试数据…训练集 测试集如果拿所有原始数据来训练存在的问题模型很差无法调整真实环境难以拿到真实 label所以将数据区分为 训练数据 和 测试数据(train test split)将训练数据来训练模型然后用测试数据测试模型使用这种方式也存在问题python 原生分离 iris 数据集import numpy as npfrom sklearn import datasetsimport matplotlib.pyplot as pltiris datasets.load_iris()X iris.datay iris.targetX(array([[5.1, 3.5, 1.4, 0.2],[4.9, 3. , 1.4, 0.2], ...[6.2, 3.4, 5.4, 2.3],[5.9, 3. , 5.1, 1.8]])yarray([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2])X.shape, y.shape #((150, 4), (150,))# shuffleshuffle_indexes np.random.permutation(len(X)) # 0--len(X) 的随机排列shuffle_indexes# array([ 22, 4, 142, 24, 7, 146, ... 9, 95, 130, 29, 124])test_ratio 0.2test_size int(len(X) * test_ratio)test_size # 30test_indexes shuffle_indexes[:test_size]train_indexes shuffle_indexes[test_size:]test_indexesarray([ 22, 4, 142, 24, 7, 146, 70, 77, 144, 14, 40, 119, 46, 85, 74, 87, 86, 60, 91, 120, 78, 45, 65, 105, 113, 39, 83, 80, 134, 16])X_train X[train_indexes]y_train y[train_indexes]X_test X[test_indexes]y_test y[test_indexes]X_test.shape, X_train.shape # ((30, 4), (120, 4))封装 train_test_split 函数def train_test_split(X, y, test_ratio0.2, seedNone):assert x.shape[0] y.shape[0], the size of X must be equal to the size of yassert 0.0 test_ratio 1.0, test_ ration must be validif seed:np.random.seed(seed)shuffle_indexes np.random.permutation(len(X))test_size int(len(X) * test_ratio)test_indexes shuffle_indexes[:test_size]train_indexes shuffle_indexes[test_size:]X_train X[train_indexes]y_train y[train_indexes]X_test X[test_indexes]y_test y[test_indexes]return X_train, y_train, X_test, y_testsklearn 中的 train_test_splitfrom sklearn.model_selection import train_test_splitX_train, X_test, y_train, y_test train_test_split(X, y)train_test_split(*arrays, **options)X_train, X_test, y_train, y_test train_test_split( X, y, test_size0.33, random_state42)
http://www.pierceye.com/news/925238/

相关文章:

  • 网站建设公司 经营资质wordpress文学
  • 手机网站建设请示常州建设网站公司哪家好
  • 网站开发报价ppt重庆沙坪坝有哪些大学
  • 牛商网做的包装盒网站怎么在门户网站上发布
  • 北京网络公司建站成品app直播源码下载
  • 帮忙建站的公司百度收录好的网站排名
  • 芯火信息做网站怎么样郑州网站建设老牌公司
  • 龙华营销型网站建设在线生成短链接网址
  • 深圳做公司网站关键词规划师工具
  • 长春市建设信息网站sem代运营推广公司
  • 宜昌网站建设平台有经验的盐城网站开发
  • wordpress 众筹网站模板wordpress首页只显示一篇文章
  • 嘉兴seo网站推广网页设计与制作课程结构
  • 江苏 网站 备案百度站长之家工具
  • 新加坡 网站建设专业简历制作网站有哪些
  • 河北外贸网站建设大连建设网球场价格
  • 北京企业网站制作哪家好新余商城网站建设
  • 网站建设对客户的优势单位建设网站的目的
  • seo网站建站公司的主页珠江夜游微信公众号
  • 建筑人才网 中高端招聘网站专业网站开发开发
  • 江门官网建站公司wordpress get_tax_meta
  • 云南省建设系统网站wordpress wdlog主题
  • 做医疗网站颜色选择网站改版301怎么做
  • 淘宝网站建设步骤做网络网站需要三证么
  • 免费网站域名注册申请视频网站开发策划书
  • 如何在社交网站做销售无锡做网站企业
  • 网站建设首选唯美谷wordpress小程序编辑
  • openwrt 网站开发北京建机职业技能鉴定中心官网
  • 莱芜新站优化wordpress打卡签到领红包
  • wordpress 网站上传到服务器免费在线自助建站