[note] deep learning tensorflow lecture 1 notes 深度学习笔记 (1)

2023-11-06

1. logistic classifier




model: W*X + b = Y

where W is the Weights Vector, X is input vector, b is bias and Y is output.

Y, the output vector is a numeric vector.


As show in picture above, y should be transformed into another numeric vector where value presents the probability of corresponding  class.

2. Softmax Function

softmax function can transform y into probability vector.

it can be implemented in python as follows:

"""Softmax."""

scores = [3.0, 1.0, 0.2]

import numpy as np

def softmax(x):
    """Compute softmax values for each sets of scores in x."""
    # each column is a set of data
    # TODO: Compute and return softmax(x)
    s = np.exp(x)
    r = np.sum(s,axis=0)
    return s/r
    
print(softmax(scores))

# Plot softmax curves
import matplotlib.pyplot as plt
x = np.arange(-2.0, 6.0, 0.1)
scores = np.vstack([x, np.ones_like(x), 0.2 * np.ones_like(x)])

plt.plot(x, softmax(scores).T, linewidth=2)
plt.show()

when we multiple y by a positive number greater than 1,  the result vector will give a rise to more bias distribution.

and by a positive number smaller than 1 will lead to a more uniform distribution result.


3. one hot encoding


every column represents a y output vector.

so there should be only one '1' in each column.



4. cross entropy

A function is needed to describe the differences between probability vector and  classification label vector.

In classification result vector, there is only one '1' which means the corresponding class. And other positions will be filled with '0'.



so, a partial logistic classification process can be described as follows:




however, how to find a proper weight vector and bias vector to get a good enough accuracy?

An optimization method is employed to minimize the differences between computational results and labels(minimize average cross entropy).




Gradient descent method can achieve our expectation.


alpha represents learning rate.


5. training set, validation set and test set

validation set is a small subset of training set for tuning parameters and getting a better performance.

so tuning parameters means that validation set has had an influence on training set. Maybe sometimes you will get an over-fitting model. (you think that your model is perfect but get a shit when testing another set)

However, our test set is still pure.

Sometimes noise gets you an increasing accuracy by 0.1%. Be careful, Do not be blind by noise. 


6.Stochastic Gradient Descent


when we train a big data-set with gradient descent method, it is a long time to get model parameters.

However Stochastic Gradient Descent saved us.

It uses a random subset of training set to find a good descent direction.

and then use another random subset of training set to find next good direction.

That is the core of deep learning.


(1) Tips: initialization

normalize input with 0 average value and small variance

initialize weight randomly with 0 average value and small variance


(2) Tips: momentum

change derivative into M(w1,w2) 



(3) Tips: learning rate decays

there are many ways of decreasing learning rate by steps.

common using exponential decay.

 



(4) Tips: S.G.D black magic


there is a new method call ADAGRAD, which is a derivative from S.G.D and implements initial learning rate, learning rate decay, and momentum. Using this method, only batch size and weight initialization are what  you need concern about.


Keep Calm and lower your Learning Rate!





本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

[note] deep learning tensorflow lecture 1 notes 深度学习笔记 (1) 的相关文章

