mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-06 02:13:15 +08:00
Set the Python file maximum line length to 88 characters (#2122)
* flake8 --max-line-length=88 * fixup! Format Python code with psf/black push Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
"""
|
||||
Implementation of gradient descent algorithm for minimizing cost of a linear hypothesis function.
|
||||
Implementation of gradient descent algorithm for minimizing cost of a linear hypothesis
|
||||
function.
|
||||
"""
|
||||
import numpy
|
||||
|
||||
@ -75,7 +76,8 @@ def summation_of_cost_derivative(index, end=m):
|
||||
: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 summation wrt to biased parameter.
|
||||
Note: If index is -1, this means we are calculating summation wrt to biased
|
||||
parameter.
|
||||
"""
|
||||
summation_value = 0
|
||||
for i in range(end):
|
||||
@ -90,7 +92,8 @@ def get_cost_derivative(index):
|
||||
"""
|
||||
:param index: index of the parameter vector wrt to derivative is to be calculated
|
||||
:return: derivative wrt to that index
|
||||
Note: If index is -1, this means we are calculating summation wrt to biased parameter.
|
||||
Note: If index is -1, this means we are calculating summation wrt to biased
|
||||
parameter.
|
||||
"""
|
||||
cost_derivative_value = summation_of_cost_derivative(index, m) / m
|
||||
return cost_derivative_value
|
||||
|
Reference in New Issue
Block a user