
import numpy as np
import requests


def 	_UpperCAmelCase				(  )    ->						str:
  _lowerCAmelCase       :  List[str]   				=					requests.get(
      """https://raw.githubusercontent.com/yashLadha/The_Math_of_Intelligence/"""
      """master/Week1/ADRvsRating.csv"""		)
  _lowerCAmelCase       :  Tuple   				=					response.text.splitlines()
  _lowerCAmelCase       :  Dict   				=					[]
  for item in lines:
    _lowerCAmelCase       :  str   				=					item.split(""","""		)
    data.append(_lowerCamelCase		)
  data.pop(0		)  # This is for removing the labels from the list
  _lowerCAmelCase       :  Union[str, Any]   				=					np.matrix(_lowerCamelCase		)
  return dataset


def 	_UpperCAmelCase				(  _lowerCamelCase						:       int  ,      _lowerCamelCase						:       Any  ,      _lowerCamelCase						:       Tuple  ,      _lowerCamelCase						:       Optional[Any]  ,      _lowerCamelCase						:       Dict		)    ->						Tuple:
  _lowerCAmelCase       :  Optional[int]   				=					len_data

  _lowerCAmelCase       :  Dict   				=					np.dot(_lowerCamelCase  ,      data_x.transpose()		)
  prod -= data_y.transpose()
  _lowerCAmelCase       :  Union[str, Any]   				=					np.dot(_lowerCamelCase  ,      _lowerCamelCase		)
  _lowerCAmelCase       :  Any   				=					theta - (alpha / n) * sum_grad
  return theta


def 	_UpperCAmelCase				(  _lowerCamelCase						:       Tuple  ,      _lowerCamelCase						:       Optional[int]  ,      _lowerCamelCase						:       Dict  ,      _lowerCamelCase						:       List[str]		)    ->						str:
  _lowerCAmelCase       :  Tuple   				=					np.dot(_lowerCamelCase  ,      data_x.transpose()		)
  prod -= data_y.transpose()
  _lowerCAmelCase       :  Optional[int]   				=					np.sum(np.square(_lowerCamelCase		)		)
  _lowerCAmelCase       :  Optional[Any]   				=					sum_elem / (2 * len_data)
  return error


def 	_UpperCAmelCase				(  _lowerCamelCase						:       Dict  ,      _lowerCamelCase						:       List[str]		)    ->						List[Any]:
  _lowerCAmelCase       :  Tuple   				=					10_00_00
  _lowerCAmelCase       :  Optional[Any]   				=					0.000_1550

  _lowerCAmelCase       :  Dict   				=					data_x.shape[1]
  _lowerCAmelCase       :  List[str]   				=					data_x.shape[0] - 1

  _lowerCAmelCase       :  List[Any]   				=					np.zeros((1, no_features)		)

  for i in range(0  ,      _lowerCamelCase		):
    _lowerCAmelCase       :  Dict   				=					run_steep_gradient_descent(_lowerCamelCase  ,      _lowerCamelCase  ,      _lowerCamelCase  ,      _lowerCamelCase  ,      _lowerCamelCase		)
    _lowerCAmelCase       :  List[Any]   				=					sum_of_square_error(_lowerCamelCase  ,      _lowerCamelCase  ,      _lowerCamelCase  ,      _lowerCamelCase		)
    print(f'At Iteration {i + 1} - Error is {error:.5f}'		)

  return theta


def 	_UpperCAmelCase				(  _lowerCamelCase						:       Optional[Any]  ,      _lowerCamelCase						:       Optional[int]		)    ->						Tuple:
  _lowerCAmelCase       :  List[Any]   				=					sum(abs(y - predicted_y[i]		) for i, y in enumerate(_lowerCamelCase		)		)
  return total / len(_lowerCamelCase		)


def 	_UpperCAmelCase				(  )    ->						Tuple:
  _lowerCAmelCase       :  int   				=					collect_dataset()

  _lowerCAmelCase       :  Any   				=					data.shape[0]
  _lowerCAmelCase       :  Tuple   				=					np.c_[np.ones(_lowerCamelCase		), data[:, :-1]].astype(_lowerCamelCase		)
  _lowerCAmelCase       :  Any   				=					data[:, -1].astype(_lowerCamelCase		)

  _lowerCAmelCase       :  str   				=					run_linear_regression(_lowerCamelCase  ,      _lowerCamelCase		)
  _lowerCAmelCase       :  Tuple   				=					theta.shape[1]
  print("""Resultant Feature vector : """		)
  for i in range(0  ,      _lowerCamelCase		):
    print(f'{theta[0, i]:.5f}'		)


if __name__ == "__main__":
     main()




'''simple docstring'''

from ..utils import DummyObject, requires_backends


class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				str    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				List[Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				str    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Optional[Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				int    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				List[str]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Any    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				str    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				List[Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Union[str, Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				List[Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Union[str, Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Dict    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Optional[Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				List[Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				List[Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Tuple    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Optional[int]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Optional[Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Union[str, Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Union[str, Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Optional[int]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Optional[Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Dict    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				List[str]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Dict    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				List[str]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Any    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				List[Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				List[Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				str    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				List[Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Union[str, Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Any    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				str    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Union[str, Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				List[str]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Dict    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Dict    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Optional[Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				int    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				List[Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Union[str, Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Optional[int]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				int    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				List[Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Optional[Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Any    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				str    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				int    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Optional[int]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Optional[Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				List[str]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Union[str, Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Optional[Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Any    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Optional[Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )



class   a_  (metaclass=_a    ):
       __lowerCAmelCase    :				Optional[Any]    =      ["""tokenizers"""]




       def __init__(     self   ,   *snake_case_   ,   **snake_case_  ):
         requires_backends(self   ,   ["""tokenizers"""]  )