随机推荐

  • Hash算法特点

    2 2 Hash算法有什么特点 一个优秀的 hash 算法 将能实现 正向快速 给定明文和 hash 算法 在有限时间和有限资源内能计算出 hash 值 逆向困难 给定 若干 hash 值 在有限时间内很难 基本不可能 逆推出明文 输入敏感
  • 第十届蓝桥杯省赛C++B组 等差数列

    数学老师给小明出了一道等差数列求和的题目 但是粗心的小明忘记了一部分的数列 只记得其中 N 个整数 现在给出这 N 个整数 小明想知道包含这 N 个整数的最短的等差数列有几项 输入格式 输入的第一行包含一个整数 N 第二行包含 N 个整数
  • 理解TCP/IP、HTTP、FTP、 NTP、 SNMP、VRRP等常用协议(FTP)

    FTP 概述 文件传输协议 FTP 作为网络共享文件的传输协议 在网络应用软件中具有广泛的应用 FTP的目标是提高文件的共享性和可靠高效地传送数据 在传输文件时 FTP 客户端程序先与服务器建立连接 然后向服务器发送命令 服务器收到命令后给
  • redis常用命令

    一 key 相关 1 redis允许模糊查询 key keys 有3个通配符 2 randomkey 返回随机key 3 type key 返回key存储的类型 4 exists key 判断某个key是否存在 5 del key 删除ke
  • 【颜值检测神器】来,请拿出你们的绝活(这颜值,对得起观众么?)

    前言 作者 程序员梨子 文章简介 本篇文章主要调用百度接口制作一款颜值检测小工具啦 文章源码获取 为了感谢每一个关注我的小可爱 每篇文章的项目源码都是无偿分 享滴 点这里蓝色这行字体自取 需要什么源码记得说标题名字哈 私信我也可 欢迎小伙伴
  • 9.全志H3-修改DDR的速度

    上面是我的微信和QQ群 欢迎新朋友的加入 前一篇文章 为了测试我自己画的板子 查了下关于uboot源码 降低DDR的速度 我使用的是友善之臂提供的源码 不多说其他的了 在源码里面 查找下图的文件 打开文件 修改图示内容就行 下面是启动的打印
  • 【java】兴唐第二十三节课作业

    已知如下 下表为某班级四次考试成绩单 要求使用HashMap
  • 万网域名如何设置显性url转发和隐性URL转发

    原文链接 http www enkj com idcnews Article 20161025 9580 URL转发技术就是将该域名的网站访问请求 通过浏览器端技术 转向到另外一个网站 如果跳转后 浏览器地址栏还是该域名 称为隐性URL转发
  • 眼底图像血管分割数据集_一个图像分割任务的Hello World项目(UNet+眼底血管分割)...

    庖丁解牛式的学习 才是真正的事半功倍 这是CVHub公众号的第七篇原创文章 也是 学术小白也能看懂的学术进阶专栏 计算机视觉方向 的第七篇文章 导读 在基于深度学习的医学影像分割任务中 基本在哪都能看到 U Net 的影子 这是一篇发表于
  • Protocbuf使用和安装

    Protocol buffers和mxl一样在序列化数据结构时很灵活 高效和智能 但是它的优势在于定义文件更小 读取速度更快 使用更加简单 目前protocol buffers支持C java和python三种语言并且独立于平台 linux
  • 了解硬盘的电路组成部分

    一 硬盘电路组成 硬盘电路板是将硬盘内部和电脑主板相互连接的中介 它将接口传送过来的电信号转换成磁信息记录到硬盘盘片上 写操作 反过来也可以将硬盘盘片上的磁信息转换成电信号传送到接口 读操作 硬盘电路板是裸露在外面的 因此也是比较容易出现故
  • Idea安装免注册版ChatGPT

    文章目录 一 前期准备 二 开始使用 一 前期准备 1 准备Idea开发软件并打开 VS Code同理 2 Ctrl Alt S 快捷键调出Settings窗口 如图 3 找到NexChatGPT 此插件不需要注册 可以直接使用 高级一些的
  • java中Synchronized和Lock的区别

    Synchronized和Lock的区别 原始构成 synchronized关键字属于JVM层面的 通过monitorenter monitorexit指令实现 底层是通过monitor对象来完成 其实wait notify等方法也依赖mo
  • Linux下安装QT4.3.2

    安装qt是因为我刚安装过mplayer想装个前端上网 一查 很多都推崇用smplayer 我也就下决心装上 刚开始一直都装不上 后来静心读了读Install文件才明白要装smplayer必须要有qt4 2或者更高版本 用rpm qa qt才
  • 短视频矩阵营销系统技术开发者开发笔记分享

    一 开发短视频seo抖音矩阵系统需要遵循以下步骤 1 确定系统需求 根据客户的需求 确定系统的功能和特点 例如用户注册登录 视频上传 视频浏览 评论点赞等 2 设计系统架构 根据系统需求 设计系统的整体架构 包括前端 后端 数据库等组件的功
  • 使用.NET构建登录网站

    摘要 本文将介绍如何使用 NET框架构建一个简单的登录网站 并附带每段代码的解释和讲解 帮助读者了解相关概念和功能 引言 在现代互联网应用中 登录系统是一个常见的功能模块 本文将使用 NET框架来创建一个简单的登录网站 演示如何进行用户认证
  • QT UDP简单的通信示例

    UDP user datagram protocol 即用户数据协议 是一个轻量级的 不可靠的 面向数据报的无连接协议 在qt中提供了QUdpSocket类来进行UDP数据报的发送和接收 在Pro中加入network模块 因为upd是无连接
  • 线性代数基础(变换)

    本文中的图片 公式等来自 GMAES101 在此向作者表达真挚的感谢 一 为什么要引入齐次坐标 平移变换不能用一个矩阵来表示 它不是线性变换 在缩放或者旋转等变换操作后 需要单独用一个向量来表示 这样表示起来就不方便了 根据以上约定 会有以
  • spring boot配置druid(德鲁伊)

    spring boot配置druid 德鲁伊 关于druid的介绍请看 阿里巴巴温少访谈 1 引入相关依赖 全部依赖是上一篇spring boot mybatis依赖的基础上 再加上下边的依赖 如下
  • [note] deep learning tensorflow lecture 1 notes 深度学习笔记 (1)

    1 logistic classifier model W X b Y where W is the Weights Vector X is input vector b is bias and Y is output Y the outp