博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
输出方式
阅读量:4617 次
发布时间:2019-06-09

本文共 1126 字,大约阅读时间需要 3 分钟。

目录

Outline

  • \(y\in{R^d}\)

  • 多分类一般为概率
  • \(y_i\in{[0,1]},\,i=0,1,\cdots,y_d-1\)

  • 多分类一般要求各个分类和为1
  • \(y_i\in{[0,1]},\,\sum_{i=0}^{y_d}y_i=1,\,i=0,1,\cdots,y_d-1\)

  • \(y_i\in{[-1,1]},\,i=0,1,\cdots,y_d-1\)

\(y\in{R^d}\)

  • linear regression

  • naive classification with MSE

  • other general prediction

  • out = relu(X@W + b)
    • logits

\(y_i\in{[0,1]}\)

  • binary classfication
    • y>0.5,-->1
    • y<0.5,-->0
  • Image Generation
    • rgb
  • out = relu(X@W + b)

  • sigmoid

\[ f(x) = \frac{1}{1+e^{-x}} \]

o_17-%E8%BE%93%E5%87%BA%E6%96%B9%E5%BC%8F-sigmoid.jpg

  • out' = sigmoid(out) # 把输出值压缩在0-1
import tensorflow as tf
a = tf.linspace(-6., 6, 10)a
tf.sigmoid(a)
x = tf.random.normal([1, 28, 28]) * 5tf.reduce_min(x), tf.reduce_max(x)
(
,
)
x = tf.sigmoid(x)tf.reduce_min(x), tf.reduce_max(x)
(
,
)

\(y_i\in{[0,1]},\,\sum_{i=0}^{y_d}y_i=1\)

a = tf.linspace(-2., 2, 5)tf.sigmoid(a)  # 输出值的和不为1
  • softmax
tf.nn.softmax(a)  # 输出值的和为1

o_17-%E8%BE%93%E5%87%BA%E6%96%B9%E5%BC%8F-softmax.jpg

logits = tf.random.uniform([1, 10], minval=-2, maxval=2)logits
prob = tf.nn.softmax(logits, axis=1)prob
tf.reduce_sum(prob, axis=1)

\(y_i\in{[-1,1]}\)

o_17-%E8%BE%93%E5%87%BA%E6%96%B9%E5%BC%8F-tanh.jpg

a
tf.tanh(a)

转载于:https://www.cnblogs.com/nickchen121/p/10900983.html

你可能感兴趣的文章
vi/vim使用
查看>>
讨论Spring整合Mybatis时一级缓存失效得问题
查看>>
Maven私服配置Setting和Pom文件
查看>>
Linux搭建Nexus3.X构建maven私服
查看>>
Notepad++使用NppFTP插件编辑linux上的文件
查看>>
NPOI 操作Excel
查看>>
MySql【Error笔记】
查看>>
vue入门
查看>>
JS线程Web worker
查看>>
Flex的动画效果与变换!(三)(完)
查看>>
mysql常见错误码
查看>>
Openresty 与 Tengine
查看>>
使用XV-11激光雷达做hector_slam
查看>>
布局技巧4:使用ViewStub
查看>>
ddt Ui 案例2
查看>>
拿下主机后内网的信息收集
查看>>
LeetCode 876. Middle of the Linked List
查看>>
作业一
查看>>
joj1023
查看>>
动画原理——旋转
查看>>