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
![](https://img.haomeiwen.com/i14241140/4bb0f3a1e77a40ce.jpg)
![](https://img.haomeiwen.com/i14241140/a5f45bc6096b138b.jpg)
![](https://img.haomeiwen.com/i14241140/d5ae305605f390f9.jpg)
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:
![](https://img.haomeiwen.com/i14241140/d1af4ecaa9b90b96.jpg)
![](https://img.haomeiwen.com/i14241140/fa423afa4603f187.jpg)
![](https://img.haomeiwen.com/i14241140/fa605f00a5dfc95b.jpg)
![](https://img.haomeiwen.com/i14241140/a6329202d08d87dd.jpg)
![](https://img.haomeiwen.com/i14241140/ccfc589e7bb8bc46.jpg)
网友评论