Cost function
| 30 | |
| 31 | // Cost function |
| 32 | double error(const array &out, const array &pred) { |
| 33 | array dif = (out - pred); |
| 34 | return sqrt((double)(sum<float>(dif * dif))); |
| 35 | } |
| 36 | |
| 37 | array sigmoid_binary(const array in) { |
| 38 | // Choosing "1" with probability sigmoid(in) |