Apache Spark Deep Learning Cookbook
上QQ阅读APP看书,第一时间看更新

Calculating the cost function in a neural network

At this point, it is time to bring together all of the parts highlighted earlier on in the chapter to calculate the cost function, which will be used by the neural network to determine how well the predicted outcome matched the original or actual outcome, given the 29 individual data points that are currently available. The purpose of the cost function is to identify the difference between the actual value and the predicted value.  Gradient descent is then used to either increase or decrease the values for w1, w2, and b to decrease the value of the cost function and ultimately achieve our goal of deriving a predicted value that matches the actual value.