MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / summation_of_cost_derivative

Function summation_of_cost_derivative

machine_learning/gradient_descent.py:76–91  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

74
75
76def 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
94def get_cost_derivative(index):

Callers 1

get_cost_derivativeFunction · 0.85

Calls 1

_errorFunction · 0.85

Tested by

no test coverage detected