【神经网络和深度学习-开发案例】第四章 神经网络如何对数字进行分类

2023-05-16

【神经网络和深度学习】

第四章 神经网络如何对数字进行分类


案例:使用神经网络识别手写数字

好了,让我们来写一个程序,学习如何识别手写的数字,使用随机梯度下降和MNIST的训练数据。我们将用一个简短的Python(2.7)程序来完成这项工作,只需要74行代码!我们需要的第一件事就是获取MNIST的数据。如果您是一个git用户,那么您可以通过克隆这本书的代码库来获得数据

git clone https://github.com/mnielsen/neural-networks-and-deep-learning.git

顺便说一下,当我更早地描述MNIST的数据时,我说它被分成了6万个训练图像和1万个测试图像。这是官方的MNIST描述。但后来在书中我们会发现它有用的在搞清楚如何设置神经网络的某些超级参数—诸如学习速率,等等。尽管验证数据并不是原始的MNIST规范的一部分,但是许多人以这种方式使用MNIST,并且在神经网络中使用验证数据是很常见的。当我提到“MNIST训练数据”如前所述,MNIST数据集是基于NIST收集的两个数据集,美国国家标准与技术研究院。为了构建NIST的数据集,NIST的数据集被精简了,并被Yann LeCun、科琳娜科尔特斯和克里斯托弗j.c.Burges所采用的更方便的格式。有关更多细节,请参见此链接。我的存储库中的数据集是以一种形式,使得在Python中加载和操纵nist的数据变得很容易。我从蒙特利尔大学的LISA机器学习实验室(链接)获得了这种特殊形式的数据。
除了MNIST的数据之外,我们还需要一个名为Numpy的Python库,用于快速线性代数。如果你还没有安装Numpy,你可以在这里找到它。
在给出完整的清单之前,让我解释一下神经网络代码的核心特性。中心是一个网络类,我们用它来表示一个神经网络。下面是我们用来初始化一个网络对象的代码:

class Network(object):

def __init__(self, sizes):
    self.num_layers = len(sizes)
    self.sizes = sizes
    self.biases = [np.random.randn(y, 1) for y in sizes[1:]]
    self.weights = [np.random.randn(y, x) 
                    for x, y in zip(sizes[:-1], sizes[1:])]

在这段代码中,列表大小包含了各个层中神经元的数量。举个例子,如果我们想要创建一个网络对象在第一层有两个神经元,第二层的3个神经元,最后一层的1个神经元,我们会用代码来做这个。

           $net = Network([2, 3, 1])

网络对象中的偏差和权重都是随机初始化的,使用np.random.randn函数生成高斯分布的平均值0和标准差1。这个随机初始化给出了我们的随机梯度下降算法一个起点。在后面的章节中,我们会找到更好的方法来初始化权重和偏差,但现在就可以了。请注意,网络初始化代码假设第一层神经元是一个输入层,并省略了对这些神经元的任何偏见,因为偏差只用于计算后期的输出。

这里写图片描述
这个方程里有很多东西,让我们把它拆开。 a a 是第二层神经元激活的载体。为了得到a,我们把 a a 乘以权重矩阵w,然后加上偏差的向量 b b 。然后我们将这个函数元素应用到向量wa+b 的每一个条目上。(这被称为矢量化函数。)

考虑到这一点,可以很容易地从网络实例中编写代码来计算输出。我们首先定义sigmoid函数:
根据:

这里写图片描述

def sigmoid(z):
return 1.0/(1.0+np.exp(-z))

再根据:

这里写图片描述

def feedforward(self, a):
    """Return the output of the network if "a" is input."""
    for b, w in zip(self.biases, self.weights):
        a = sigmoid(np.dot(w, a)+b)
    return a

当然,我们希望我们的网络对象所做的主要事情是学习。为了达到这个目的,我们将给他们一个SGD方法来实现随机梯度下降。这里的代码。在一些地方有点神秘,但我将在列表之后把它分解。

 def SGD(self, training_data, epochs, mini_batch_size, eta,
        test_data=None):
    """Train the neural network using mini-batch stochastic
    gradient descent.  The "training_data" is a list of tuples
    "(x, y)" representing the training inputs and the desired
    outputs.  The other non-optional parameters are
    self-explanatory.  If "test_data" is provided then the
    network will be evaluated against the test data after each
    epoch, and partial progress printed out.  This is useful for
    tracking progress, but slows things down substantially."""
    if test_data: n_test = len(test_data)
    n = len(training_data)
    for j in xrange(epochs):
        random.shuffle(training_data)
        mini_batches = [
            training_data[k:k+mini_batch_size]
            for k in xrange(0, n, mini_batch_size)]
        for mini_batch in mini_batches:
            self.update_mini_batch(mini_batch, eta)
        if test_data:
            print "Epoch {0}: {1} / {2}".format(
                j, self.evaluate(test_data), n_test)
        else:
            print "Epoch {0} complete".format(j)

