WHERE FUTURE BEGINS
  • ṢELF ḌEEP ḶEARNING
  • LSE MBA Essentials - The London School of Economics
    • Leading with influence
    • Economics for managers
    • Competitive strategy
    • Corporate strategy
    • Financial accounting
    • Management accounting
    • Analysing financial statements
    • In the mind of the manager
    • Nudging behaviour
    • Organisational culture as a leadership tool
  • Business Foundations Specialization - Wharton Online
    • Introduction to Marketing
      • BRANDING: Marketing Strategy and Brand Positioning
      • Marketing 101: Building Strong Brands Part I
      • Marketing 101: Building Strong Brands Part II
      • Strategic Marketing
      • Segmentation and Targeting
      • Brand Positioning
      • Brand Mantra: The Elevator Speech
      • Experiential Branding
      • CUSTOMER CENTRICITY: The Limits of Product-Centric Thinking
      • Cracks in the Product-Centric Approach
      • Data-Driven Business Models
      • Three Cheers for Direct Marketing
      • Which Firms Are Customer Centric?
      • What is Customer Centricity?
      • Living in a Customer-Centric World
      • More Reflections on Customer CentricityPrev
      • Questions on Customer Centricity
      • GO TO MARKET STRATEGIES: Online-Offline Interaction
      • Online/Offline Competition
      • Friction
      • The Long Tail Theory
      • Preference Isolation
      • How Internet Retailing Startups Grow
      • Customers and Digital Marketing
      • Influence and How Information Spreads
      • Pricing Strategies
      • The 7M
      • BRANDING: Effective Brand Communications Strategies and Repositioning Strategies
      • Brand Messaging & Communication
      • Brand Elements: Choosing a Brand Name
      • Brand Elements: Color & Taglines
      • Brand Elements: Packaging
      • Brand Elements: Persuasion
      • Repositioning a Brand
    • Introduction to Financial Accounting
      • 1.1.1: Financial Reporting Overview
      • 1.1.2: Financial Reporting Example
    • Managing Social and Human Capital
      • Professor Cappelli and Professor Useem Introductions
    • Introduction to Corporate Finance
      • Time Value of Money
      • Intuition and Discounting
      • Compounding
      • Useful Shortcuts
      • Taxes
      • Inflation
      • APR and EAR
      • Term Structure
      • Discounted Cash Flow: Decision Making
      • Discounted Cash Flow Analysis
      • Forecast Drivers
      • Forecasting Free Cash Flow
      • Decision Criteria
      • Sensitivity Analysis
      • Return on Investment
    • Introduction to Operations Management
    • Wharton Business Foundations Capstone
  • Artificial Intelligence Career Program - deeplearning.ai
    • Machine Learning
      • Introduction to Machine Learning
      • Supervised Learning
      • Unsupervised Learning
      • Model Representation - Linear Regression
      • Cost Function
      • Gradient Descent
      • Gradient Descent For Linear Regression
      • Linear Algebra
    • Deep Learning
    • Neutral Networks and Deep Learning
      • Introduction to Deep Learning
      • What is a neural network?
      • Supervised Learning with Neural Networks
      • Why is Deep Learning taking off?
      • About this Course
      • Binary Classification
      • Logistic Regression
      • Gradient Descent
      • Derivatives
      • Computation graph
      • Derivatives with a Computation Graph
      • Logistic Regression Gradient Descent
      • Vectorization
      • Vectorizing Logistic Regression
      • Vectorizing Logistic Regression's Gradient Output
      • Broadcasting in Python
      • A note on python/numpy vectors
      • Explanation of logistic regression cost function (optional)
      • Neural Networks Overview
      • Neural Network Representation
      • Computing a Neural Network's Output
      • Vectorizing across multiple examples
      • Activation functions
      • Derivatives of activation functions
      • Gradient descent for Neural Networks
      • Backpropagation intuition (optional)
      • Random Initialization
      • Deep L-layer neural network
      • Forward Propagation in a Deep Network
      • Getting your matrix dimensions right
      • Why deep representations?
      • Building blocks of deep neural networks
      • Forward and Backward Propagation
      • Parameters vs Hyperparameters
      • What does this have to do with the brain?
    • Convolutional Neural Networks
      • Computer Vision
      • Edge Detection Example
      • Padding
      • Strided Convolutions
      • Convolutions Over Volume
      • One Layer of a Convolutional Network
      • Simple Convolutional Network Example
      • Pooling Layers
      • CNN Example - Fully Connected Layers
      • Why Convolutions?
    • Neural Network Theory [ETH]
    • Natural Language Processing
    • Computer Vision
  • IBM Data Science Professional Certificate
    • What is Data Science?
    • Open Source tools for Data Science
    • Data Science Methodology
    • Python for Data Science and AI
    • Databases and SQL for Data Science
    • Data Analysis with Python
    • Data Visualization with Python
    • Machine Learning with Python
    • Applied Data Science Capstone
  • Data Analytics
    • Python for Data Analysis
    • Data Structure and Algorithms
  • Programming Language
    • Python
    • R
    • SQL
    • C++
    • C
    • Java
    • HTML
  • 机器学习工程师
  • 商业数据分析
Powered by GitBook
On this page

Was this helpful?

  1. Artificial Intelligence Career Program - deeplearning.ai
  2. Neutral Networks and Deep Learning

Binary Classification

PreviousAbout this CourseNextLogistic Regression

Last updated 5 years ago

Was this helpful?

