
"""simple docstring"""






def    UpperCamelCase						(					UpperCAmelCase     )						->List[str]:

   """simple docstring"""



   if number != int(UpperCAmelCase     ):
      raise ValueError("factorial() only accepts integral values"     )
   if number < 0:
      raise ValueError("factorial() not defined for negative values"     )
   a_						   =     1
   for i in range(1 ,   number + 1     ):
      value *= i
   return value
def    UpperCamelCase						(					UpperCAmelCase     )						->Optional[int]:

   """simple docstring"""



   if not isinstance(UpperCAmelCase ,   UpperCAmelCase     ):
      raise ValueError("factorial() only accepts integral values"     )
   if n < 0:
      raise ValueError("factorial() not defined for negative values"     )
   return 1 if n == 0 or n == 1 else n * factorial(n - 1     )


if __name__ == "__main__":
      import doctest

      doctest.testmod()

      UpperCamelCase_						   =   int(input('Enter a positive integer: ').strip() or 0)
      print(F"""factorial{n} is {factorial(n)}""")






import numpy as np
import requests


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


def      SCREAMING_SNAKE_CASE      (   lowerCAmelCase     ,							lowerCAmelCase     ,							lowerCAmelCase     ,							lowerCAmelCase     ,							lowerCAmelCase       ):
       _UpperCamelCase														=    len_data

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


def      SCREAMING_SNAKE_CASE      (   lowerCAmelCase     ,							lowerCAmelCase     ,							lowerCAmelCase     ,							lowerCAmelCase       ):
       _UpperCamelCase														=    np.dot(lowerCAmelCase     ,							data_x.transpose()       )
       prod -= data_y.transpose()
       _UpperCamelCase														=    np.sum(np.square(lowerCAmelCase       )       )
       _UpperCamelCase														=    sum_elem / (2 * len_data)
       return error


def      SCREAMING_SNAKE_CASE      (   lowerCAmelCase     ,							lowerCAmelCase       ):
       _UpperCamelCase														=    100_000
       _UpperCamelCase														=    0.0_0_0_1_5_5_0

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

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

       for i in range(0     ,							lowerCAmelCase       ):
              _UpperCamelCase														=    run_steep_gradient_descent(lowerCAmelCase     ,							lowerCAmelCase     ,							lowerCAmelCase     ,							lowerCAmelCase     ,							lowerCAmelCase       )
              _UpperCamelCase														=    sum_of_square_error(lowerCAmelCase     ,							lowerCAmelCase     ,							lowerCAmelCase     ,							lowerCAmelCase       )
              print(f'''At Iteration {i + 1} - Error is {error:.5f}'''       )

       return theta


def      SCREAMING_SNAKE_CASE      (   lowerCAmelCase     ,							lowerCAmelCase       ):
       _UpperCamelCase														=    sum(abs(y - predicted_y[i]       ) for i, y in enumerate(lowerCAmelCase       )       )
       return total / len(lowerCAmelCase       )


def      SCREAMING_SNAKE_CASE      (   ):
       _UpperCamelCase														=    collect_dataset()

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

       _UpperCamelCase														=    run_linear_regression(lowerCAmelCase     ,							lowerCAmelCase       )
       _UpperCamelCase														=    theta.shape[1]
       print('''Resultant Feature vector : '''       )
       for i in range(0     ,							lowerCAmelCase       ):
              print(f'''{theta[0, i]:.5f}'''       )


if __name__ == "__main__":
       main()






