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

建设网站包括哪些什么网站的新闻做参考文献

建设网站包括哪些,什么网站的新闻做参考文献,如何建设网站视频,购物网站服务器带宽本次练习的任务是使用逻辑归回和神经网络进行识别手写数字#xff08;form 0 to 9, 自动手写数字问题已经应用非常广泛#xff0c;比如邮编识别。 使用逻辑回归进行多分类分类 练习2 中的logistic 回归实现了二分类分类问题#xff0c;现在将进行多分类#xff0c;one vs…本次练习的任务是使用逻辑归回和神经网络进行识别手写数字form 0 to 9, 自动手写数字问题已经应用非常广泛比如邮编识别。 使用逻辑回归进行多分类分类 练习2 中的logistic 回归实现了二分类分类问题现在将进行多分类one vs all。 加载数据集 这次数据时MATLAB 的格式使用Scipy.io.loadmat 进行加载。Scipy是一个用于数学、科学、工程领域的常用软件包可以处理插值、积分、优化、图像处理、常微分方程数值解的求解、信号处理等问题。它可用于计算Numpy矩阵使Numpy和Scipy协同工作。 import numpy as np import scipy.io from scipy.io import loadmat import matplotlib.pyplot as plt import scipy.optimize as optdata scipy.io.loadmat(ex3data1.mat) X data[X] y data[y]数据集共有5000个样本 每个样本是20*20的灰度图像。 visuazing the data 随机展示100个图像 def display_data(sample_images):fig, ax_array plt.subplots(nrows10, ncols10, figsize(6, 4))for row in range(10):for column in range(10):ax_array[row, column].matshow(sample_images[10 * row column].reshape((20, 20)).T, cmapgray)ax_array[row, column].axis(off)plt.show()returnrand_samples np.random.permutation(X.shape[0]) # 打乱顺序 sample_images X[rand_samples[0:100], :] display_data(sample_images)Vectorizing Logistic Regression 看一下logistic回归的代价函数 其中 进行向量化运算 def sigmoid(z):return 1 / (1 np.exp(-z))def regularized_cost(theta, X, y, l):thetaReg theta[1:]first (-y*np.log(sigmoid(X.dot(theta)))) (y-1)*np.log(1-sigmoid(X.dot(theta)))reg (thetaReg.dot(thetaReg))*l / (2*len(X))return np.mean(first) reggradient def regularized_gradient(theta, X, y, l):thetaReg theta[1:]first (1 / len(X)) * X.T (sigmoid(X.dot(theta)) - y)reg np.concatenate([np.array([0]), (l / len(X)) * thetaReg])return first regone-vs-all Classification 这个任务有10个类logistics是二分类算法用在多分类上原理就是把所有的数据分为“某类”和“其它类” from scipy.optimize import minimizedef one_vs_all(X, y, l, K):all_theta np.zeros((K, X.shape[1])) # (10, 401)for i in range(1, K1):theta np.zeros(X.shape[1])y_i np.array([1 if label i else 0 for label in y])ret minimize(funregularized_cost, x0theta, args(X, y_i, l), methodTNC,jacregularized_gradient, options{disp: True})all_theta[i-1,:] ret.x return all_theta向量化操作检错经验的机器学习工程师通常会检验矩阵的维度来确认操作是否正确。 predict def predict_one_vs_all(all_theta, X):m np.size(X, 0)# You need to return the following variables correctly# Add ones to the X data matrixX np.c_[np.ones((m, 1)), X]hypothesis sigmoid(X.dot(all_theta.T)pred np.argmax(hypothesis), 1) 1return pred这里的hypothesis.shape [5000 * 10], 对应5000个样本每个样本对应10个标签的概率。取 概率最大的的值作为最终预测结果。pred 是最终的5000个样本预测数组。 pred predict_one_vs_all(all_theta, X) print(Training Set Accuracy: %.2f%% % (np.mean(pred y) * 100))Neural Networks 这里只需要验证所给权重数据也就是theta,查看分类准确性。 ## Part 2: Loading Pameters print(Loading Saved Neural Network Parameters ...)# Load the weights into variables Theta1 and Theta2 weight scipy.io.loadmat(ex3weights.mat) Theta1, Theta2 weight[Theta1], weight[Theta2]predict def load_weight(path):data loadmat(path)return data[Theta1], data[Theta2]theta1, theta2 load_weight(ex3weights.mat) theta1.shape, theta2.shapeX np.insert(X, 0, valuesnp.ones(X.shape[0]), axis1) # intercept # #正向传播 a1 X z2 a1.dot(theta1.T) z2.shape z2 np.insert(z2, 0, 1, axis1) a2 sigmoid(z2) a2.shape z3 a2.dot(theta2.T) z3.shape a3 sigmoid(z3) a3.shapey_pred np.argmax(a3, axis1) 1 accuracy np.mean(y_pred y) print (accuracy {0}%.format(accuracy * 100)) # accuracy 97.52%
http://www.yutouwan.com/news/4159/

相关文章:

  • 大学生校园活动策划书湖北企业网站优化排名
  • 厦门营销型网站建设站长之家ping
  • 论文收录网站广州注册公司迁到佛山可以吗
  • 微信公众号服务号网站开发流程图wordpress文字环绕图片
  • 可以自己做网站的软件国际互联网出口
  • 面向服务的关系建设网站垂直网站建设的关键因素
  • 鄂尔多斯网站制作 建设京东上怎样做网站
  • 网站内部链接是怎么做的帝国网站免费模板
  • 网站后台支持的字体免费pc 微网站模板
  • android应用开发详解杭州seo全网营销
  • h5自适应网站模板下载源码分享网
  • 电商网站页面布局网站流量统计怎么做的
  • 公司网站宣传自己做的灯展怎么给网站做百度优化
  • 做电影网站怎样赚钱吗该网站使用的安全设置
  • 大型网站开发用的技术网站订单模板
  • 企业网站开发哪家专业人员优化方案怎么写
  • 网站分站系上海注册公司需要多少钱
  • 物流信息网站有哪些网游大全
  • 做公司网站的多少钱免费的com域名注册
  • 个人怎么做网站页面ps做图软件怎么下载网站
  • 国外网站视觉设计趋势做网站的例子
  • 安徽城乡建设厅官方网站杭州自助建站模板
  • 网页设计中优秀的网站企业网站主要有哪四种类型
  • 很多搜索词网站怎样做烟台开发区网站
  • 重庆网站优化公司怎么样顶格处罚鼠头鸭脖涉事企业
  • 做婚恋网站多少钱电子商城网站建设的实训内容记述
  • 太原电商网站设计百度自媒体怎么注册
  • 网站内部链接的策略wordpress 图片弹出
  • 网站建设系统有哪些十堰网站建设专家
  • 网站设计应该考虑的重要因素自己做网站seo