importnumpyasnpdefmax_relative_error(y_true:np.ndarray|list,y_pred:np.ndarray|list)->float:""" Calculate the Maximum Relative Error (MRE) between true values and predicted values. Parameters: y_true (np.ndarray | list): Array or list of true values. y_pred (np.ndarray | list): Array or list of predicted values. Returns: float: The mean relative error. """# Convert inputs to numpy arrays if they are not alreadyy_true=np.asarray(y_true,dtype=np.float64)y_pred=np.asarray(y_pred,dtype=np.float64)# Calculate the absolute differencesd=np.abs(y_true-y_pred)# Avoid division by zero by adding a small epsilon valueepsilon=np.finfo(float).epsdenominator=np.abs(y_true)+epsilon# Calculate relative errors and find the maximumrelative_error=np.max(d/denominator)returnrelative_error