






import numpy

# List of input, output pairs
SCREAMING_SNAKE_CASE__      :			List[str]							=		(
    ((5, 2, 3), 15),
    ((6, 5, 9), 25),
    ((11, 12, 13), 41),
    ((1, 1, 1), 8),
    ((11, 12, 13), 41),
)
SCREAMING_SNAKE_CASE__      :			Any							=		(((5_15, 22, 13), 5_55), ((61, 35, 49), 1_50))
SCREAMING_SNAKE_CASE__      :			List[Any]							=		[2, 4, 1, 5]
SCREAMING_SNAKE_CASE__      :			List[str]							=		len(train_data)
SCREAMING_SNAKE_CASE__      :			Tuple							=		0.009

def      __lowercase					( snake_case,  snake_case="train" ):







				"""simple docstring"""






				return calculate_hypothesis_value(snake_case,  snake_case ) - output(
				    snake_case,  snake_case )

def      __lowercase					( snake_case ):







				"""simple docstring"""






				__magic_name__		:Optional[int]        =      0
				for i in range(len(snake_case ) - 1 ):
								hyp_val += data_input_tuple[i] * parameter_vector[i + 1]
				hyp_val += parameter_vector[0]
				return hyp_val

def      __lowercase					( snake_case,  snake_case ):







				"""simple docstring"""






				if data_set == "train":
								return train_data[example_no][1]
				elif data_set == "test":
								return test_data[example_no][1]
				return None

def      __lowercase					( snake_case,  snake_case ):







				"""simple docstring"""






				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      __lowercase					( snake_case,  snake_case=m ):







				"""simple docstring"""






				__magic_name__		:Any        =      0
				for i in range(snake_case ):
								if index == -1:
												summation_value += _error(snake_case )
								else:
												summation_value += _error(snake_case ) * train_data[i][0][index]
				return summation_value

def      __lowercase					( snake_case ):







				"""simple docstring"""






				__magic_name__		:Optional[Any]        =      summation_of_cost_derivative(snake_case,  snake_case ) / m
				return cost_derivative_value

def      __lowercase					( ):







				"""simple docstring"""






				global parameter_vector
				# Tune these values to set a tolerance value for predicted output
				__magic_name__		:Tuple        =      0.00_0002
				__magic_name__		:List[str]        =      0
				__magic_name__		:Optional[int]        =      0
				while True:
								j += 1
								__magic_name__		:str        =      [0, 0, 0, 0]
								for i in range(0,  len(snake_case ) ):
												__magic_name__		:List[Any]        =      get_cost_derivative(i - 1 )
												__magic_name__		:Optional[int]        =      (
												    parameter_vector[i] - LEARNING_RATE * cost_derivative
												)
								if numpy.allclose(
								    snake_case,  snake_case,  atol=snake_case,  rtol=snake_case,  ):
												break
								__magic_name__		:Tuple        =      temp_parameter_vector
				print(('''Number of iterations:''', j) )

def      __lowercase					( ):







				"""simple docstring"""






				for i in range(len(snake_case ) ):
								print(('''Actual output value:''', output(snake_case,  '''test''' )) )
								print(('''Hypothesis output:''', calculate_hypothesis_value(snake_case,  '''test''' )) )


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














from ...processing_utils import ProcessorMixin
class 						lowerCamelCase_				(      lowerCamelCase ):
				a__					       =  '''WhisperFeatureExtractor'''
				a__					       =  '''WhisperTokenizer'''







				def __init__(						self       ,					__lowerCAmelCase       ,					__lowerCAmelCase     ):
								"""simple docstring"""
								super().__init__(__lowerCAmelCase       ,					__lowerCAmelCase     )
								__magic_name__		:int        =      self.feature_extractor
								__magic_name__		:int        =      False







				def 			A	(						self       ,					__lowerCAmelCase=None       ,					__lowerCAmelCase=None       ,					__lowerCAmelCase=True     ):
								"""simple docstring"""
								return self.tokenizer.get_decoder_prompt_ids(task=__lowerCAmelCase       ,					language=__lowerCAmelCase       ,					no_timestamps=__lowerCAmelCase     )







				def __call__(						self       ,					*__lowerCAmelCase       ,					**__lowerCAmelCase     ):
								"""simple docstring"""
								# For backward compatibility
								if self._in_target_context_manager:
												return self.current_processor(*__lowerCAmelCase       ,					**__lowerCAmelCase     )

								__magic_name__		:List[Any]        =      kwargs.pop('''audio'''       ,					__lowerCAmelCase     )
								__magic_name__		:Any        =      kwargs.pop('''sampling_rate'''       ,					__lowerCAmelCase     )
								__magic_name__		:str        =      kwargs.pop('''text'''       ,					__lowerCAmelCase     )
								if len(__lowerCAmelCase     ) > 0:
												__magic_name__		:Any        =      args[0]
												__magic_name__		:Union[str, Any]        =      args[1:]

								if audio is None and text is None:
												raise ValueError('''You need to specify either an `audio` or `text` input to process.'''     )

								if audio is not None:
												__magic_name__		:Optional[int]        =      self.feature_extractor(__lowerCAmelCase       ,					*__lowerCAmelCase       ,					sampling_rate=__lowerCAmelCase       ,					**__lowerCAmelCase     )
								if text is not None:
												__magic_name__		:Optional[int]        =      self.tokenizer(__lowerCAmelCase       ,					**__lowerCAmelCase     )

								if text is None:
												return inputs

								elif audio is None:
												return encodings
								else:
												__magic_name__		:str        =      encodings['''input_ids''']
												return inputs







				def 			A	(						self       ,					*__lowerCAmelCase       ,					**__lowerCAmelCase     ):
								"""simple docstring"""
								return self.tokenizer.batch_decode(*__lowerCAmelCase       ,					**__lowerCAmelCase     )







				def 			A	(						self       ,					*__lowerCAmelCase       ,					**__lowerCAmelCase     ):
								"""simple docstring"""
								return self.tokenizer.decode(*__lowerCAmelCase       ,					**__lowerCAmelCase     )







				def 			A	(						self       ,					__lowerCAmelCase       ,					__lowerCAmelCase="np"     ):
								"""simple docstring"""
								return self.tokenizer.get_prompt_ids(__lowerCAmelCase       ,					return_tensors=__lowerCAmelCase     )