训练数据是一组元组 xy ( x , y ) 表示训练输入和相应的期望输出。你所期望的变量的大小和小批量的大小是你所期望的,在采样时使用的小批量的数量和小批量的大小。 etaS e t a S 是学习速率。如果提供了可选参数 testdata t e s t d a t a ,那么程序将在每次培训后评估网络,并打印出部分进展。这对于跟踪进度很有用,但是会大大降低进度。
代码工作如下。在每个时代,它都是通过随机打乱训练数据开始,然后将其划分成小批量的适当大小。这是一种从训练数据中随机抽取的简单方法。然后对于每一个小批量,我们应用一个梯度下降的步骤。这是由代码 self s e l f 完成的。 updateminibatchminibatcheta u p d a t e m i n i b a t c h ( m i n i b a t c h , e t a ) ,它根据一个单一的梯度下降的迭代来更新网络的权重和偏差,只使用 minibatch m i n i b a t c h 的训练数据。下面是 updateminibatch u p d a t e m i n i b a t c h 方法的代码:

def update_mini_batch(self, mini_batch, eta):
    """Update the network's weights and biases by applying
    gradient descent using backpropagation to a single mini batch.
    The "mini_batch" is a list of tuples "(x, y)", and "eta"
    is the learning rate."""
    nabla_b = [np.zeros(b.shape) for b in self.biases]
    nabla_w = [np.zeros(w.shape) for w in self.weights]
    for x, y in mini_batch:
        delta_nabla_b, delta_nabla_w = self.backprop(x, y)
        nabla_b = [nb+dnb for nb, dnb in zip(nabla_b, delta_nabla_b)]
        nabla_w = [nw+dnw for nw, dnw in zip(nabla_w, delta_nabla_w)]
    self.weights = [w-(eta/len(mini_batch))*nw 
                    for w, nw in zip(self.weights, nabla_w)]
    self.biases = [b-(eta/len(mini_batch))*nb 
                   for b, nb in zip(self.biases, nabla_b)]

大部分的工作都是由直线完成的

    delta_nabla_b, delta_nabla_w = self.backprop(x, y)

这调用了所谓的反向传播算法,这是计算成本函数梯度的一种快速方法。 updateminibatch u p d a t e m i n i b a t c h 的工作原理是简单地计算出 minibatch m i n i b a t c h 中每一个训练示例的梯度,然后更新 self.weights s e l f . w e i g h t s self.biases s e l f . b i a s e s

我不打算展示 self.backprop s e l f . b a c k p r o p 的 代码。我们将在下一章中研究反向传播的工作原理,包括 self.backprop s e l f . b a c k p r o p 的代码。现在,只要假设它的行为就像声明的那样,返回适当的梯度,以获得与培训示例 x x 相关的数据。

让我们看一下完整的程序,包括文档字符串,我在上面省略了,除了self.backprop,支持这个项目—所有的繁重工作都是在 self.SGD s e l f . S G D self.updateminibatch s e l f . u p d a t e m i n i b a t c h 完成的,我们已经讨论过了。

注意,虽然程序看起来很长,但是大部分代码都是文档字符串,目的是使代码易于理解。事实上,这个程序只包含74行非空白、非注释代码。所有的代码都可以在GitHub上找到。

  ""
    network.py


