Calculates the sum of cost function derivative :param index: index wrt derivative is being calculated :param end: value where summation ends, default is m, number of examples :return: Returns the summation of cost derivative Note: If index is -1, this means we are calculating su
(index, end=m)
| 74 | |
| 75 | |
| 76 | def summation_of_cost_derivative(index, end=m): |
| 77 | """ |
| 78 | Calculates the sum of cost function derivative |
| 79 | :param index: index wrt derivative is being calculated |
| 80 | :param end: value where summation ends, default is m, number of examples |
| 81 | :return: Returns the summation of cost derivative |
| 82 | Note: If index is -1, this means we are calculating summation wrt to biased |
| 83 | parameter. |
| 84 | """ |
| 85 | summation_value = 0 |
| 86 | for i in range(end): |
| 87 | if index == -1: |
| 88 | summation_value += _error(i) |
| 89 | else: |
| 90 | summation_value += _error(i) * train_data[i][0][index] |
| 91 | return summation_value |
| 92 | |
| 93 | |
| 94 | def get_cost_derivative(index): |
no test coverage detected