






import numpy

# List of input, output pairs
lowerCamelCase_			=    (
    ((5, 2, 3), 1_5),
    ((6, 5, 9), 2_5),
    ((1_1, 1_2, 1_3), 4_1),
    ((1, 1, 1), 8),
    ((1_1, 1_2, 1_3), 4_1),
)
lowerCamelCase_			=    (((5_1_5, 2_2, 1_3), 5_5_5), ((6_1, 3_5, 4_9), 1_5_0))
lowerCamelCase_			=    [2, 4, 1, 5]
lowerCamelCase_			=    len(train_data)
lowerCamelCase_			=    0.009
def 	lowerCamelCase   (		a_					,		a_="train"      )      ->     int:
							return calculate_hypothesis_value(_UpperCamelCase					,		_UpperCamelCase      ) - output(
							    _UpperCamelCase					,		_UpperCamelCase      )
def 	lowerCamelCase   (		a_      )      ->     List[Any]:
							lowerCAmelCase_									=	0
							for i in range(len(_UpperCamelCase      ) - 1      ):
														hyp_val += data_input_tuple[i] * parameter_vector[i + 1]
							hyp_val += parameter_vector[0]
							return hyp_val
def 	lowerCamelCase   (		a_					,		a_      )      ->     List[str]:
							if data_set == "train":
														return train_data[example_no][1]
							elif data_set == "test":
														return test_data[example_no][1]
							return None
def 	lowerCamelCase   (		a_					,		a_      )      ->     Any:
							if data_set == "train":
														return _hypothesis_value(train_data[example_no][0]      )
							elif data_set == "test":
														return _hypothesis_value(test_data[example_no][0]      )
							return None
def 	lowerCamelCase   (		a_					,		a_=m      )      ->     Tuple:
							lowerCAmelCase_									=	0
							for i in range(_UpperCamelCase      ):
														if index == -1:
																					summation_value += _error(_UpperCamelCase      )
														else:
																					summation_value += _error(_UpperCamelCase      ) * train_data[i][0][index]
							return summation_value
def 	lowerCamelCase   (		a_      )      ->     List[str]:
							lowerCAmelCase_									=	summation_of_cost_derivative(_UpperCamelCase					,		_UpperCamelCase      ) / m
							return cost_derivative_value
def 	lowerCamelCase   (		)      ->     List[Any]:
							global parameter_vector
							# Tune these values to set a tolerance value for predicted output
							lowerCAmelCase_									=	0.000_002
							lowerCAmelCase_									=	0
							lowerCAmelCase_									=	0
							while True:
														j += 1
														lowerCAmelCase_									=	[0, 0, 0, 0]
														for i in range(0					,		len(_UpperCamelCase      )      ):
																					lowerCAmelCase_									=	get_cost_derivative(i - 1      )
																					lowerCAmelCase_									=	(
																					    parameter_vector[i] - LEARNING_RATE * cost_derivative
																					)
														if numpy.allclose(
														    _UpperCamelCase					,		_UpperCamelCase					,		atol=_UpperCamelCase					,		rtol=_UpperCamelCase					,		):
																					break
														lowerCAmelCase_									=	temp_parameter_vector
							print(('Number of iterations:', j)      )
def 	lowerCamelCase   (		)      ->     Optional[Any]:
							for i in range(len(_UpperCamelCase      )      ):
														print(('Actual output value:', output(_UpperCamelCase					,		'test'      ))      )
														print(('Hypothesis output:', calculate_hypothesis_value(_UpperCamelCase					,		'test'      ))      )


if __name__ == "__main__":
		run_gradient_descent()
		print("""\nTesting gradient descent for a linear hypothesis function.\n""")
		test_gradient_descent()








def 		a__      (		_UpperCamelCase      :			int			,_UpperCamelCase      :			int				):
   while second != 0:
      __lowerCamelCase    				=     first & second
      first ^= second
      __lowerCamelCase    				=     c << 1
   return first


if __name__ == "__main__":
  import doctest

  doctest.testmod()

  a_								=       int(input("""Enter the first number: """).strip())
  a_								=       int(input("""Enter the second number: """).strip())
  print(f"{add(first, second) = }")