A module to implement the stochastic gradient descent learning
algorithm for a feedforward neural network.  Gradients are calculated
using backpropagation.  Note that I have focused on making the code
simple, easily readable, and easily modifiable.  It is not optimized,
and omits many desirable features.
"""

 #### Libraries
 # Standard library
  import random

 # Third-party libraries
  import numpy as np

 class Network(object):

def __init__(self, sizes):
    """The list "sizes" contains the number of neurons in the
    respective layers of the network.  For example, if the list
    was [2, 3, 1] then it would be a three-layer network, with the
    first layer containing 2 neurons, the second layer 3 neurons,
    and the third layer 1 neuron.  The biases and weights for the
    network are initialized randomly, using a Gaussian
    distribution with mean 0, and variance 1.  Note that the first
    layer is assumed to be an input layer, and by convention we
    won't set any biases for those neurons, since biases are only
    ever used in computing the outputs from later layers."""

    self.num_layers = len(sizes)
    self.sizes = sizes
    self.biases = [np.random.randn(y, 1) for y in sizes[1:]]
    self.weights = [np.random.randn(y, x)
                    for x, y in zip(sizes[:-1], sizes[1:])]

def feedforward(self, a):
    for b, w in zip(self.biases, self.weights):
        a = sigmoid(np.dot(w, a)+b)
    return a

def SGD(self, training_data, epochs, mini_batch_size, eta,
        test_data=None):

    """Train the neural network using mini-batch stochastic
    gradient descent.  The ``training_data`` is a list of tuples
    ``(x, y)`` representing the training inputs and the desired
    outputs.  The other non-optional parameters are
    self-explanatory.  If ``test_data`` is provided then the
    network will be evaluated against the test data after each
    epoch, and partial progress printed out.  This is useful for
    tracking progress, but slows things down substantially."""

    if test_data: n_test = len(test_data)
    n = len(training_data)
    for j in xrange(epochs):
        random.shuffle(training_data)
        mini_batches = [
            training_data[k:k+mini_batch_size]
            for k in xrange(0, n, mini_batch_size)]
        for mini_batch in mini_batches:
            self.update_mini_batch(mini_batch, eta)
        if test_data:
            print "Epoch {0}: {1} / {2}".format(
                j, self.evaluate(test_data), n_test)
        else:
            print "Epoch {0} complete".format(j)

def update_mini_batch(self, mini_batch, eta):

    """Update the network's weights and biases by applying
    gradient descent using backpropagation to a single mini batch.
    The ``mini_batch`` is a list of tuples ``(x, y)``, and ``eta``
    is the learning rate."""

    nabla_b = [np.zeros(b.shape) for b in self.biases]
    nabla_w = [np.zeros(w.shape) for w in self.weights]
    for x, y in mini_batch:
        delta_nabla_b, delta_nabla_w = self.backprop(x, y)
        nabla_b = [nb+dnb for nb, dnb in zip(nabla_b, delta_nabla_b)]
        nabla_w = [nw+dnw for nw, dnw in zip(nabla_w, delta_nabla_w)]
    self.weights = [w-(eta/len(mini_batch))*nw
                    for w, nw in zip(self.weights, nabla_w)]
    self.biases = [b-(eta/len(mini_batch))*nb
                   for b, nb in zip(self.biases, nabla_b)]

def backprop(self, x, y):
    """Return a tuple ``(nabla_b, nabla_w)`` representing the
    gradient for the cost function C_x.  ``nabla_b`` and
    ``nabla_w`` are layer-by-layer lists of numpy arrays, similar
    to ``self.biases`` and ``self.weights``."""

    nabla_b = [np.zeros(b.shape) for b in self.biases]
    nabla_w = [np.zeros(w.shape) for w in self.weights]
    # feedforward
    activation = x
    activations = [x] # list to store all the activations, layer by layer
    zs = [] # list to store all the z vectors, layer by layer
    for b, w in zip(self.biases, self.weights):
        z = np.dot(w, activation)+b
        zs.append(z)
        activation = sigmoid(z)
        activations.append(activation)
    # backward pass
    delta = self.cost_derivative(activations[-1], y) * \
        sigmoid_prime(zs[-1])
    nabla_b[-1] = delta
    nabla_w[-1] = np.dot(delta, activations[-2].transpose())
    # Note that the variable l in the loop below is used a little
    # differently to the notation in Chapter 2 of the book.  Here,
    # l = 1 means the last layer of neurons, l = 2 is the
    # second-last layer, and so on.  It's a renumbering of the
    # scheme in the book, used here to take advantage of the fact
    # that Python can use negative indices in lists.
    for l in xrange(2, self.num_layers):
        z = zs[-l]
        sp = sigmoid_prime(z)
        delta = np.dot(self.weights[-l+1].transpose(), delta) * sp
        nabla_b[-l] = delta
        nabla_w[-l] = np.dot(delta, activations[-l-1].transpose())
    return (nabla_b, nabla_w)

def evaluate(self, test_data):
    """Return the number of test inputs for which the neural
    network outputs the correct result. Note that the neural
    network's output is assumed to be the index of whichever
    neuron in the final layer has the highest activation.""" 

    test_results = [(np.argmax(self.feedforward(x)), y)
                    for (x, y) in test_data]
    return sum(int(x == y) for (x, y) in test_results)

def cost_derivative(self, output_activations, y):
    """Return the vector of partial derivatives \partial C_x /
    \partial a for the output activations."""

    return (output_activations-y)

  #### Miscellaneous functions
   def sigmoid(z):
     """The sigmoid function."""
    return 1.0/(1.0+np.exp(-z))

  def sigmoid_prime(z):
   """Derivative of the sigmoid function."""
    return sigmoid(z)*(1-sigmoid(z))

早些时候,我跳过了有关 MNIST M N I S T 数据的加载细节。这是很简单的。为了完整起见,这里是代码。用来存储MNIST数据的数据结构在文档字符串中被描述——它是简单的东西、元组和 Numpyndarray N u m p y n d a r r a y 对象的列表(如果您不熟悉 ndarray n d a r r a y 的话,可以把它们看作是向量):

    """
         mnist_loader
          ~~~~~~~~~~~~

    A library to load the MNIST image data.  For details of the data
   structures that are returned, see the doc strings for ``load_data``
    and ``load_data_wrapper``.  In practice, ``load_data_wrapper`` is the
    function usually called by our neural network code.
  """

      #### Libraries
    # Standard library
    import cPickle
    import gzip

  # Third-party libraries
    import numpy as np

     def load_data():
 """Return the MNIST data as a tuple containing the training data,
