


from __future__ import annotations




def 			__lowercase	(						_UpperCamelCase,    _UpperCamelCase     )    ->list:







						"""simple docstring"""

						lowercase			:   Optional[int]					   =		[None] * (len(_UpperCamelCase     ) + len(_UpperCamelCase     ))

						lowercase			:   List[str]					   =		0  # pointer to current index for left Half
						lowercase			:   Dict					   =		0  # pointer to current index for the right Half
						lowercase			:   Optional[int]					   =		0  # pointer to current index for the sorted array Half

						while pointera < len(_UpperCamelCase     ) and pointera < len(_UpperCamelCase     ):
												if left_half[pointera] < right_half[pointera]:
																		lowercase			:   List[Any]					   =		left_half[pointera]
																		pointera += 1
																		index += 1
												else:
																		lowercase			:   Dict					   =		right_half[pointera]
																		pointera += 1
																		index += 1
						while pointera < len(_UpperCamelCase     ):
												lowercase			:   Optional[Any]					   =		left_half[pointera]
												pointera += 1
												index += 1

						while pointera < len(_UpperCamelCase     ):
												lowercase			:   Optional[int]					   =		right_half[pointera]
												pointera += 1
												index += 1

						return sorted_array




def 			__lowercase	(						_UpperCamelCase     )    ->list:







						"""simple docstring"""

						if len(_UpperCamelCase     ) <= 1:
												return array
						# the actual formula to calculate the middle element = left + (right - left) // 2
						# this avoids integer overflow in case of large N
						lowercase			:   Tuple					   =		0 + (len(_UpperCamelCase     ) - 0) // 2

						# Split the array into halves till the array length becomes equal to One
						# merge the arrays of single length returned by mergeSort function and
						# pass them into the merge arrays function which merges the array
						lowercase			:   Tuple					   =		array[:middle]
						lowercase			:   List[str]					   =		array[middle:]

						return merge(merge_sort(_UpperCamelCase     ),    merge_sort(_UpperCamelCase     )     )


if __name__ == "__main__":
		import doctest

		doctest.testmod()





import numpy as np




def 			__lowercase	(						_UpperCamelCase,    _UpperCamelCase     )    ->Dict:







      """simple docstring"""

      lowercase			:   Optional[Any]					   =		np.array(_UpperCamelCase     )
      lowercase			:   Dict					   =		np.array(_UpperCamelCase     )

      lowercase			:   List[Any]					   =		abs(predict - actual     )
      lowercase			:   int					   =		difference.mean()

      return score




def 			__lowercase	(						_UpperCamelCase,    _UpperCamelCase     )    ->List[Any]:







      """simple docstring"""

      lowercase			:   Tuple					   =		np.array(_UpperCamelCase     )
      lowercase			:   str					   =		np.array(_UpperCamelCase     )

      lowercase			:   List[str]					   =		predict - actual
      lowercase			:   Tuple					   =		np.square(_UpperCamelCase     )

      lowercase			:   Union[str, Any]					   =		square_diff.mean()
      return score




def 			__lowercase	(						_UpperCamelCase,    _UpperCamelCase     )    ->str:







      """simple docstring"""

      lowercase			:   Union[str, Any]					   =		np.array(_UpperCamelCase     )
      lowercase			:   Optional[Any]					   =		np.array(_UpperCamelCase     )

      lowercase			:   Tuple					   =		predict - actual
      lowercase			:   Dict					   =		np.square(_UpperCamelCase     )
      lowercase			:   Union[str, Any]					   =		square_diff.mean()
      lowercase			:   Union[str, Any]					   =		np.sqrt(_UpperCamelCase     )
      return score




def 			__lowercase	(						_UpperCamelCase,    _UpperCamelCase     )    ->List[Any]:







      """simple docstring"""

      lowercase			:   List[str]					   =		np.array(_UpperCamelCase     )
      lowercase			:   List[Any]					   =		np.array(_UpperCamelCase     )

      lowercase			:   Dict					   =		np.log(predict + 1     )
      lowercase			:   List[str]					   =		np.log(actual + 1     )

      lowercase			:   int					   =		log_predict - log_actual
      lowercase			:   Tuple					   =		np.square(_UpperCamelCase     )
      lowercase			:   List[Any]					   =		square_diff.mean()

      lowercase			:   int					   =		np.sqrt(_UpperCamelCase     )

      return score




def 			__lowercase	(						_UpperCamelCase,    _UpperCamelCase     )    ->List[str]:







      """simple docstring"""

      lowercase			:   List[Any]					   =		np.array(_UpperCamelCase     )
      lowercase			:   Optional[int]					   =		np.array(_UpperCamelCase     )

      lowercase			:   Optional[int]					   =		predict - actual
      lowercase			:   Optional[int]					   =		np.sum(_UpperCamelCase     ) / len(_UpperCamelCase     )
      lowercase			:   Dict					   =		np.sum(_UpperCamelCase     ) / len(_UpperCamelCase     )
      # print(numerator, denumerator)
      lowercase			:   int					   =		float(_UpperCamelCase     ) / denumerator * 100

      return score




def 			__lowercase	(						_UpperCamelCase,    _UpperCamelCase     )    ->List[Any]:







      """simple docstring"""

      return np.mean(np.array(_UpperCamelCase     ) == np.array(_UpperCamelCase     )     )

