

import numpy as np







def  UpperCAmelCase_   (_lowerCAmelCase :		Dict     ,			_lowerCAmelCase :		Dict		):
			__UpperCamelCase    :    Union[str, Any]								=      np.array(_lowerCAmelCase		)
			__UpperCamelCase    :    Tuple								=      np.array(_lowerCAmelCase		)

			__UpperCamelCase    :    Any								=      abs(predict - actual		)
			__UpperCamelCase    :    Optional[Any]								=      difference.mean()

			return score







def  UpperCAmelCase_   (_lowerCAmelCase :		List[Any]     ,			_lowerCAmelCase :		Optional[Any]		):
			__UpperCamelCase    :    Dict								=      np.array(_lowerCAmelCase		)
			__UpperCamelCase    :    Tuple								=      np.array(_lowerCAmelCase		)

			__UpperCamelCase    :    Dict								=      predict - actual
			__UpperCamelCase    :    Union[str, Any]								=      np.square(_lowerCAmelCase		)

			__UpperCamelCase    :    Tuple								=      square_diff.mean()
			return score







def  UpperCAmelCase_   (_lowerCAmelCase :		Dict     ,			_lowerCAmelCase :		List[str]		):
			__UpperCamelCase    :    Any								=      np.array(_lowerCAmelCase		)
			__UpperCamelCase    :    List[Any]								=      np.array(_lowerCAmelCase		)

			__UpperCamelCase    :    Dict								=      predict - actual
			__UpperCamelCase    :    Any								=      np.square(_lowerCAmelCase		)
			__UpperCamelCase    :    Optional[Any]								=      square_diff.mean()
			__UpperCamelCase    :    Optional[int]								=      np.sqrt(_lowerCAmelCase		)
			return score







def  UpperCAmelCase_   (_lowerCAmelCase :		Tuple     ,			_lowerCAmelCase :		Any		):
			__UpperCamelCase    :    Any								=      np.array(_lowerCAmelCase		)
			__UpperCamelCase    :    List[str]								=      np.array(_lowerCAmelCase		)

			__UpperCamelCase    :    List[Any]								=      np.log(predict + 1		)
			__UpperCamelCase    :    Union[str, Any]								=      np.log(actual + 1		)

			__UpperCamelCase    :    str								=      log_predict - log_actual
			__UpperCamelCase    :    Optional[int]								=      np.square(_lowerCAmelCase		)
			__UpperCamelCase    :    Any								=      square_diff.mean()

			__UpperCamelCase    :    List[Any]								=      np.sqrt(_lowerCAmelCase		)

			return score







def  UpperCAmelCase_   (_lowerCAmelCase :		List[str]     ,			_lowerCAmelCase :		Dict		):
			__UpperCamelCase    :    int								=      np.array(_lowerCAmelCase		)
			__UpperCamelCase    :    Union[str, Any]								=      np.array(_lowerCAmelCase		)

			__UpperCamelCase    :    List[str]								=      predict - actual
			__UpperCamelCase    :    str								=      np.sum(_lowerCAmelCase		) / len(_lowerCAmelCase		)
			__UpperCamelCase    :    str								=      np.sum(_lowerCAmelCase		) / len(_lowerCAmelCase		)
			# print(numerator, denumerator)
			__UpperCamelCase    :    str								=      float(_lowerCAmelCase		) / denumerator * 1_00

			return score







def  UpperCAmelCase_   (_lowerCAmelCase :		Any     ,			_lowerCAmelCase :		str		):
			return np.mean(np.array(_lowerCAmelCase		) == np.array(_lowerCAmelCase		)		)


from __future__ import annotations







def  UpperCAmelCase_   (_lowerCAmelCase :		int     ,			_lowerCAmelCase :		list[int]     ,			_lowerCAmelCase :		list[int]     ,			_lowerCAmelCase :		int		):

			# Base Case
			if counter == 0 or capacity == 0:
						return 0

			# If weight of the nth item is more than Knapsack of capacity,
			#   then this item cannot be included in the optimal solution,
			# else return the maximum of two cases:
			#   (1) nth item included
			#   (2) not included
			if weights[counter - 1] > capacity:
						return knapsack(_lowerCAmelCase     ,			_lowerCAmelCase     ,			_lowerCAmelCase     ,			counter - 1		)
			else:
						__UpperCamelCase    :    Tuple								=      capacity - weights[counter - 1]
						__UpperCamelCase    :    List[str]								=      values[counter - 1] + knapsack(
						    _lowerCAmelCase     ,			_lowerCAmelCase     ,			_lowerCAmelCase     ,			counter - 1		)
						__UpperCamelCase    :    Dict								=      knapsack(_lowerCAmelCase     ,			_lowerCAmelCase     ,			_lowerCAmelCase     ,			counter - 1		)
						return max(_lowerCAmelCase     ,			_lowerCAmelCase		)


if __name__ == "__main__":
					import doctest

					doctest.testmod()