the validation data, and the test data.

The ``training_data`` is returned as a tuple with two entries.
The first entry contains the actual training images.  This is a
numpy ndarray with 50,000 entries.  Each entry is, in turn, a
numpy ndarray with 784 values, representing the 28 * 28 = 784
pixels in a single MNIST image.

The second entry in the ``training_data`` tuple is a numpy ndarray
containing 50,000 entries.  Those entries are just the digit
values (0...9) for the corresponding images contained in the first
entry of the tuple.

The ``validation_data`` and ``test_data`` are similar, except
each contains only 10,000 images.

This is a nice data format, but for use in neural networks it's
helpful to modify the format of the ``training_data`` a little.
That's done in the wrapper function ``load_data_wrapper()``, see
below.
"""
f = gzip.open('../data/mnist.pkl.gz', 'rb')
training_data, validation_data, test_data = cPickle.load(f)
f.close()
return (training_data, validation_data, test_data)

def load_data_wrapper():
"""Return a tuple containing ``(training_data, validation_data,
test_data)``. Based on ``load_data``, but the format is more
convenient for use in our implementation of neural networks.

In particular, ``training_data`` is a list containing 50,000
2-tuples ``(x, y)``.  ``x`` is a 784-dimensional numpy.ndarray
containing the input image.  ``y`` is a 10-dimensional
numpy.ndarray representing the unit vector corresponding to the
correct digit for ``x``.

``validation_data`` and ``test_data`` are lists containing 10,000
2-tuples ``(x, y)``.  In each case, ``x`` is a 784-dimensional
numpy.ndarry containing the input image, and ``y`` is the
corresponding classification, i.e., the digit values (integers)
corresponding to ``x``.