欢迎回来 本周我们将会重温神经网络编程的基础知识 我们发现当你实现一个神经网络的时候 一些技巧是非常重要的 比如如果你有一个含有m个训练样本的训练集 你可能习惯于用一个for循环 来处理这m个训练样本 但当你实现一个神经网络的时候 你一般想训练整个训练集 但不显式使用for循环来遍历整个训练集 那么,你将在本周的资料中看到如何实现这一点 另外,当你在你的网络中组织计算的时候 经常使用所谓的前向传播 以及所谓的反向传播 所以在本周的资料中 你还将了解到为什么在训练神经网络时 计算可以被正向转播组织为一次前向传播过程 以及一次反向传播过程

在本周的材料中 我想使用逻辑回归算法作为例子 以使其更容易理解 即使你之前已经了解过逻辑回归算法 我想在这周的材料中 你仍然会收获一些新的有趣的想法 所以让我们开始吧 逻辑回归是一个二元分类算法 所以让我们从这样一个问题开始 这里有一个二元分类问题的例子 你也许有一张输入图片 像这样 你希望算法输出一个0或1标签 指明图上是不是猫 输出1说明是猫,输出0说明不是猫 在这里,我们用符号y来表示输出标签 让我们先来看一看图像在计算机里是怎么表示的 为了在计算机里保存一幅(彩色)图像 计算机要存储3个独立的矩阵 分别对应着图像的红、绿、蓝3个颜色通道

所以,如果你的图像大小是64x64 那么你会有3个64x64大小的实数矩阵 分别代表图像的红、绿、蓝3个颜色通道 尽管我在幻灯片上画的矩阵比实际小的多 大小只是5x4,而不是64x64 所以,为了用向量表示这些像素矩阵 我们将把这些矩阵中的像素值展开为一个向量x 作为算法的输入 为了将这些像素值展开成一个向量 我们所做的就是按下面方法 定义一个与该图像相对应的向量 我们直接将255、231.....等这些像素值取出 放入向量x中 直到红色通道的像素值全部取出放入到向量x中 接着是255、134、255...等代表绿色通道的像素值 最后是红色蓝色通道的像素值 最终,我们会得到一个非常长的向量 向量中列出了图像中红、绿、蓝三个通道的像素值 如果图像的大小是64x64 那么该向量的维度将会是64x64x3 因为这就是图像的矩阵包含的元素总数 在这个例子中,向量的总长度为12288 也就是64x64x3的乘积 并且,我们将用n(x) = 12288 来表示输入特征向量x的维度 并且,有时候为了简化,我也会直接用小写n 来表示输入特征向量的维度

所以,在二元分类问题中 我们的目标是学习到这样的一个分类器: 我们输入一幅以特征向量x表示的图像 然后预测对应的输出y是1还是0 即,这幅图上是猫还是不是猫 先让我们来罗列出一些符号 这些符号将会在余下课程中陆续用到 单个样本由一对(x,y)表示 其中,x是一个n(x)维的特征向量 y是标签,取值为0或1 训练集包含m个训练样本 所以训练集将被写成(x(1),y(1)) 表示第一个样本的输入和输出 (x(2),y(2))代表第二个样本的输入和输出 直到(x(m),y(m)),表示最后一个样本输入和输出 因此,我将使用小写m代表训练集的样本总数 并且,有时为了强调是表示训练集的样本总数 我会写成M=M(train) 当是测试集时 我有时会用m(test)来表示测试集的样本总数 因此,m(test)等于测试集的样本总数 最后,为了将所有的训练样本写成更加紧凑的形式 我们将定义一个矩阵,用大写X表示 X定义如下:将训练集中的输入x(1)、x(2)....x(m)取出 按列排列到矩阵X中 因此,我们将x(1)放在矩阵的第一列中 x(2)放在矩阵的第二列中,直到x(m) 这样,便得到了矩阵X 因此,矩阵M将有m列,m即训练样本的总数 同时矩阵X有n(x)行 请注意,在一些其他课程中,你可能会看到 矩阵X的定义是将训练样本的输入按行排列的 像这样 x1的转置到x(m)的转置 事实证明,在神经网络中 使用左边的表示方法,运用时会相对简单 概括一下,X是一个n(x)乘m维的矩阵 在Python中 你会看到X.shape命令 这是Python里 得到矩阵形状的命令的输出是n(x),m 这表示X是一个n(x)乘m维的矩阵 以上就是你如何组织训练样本的输入x到矩阵X 那么如何组织输出标签Y呢 事实证明要使你应用神经网络时更简单 你同样应该讲y按列排列 因此,Y等于[ y(1) y(2) ... y(m) ] 直到y(m) Y是一个1xm大小的矩阵 同样的,使用Python命令Y.shape,将会输出(1,m) 表示Y是一个1xm大小的矩阵 在本课程之后,当你实现你自己的神经网络时 你会发现一个非常有用的惯例:混合不同的训练样本数据 在这里数据是指单个x或y,或者之后其他的数目数据 混合不同训练样本的数据 并将它们按列排列 像我们之前对x和y做的那样

以上就是我们之后会在回归算法 和神经网络算中使用到的一些符号 如果你忘记了某个符号的意义 比如M代表什么 N代表什么 或者其他什么的 我们已经在课程网站贴出了符号指南 你可以用它快速的查找特定符号的意义 就这样,让我们开始进入下一节课 着手实现逻辑回归算法 GTC字幕组翻译