十.Tensorflow反向传播

A Regression Example

We create a regression example as follows. The input data will be 100 random samples from a normal (mean of 1.0, stdev of 0.1). The target will be 100 constant values of 10.0.

We will fit the regression model: x_data * A = target_values

Theoretically, we know that A should be equal to 10.0.

We start by creating the data and targets with their respective placholders

Classification Example

For the classification example, we will create an x-sample made of two different normal distribution inputs, Normal(mean = -1, sd = 1) and Normal(mean = 3, sd = 1). For each of these the target will be the class 0 or 1 respectively.

The model will fit the binary classification: If sigmoid(x+A) < 0.5 then predict class 0, else class 1.

Theoretically, we know that A should take on the value of the negative average of the two means: -(mean1 + mean2)/2.

We start by resetting the computational graph:

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1. 忙忙碌碌三百日,人有几朝得静闲? 2. 蓝天,白云,风清,花香。泉水,单丛。有美景在,却无闲人来。
    丘彭丘文亮文艺传媒阅读 1,384评论 0 4
  • 栗发少年曾想:若冷漠是你的天赋,那么我的微笑便是融化你的温度。 “你叫Tezuka吧,呐,我们交个朋友吧,我是Fu...
    聿亦非阅读 1,261评论 0 1
  • 今天一天都在弄面试的东西,昨天在简书上看了很多关于面试的东西,今天早上按照简书上说的东西做了一份简历,简历自然也是...
    写作的白阅读 1,202评论 0 0
  • 生活中,不能避免但又让人头大的事情莫过于排队了。 吃饭时排队、买东西排队、驾校学开车排队、去银行办事排队、买票排队...
    一言二语阅读 6,675评论 3 0
  • 传统的数据库定义了四种隔离级别: 1. Read Uncommitted 2.Read Committed 3.R...
    奔跑的番茄酱阅读 7,753评论 6 2