Obviously, this means we're using slightly different formats for
the training data and the validation / test data.  These formats
turn out to be the most convenient for use in our neural network
code."""
tr_d, va_d, te_d = load_data()
training_inputs = [np.reshape(x, (784, 1)) for x in tr_d[0]]
training_results = [vectorized_result(y) for y in tr_d[1]]
training_data = zip(training_inputs, training_results)
validation_inputs = [np.reshape(x, (784, 1)) for x in va_d[0]]
validation_data = zip(validation_inputs, va_d[1])
test_inputs = [np.reshape(x, (784, 1)) for x in te_d[0]]
test_data = zip(test_inputs, te_d[1])
return (training_data, validation_data, test_data)

 def vectorized_result(j):
"""Return a 10-dimensional unit vector with a 1.0 in the jth
position and zeroes elsewhere.  This is used to convert a digit
(0...9) into a corresponding desired output from the neural
network."""
e = np.zeros((10, 1))
e[j] = 1.0
return e
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

【神经网络和深度学习-开发案例】第四章 神经网络如何对数字进行分类 的相关文章

  • k8s中文文档

    http www cnblogs com huangzhenyou p 8066145 html k8s概念比较多 xff0c 有什么概念的疑惑的推荐看k8s中文文档 me的环境 操作系统 xff1a centos7 docker xff1
  • 阿里云 CentOS7 安装图形化界面 。安装图形化界面看这一篇就够了。

    阿里云centos7 下执行eclipse 响应学校老师的要求安装eclipse用于与hadoop的操作 在这之前想过两种方法来解决服务器无图形化界面 xff0c 来操作eclipse 1 在主机上下载eclipse把需要编译的代码编译成j
  • 把ESXi中的虚拟机通过OVA/OVF导出的方式迁移到Proxmox 5

    一 前言 之前发现ESXi是免费的时候 xff0c 非常兴奋地把几台服务器都装上了 xff0c 用着确实还行 xff0c 但是用久了之后就发现 xff0c 很多高端功能需要进一步付费才能使用 xff0c 比如HA等 另外就是它还有很多局限性
  • PX4 ThoneFlow光流使用

    PX4官方光流介绍 xff1a PMW3901 Based Flow Sensors PX4 User Guide 与飞控连接 接线 xff1a G接GND xff1b V接3 3V xff1b T是TX接飞控的RX口 xff1b Y接地开
  • Ubuntu PX4无人机仿真环境配置

    目录 一 VM虚拟机安装ubuntu18 04 1 VMware安装 2 新建虚拟机 二 Ubuntu系统配置 1 更改软件安装源 2 安装中文输入法 三 PX4环境搭建 1 安装git 2 下载px4源码 3 安装ROS 4 安装MAVR
  • larave5安装过程分享-MAX OSX版本

    MAC上的平台是XAMPP xff0c 自带的版本低 我用的是XAMPP MAC版本 一 本地php环境配置 which php php xff0d v xff5c php xampp php PASH 61 34 xff0f applic
  • PX4二次开发 创建进程

    目录 一 创建进程 二 仿真测试 PX4官方手册 xff1a Module Template for Full Applications PX4 User Guide 编写参照PX4源码 src templates xff1a PX4 Au
  • 【Matlab】Matlab基础绘图整理

    Matlab基础绘图整理 一张图绘制多个子图在图片文本中添加希腊字母和特殊字符其他常用函数限制坐标轴范围添加坐标轴说明添加图例修改线条类型 标记修改线条粗细 一张图绘制多个子图 主要命令 xff1a figure 第几张图 subplot
  • PX4 磁罗盘干扰分析

    磁罗盘干扰分析 推力与磁场关系正常情况干扰情况与推力相关解决方法 与推力不相关 罗盘补偿操作流程获取用于分析的日志分析日志调整罗盘补偿参数 推力与磁场关系 无人机上的电机电流会干扰无人机上搭载的磁罗盘 xff0c PX4官方提供了一些方式
  • 【C++】进制

    目录 一 进制转换1 十进制转二进制2 十进制转八进制 xff08 同上 xff09 3 二进制转八进制4 二进制转十六进制5 八进制转二进制6 十六进制转二进制 二 位运算1 原码 反码 补码2 位运算符3 变换操作 一 进制转换 1 十
  • Ubuntu20.04安装ROS2+ROS2-PX4框架搭建

    目录 Ubuntu20 04安装ROS2Set localeSetup SourcesInstall ROS2 packageEnvironment setup测试 ROS2 PX4框架搭建Install PX4Install ROS2Se
  • Jetson Nano利用ROS2通过MicroDDS与PX4通讯

    目录 Jetson Nano安装Ubuntu20 04Ubuntu20 04 配置ROS2环境Pixhawk配置Jetson Nano上MicroDDS Agent配置及和pixhawk通讯 PX4在V1 14及后续版本中 xff0c 将原
  • 用速腾RS16跑LeGO-LOAM

    版权声明 xff1a 本文为博主原创文章 xff0c 遵循 CC 4 0 BY SA 版权协议 xff0c 转载请附上原文出处链接和本声明 本文链接 xff1a https blog csdn net Zed Of Zoe article
  • Visual Studio 2017环境配置MPI v9.0 并行编程环境

    目录 第一步 xff1a 下载安装mpi 官网 xff1a http www mpich org windows版官网 xff1a https msdn microsoft com en us library bb524831 v 61 v
  • 学习java基础的心得感悟

    学完java基础 xff0c 对java面向对象的思想有更加深刻的认识了 xff0c 从学习java语言概述到最后网络编程IDE的使用 xff0c 时间用了1个月零9天 xff0c 上课时间28天 xff0c 回首感觉快又感觉漫长 xff0
  • 如何使用SQL批量替换数据库特定字段中部分特定数据

    1 替换数据库特定字段中部分特定数据的SQL语句 SQL语句 xff1a update 表名 set 字段名 61 replace 字段名 原字符串 需要替换成的字符串 以将表exam major中的字段pos2019中的数据 50 替换成
  • 阿里云ubuntu16.04 server 配置方案 1 配置桌面环境

    首先为服务器配置一个桌面系统 升级一下哦 xff01 span class hljs built in sudo span apt get update span class hljs built in sudo span apt get
  • Xshell远程连接华为云服务器

    Xshell远程连接华为云服务器 一 关于华为云1 什么是云服务器2 为什么使用华为云3 我的华为云体验 二 控制台操作 1 设置密码 2 开放端口 3 切换系统 三 Xshell操作 1 下载Xshell和Xftp2 连接云服务器 一 关
  • 校园网网络连接反复断开又连接是什么原因?

    网络连接反复断开又连接是什么原因 xff1f 原因可能跟ARP攻击或擅自使用P2P终结者等攻击软件有关 因为校园内多个楼宇已部署防ARP攻击网络设备 xff0c 只要判断用户计算机感染ARP或使用P2P终结者 网络执法官 聚生网管等软件攻击
  • xuperchain源码分析-启动过程

    xuperchain的启动分为两个比较大的过程 xff0c 一个是节点的初始化 xff0c 另一个是挖坑的初始化

随机推荐

  • 通过Excel学习PID算法(一步步理解它的KP,KI,KD)

    PID原理 PID控制算是应用非常广泛的经典控制算法 但是怎么理解PID这三个参数呢 xff1f 在参考了别人的文章之后 xff0c 我还是有点一知半解 xff0c 这时候发现不自己动手算一算是很难理解PID了 xff0c 但是我又不想做这
  • 通过Excel学习PID算法(连续系统的PID)

    总结上一节 在之前 xff0c 我们用倒水的例子通俗易懂的解释了什么是PID算法 在这里先回顾一下之前的学习的内容 P表示对误差的比例系数 与目标值差多少 xff0c 就在下一次修正中加上这个误差与P的乘积 xff0c 同时会导致系统有一个
  • 原来学习是如此地苦涩

    原文链接 xff1a http blog csdn net tangl 99 article details 2047657 最近一直在忙第一篇Paper xff0c 虽然想法大致的框架成熟了 xff0c 但是还有一些细节需要完善 这几天在
  • 互联网+时代的7个引爆点(读书笔记)

    百货商场里的销售人员一直抱怨 xff0c 大家只是到自己这里来看看 xff0c 之后转身就在网上下单 从旧视角瞎看这固然是一种文体 xff0c 显示着揭示了一种新的机会 以线下体验为入口的机会 小团队精益式的迭代 xff0c 几个周期后就可
  • maperuce运算框架

    1 xff0c 概念 mapreduce 运算框架主要实现hadoop 的数据处理 xff0c 数据处理中 流经过5个节点 数据流 xff1a input gt spilt gt map gt shuffle gt reduce xff08
  • 在Python中使用print输出时,出现UnicodeEncodeError错误,错误提示为“‘gbk‘ codec can‘t encode character ‘\u2022‘ in posit

    利用chatgpt一步步解决了这个问题 xff0c 感觉ChatGPT还是太强大了 问题描述 xff1a 在Python中使用print输出时 xff0c 出现UnicodeEncodeError错误 xff0c 错误提示为 39 gbk
  • openstack一些特性资料

    Keystone RBAC nova compute Cells Bare Metal Compute 是什么东西 xff1f http wiki openstack org blueprint nova compute cells htt
  • 【神经网络和深度学习-开发案例】 第二章 神经网络结构

    神经网络和深度学习 第二章 神经网络结构 案例 xff1a 使用神经网络识别手写数字 我将介绍一个神经网络 xff0c 它可以很好地对手写的数字进行分类 为了准备这一点 xff0c 它有助于解释一些术语 xff0c 让我们可以命名一个网络的
  • 2000页kubernetes操作手册,内容详细代码清晰,小白也能看懂

    现如今 xff0c Kubernetes业务已成长为新时代的IT基础设施 xff0c 并成为高级运维工程师 架构师 后端开发工程师的必修技术栈 毫无疑问 xff0c Kubernetes是云计算发展演进的一次彻底革命性的突破 xff0c 只
  • FreeRTOS代码阅读笔记:heap_4.c

    FreeRTOS中对于内存的管理当前一共有5种实现方式 xff08 作者当前的版本是10 1 1 xff09 xff0c 均在 Source portable MemMang 下面 xff0c 这里笔记下 heap 4 c和第二种方式比较相
  • (1)touchgfx 添加时钟控件

    第一步 xff1a 新建空白模版 添加图片 xff1a 放入 链接 xff1a https pan baidu com s 1NI6LUYrTUs64Z2jZE6AAQQ 提取码 xff1a 2odw 添加控件 xff1a 位置部件属性1T
  • 【基于51】红外寻迹智能小车 - 代码篇

    文章目录 前言一 准备工作二 使用步骤1 模块化编程2 电机模块3 小车动作模块4 PWM 和定时器 中断系统5 寻迹逻辑 总结 前言 关于硬件部分可以看我上次写的帖子https blog csdn net ZER00000001 arti
  • C++关键字override

    一 什么是override override的翻译是覆盖 实际上它在C 43 43 中可以检测哪些虚函数没有被重写并报错 注 xff1a 在派生类的成员函数中使用override时 xff0c 如果基类中无此函数 xff0c 或基类中的函数
  • 邻接矩阵和邻接表

    图的概述和存储结构 xff08 一 xff09 文章目录 前言一 图的概述1 xff09 图的分类2 xff09 图的要素 二 图的存储结构三 邻接矩阵四 邻接表 前言 有一种说法是程序是由数据结构和算法组成的 xff0c 这很能体现出数据
  • 图解迪杰斯特拉(Dijkstra)最短路径算法

    往期文章目录 干货满满 xff01 最小生成树 Prim算法 最小生成树 Kruskal算法 目录 前言 一 最短路径的概念及应用 二 Dijkstra迪杰斯特拉 1 什么是Dijkstra 2 逻辑实现 总结 前言 无论是什么程序都要和数
  • Vscode配置Git+快速入门,一篇学会80%的Git操作

    前言 团队开发中经常会用到Git xff0c 能极大简化开发的流程 xff0c 而个人开发也可以利用Git管理自己的代码 同样作为一个初学者 xff0c 我在学完Git之后写下这篇文章总结个人走过的坑 xff0c 大家一起进步 Git下载和
  • 【C++11】三大神器之——智能指针

    文章目录 前言 一 智能指针的原理1 RAII机制2 简单的实现 二 智能指针的用法1 智能指针的分类2 unique ptr基本语法 3 shared ptr基本语法 4 删除器5 weak ptr 前言 一 智能指针的原理 1 RAII
  • 【C++11】三大神器之——右值、移动语义、完美转发

    前言 如果你还不知道C 43 43 11引入的右值 移动语义 完美转发是什么 xff0c 可以阅读这篇文章 xff1b 如果你已经对这些知识了如指掌 xff0c 也可以看看有什么可以补充 x1f60f 一 右值 值类别vs变量类型 在正式认
  • 【C++11】三大神器之——包装器和绑定器

    前言 如果你还不知道 C 43 43 11 引入的包装器和绑定器是什么 xff0c 可以读读这篇文章 xff0c 看看有什么 启发 xff1b 如果你已经对包装器和绑定器了如指掌 xff0c 也可以读读这篇文章 xff0c 看看有什么 补充
  • 【神经网络和深度学习-开发案例】第四章 神经网络如何对数字进行分类

    神经网络和深度学习 第四章 神经网络如何对数字进行分类 案例 xff1a 使用神经网络识别手写数字 好了 xff0c 让我们来写一个程序 xff0c 学习如何识别手写的数字 xff0c 使用随机梯度下降和MNIST的训练数据 我们将用一个简