


'''simple docstring'''

import numpy as np
import requests






def __UpperCamelCase (      )   ->  List[str]:







     '''simple docstring'''






     _a            =		requests.get(
         "https://raw.githubusercontent.com/yashLadha/The_Math_of_Intelligence/"
         "master/Week1/ADRvsRating.csv"					)
     _a            =		response.text.splitlines()
     _a            =		[]
     for item in lines:
          _a            =		item.split(","					)
          data.append(__lowerCamelCase					)
     data.pop(0					)  # This is for removing the labels from the list
     _a            =		np.matrix(__lowerCamelCase					)
     return dataset






def __UpperCamelCase (      __lowerCamelCase		:			Dict   ,	__lowerCamelCase		:			Dict   ,	__lowerCamelCase		:			List[Any]   ,	__lowerCamelCase		:			int   ,	__lowerCamelCase		:			Optional[Any]					)   ->  Union[str, Any]:







     '''simple docstring'''






     _a            =		len_data

     _a            =		np.dot(__lowerCamelCase   ,	data_x.transpose()					)
     prod -= data_y.transpose()
     _a            =		np.dot(__lowerCamelCase   ,	__lowerCamelCase					)
     _a            =		theta - (alpha / n) * sum_grad
     return theta






def __UpperCamelCase (      __lowerCamelCase		:			str   ,	__lowerCamelCase		:			List[str]   ,	__lowerCamelCase		:			int   ,	__lowerCamelCase		:			Union[str, Any]					)   ->  str:







     '''simple docstring'''






     _a            =		np.dot(__lowerCamelCase   ,	data_x.transpose()					)
     prod -= data_y.transpose()
     _a            =		np.sum(np.square(__lowerCamelCase					)					)
     _a            =		sum_elem / (2 * len_data)
     return error






def __UpperCamelCase (      __lowerCamelCase		:			Any   ,	__lowerCamelCase		:			str					)   ->  Optional[Any]:







     '''simple docstring'''






     _a            =		10_0000
     _a            =		0.0_00_15_50

     _a            =		data_x.shape[1]
     _a            =		data_x.shape[0] - 1

     _a            =		np.zeros((1, no_features)					)

     for i in range(0   ,	__lowerCamelCase					):
          _a            =		run_steep_gradient_descent(__lowerCamelCase   ,	__lowerCamelCase   ,	__lowerCamelCase   ,	__lowerCamelCase   ,	__lowerCamelCase					)
          _a            =		sum_of_square_error(__lowerCamelCase   ,	__lowerCamelCase   ,	__lowerCamelCase   ,	__lowerCamelCase					)
          print(F"At Iteration {i + 1} - Error is {error:.5f}"					)

     return theta






def __UpperCamelCase (      __lowerCamelCase		:			Dict   ,	__lowerCamelCase		:			Optional[Any]					)   ->  int:







     '''simple docstring'''






     _a            =		sum(abs(y - predicted_y[i]					) for i, y in enumerate(__lowerCamelCase					)					)
     return total / len(__lowerCamelCase					)






def __UpperCamelCase (      )   ->  Union[str, Any]:







     '''simple docstring'''






     _a            =		collect_dataset()

     _a            =		data.shape[0]
     _a            =		np.c_[np.ones(__lowerCamelCase					), data[:, :-1]].astype(__lowerCamelCase					)
     _a            =		data[:, -1].astype(__lowerCamelCase					)

     _a            =		run_linear_regression(__lowerCamelCase   ,	__lowerCamelCase					)
     _a            =		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'''

def __UpperCamelCase (      __lowerCamelCase		:			float   ,	__lowerCamelCase		:			float   ,	__lowerCamelCase		:			float					)   ->  float:







     '''simple docstring'''






     if mass < 0:
          raise ValueError("The mass of the body cannot be negative"					)
     if radius <= 0:
          raise ValueError("The radius is always a positive non zero integer"					)
     return (mass * (velocity) ** 2) / radius


if __name__ == "__main__":
   import doctest

   doctest.testmod(verbose=True)

