sklearn.metrics.max_error() function in Python Last Updated : 01 Nov, 2020 Comments Improve Suggest changes Like Article Like Report The max_error() function computes the maximum residual error. A metric that captures the worst-case error between the predicted value and the true value. This function compares each element (index wise) of both lists, tuples or data frames and returns the count of unmatched elements. Syntax: sklearn.metrics.max_error(y_true, y_pred) Parameters: y_true: It accepts the true (correct) target values. y_pred: It accepts the estimate target value. Returns: max_error:<float>: A positive floating-point value. Example 1: Python3 # Import required module from sklearn.metrics import max_error # Assign data y_true = [6, 2, 5, 1] y_pred = [4, 2, 7, 1] # Compute max_error print(max_error(y_true, y_pred)) Output : 2 In the above example, the elements in lists y_true and y_pred are different at index 0 and 2 only. Hence, 2 is the max_error. Example 2: Python3 # Import required module from sklearn.metrics import max_error # Assign data y_true = [3.13,'GFG',56,57667] y_pred = ['Geeks','for','Geeks',3000] # Compute max_error print(max_error(y_true, y_pred)) Output : UFuncTypeError: ufunc 'subtract' did not contain a loop with signature matching types (dtype('<U32'), dtype('<U32')) -> dtype('<U32') In order to use max_error(), the elements of both the lists, tuple, data frame etc. should be of similar type. Example 3: Python3 # Import required module from sklearn.metrics import max_error # Assign data List = [1, 2, 3, 4, 5, 6, 7, 8, 9] y_true = List y_pred = List[::-1] # Compute max_error print(max_error(y_true, y_pred)) Output : 8 Here, there is only 1 matched element. Comment More infoAdvertise with us Next Article sklearn.metrics.max_error() function in Python A adityakumar27200 Follow Improve Article Tags : Machine Learning AI-ML-DS python-modules python Practice Tags : Machine Learningpython Similar Reads Evaluation Metrics in TensorFlow Evaluation metrics accesses the performance of machine learning models. In TensorFlow, these metrics help quantify how well the model is performing during training and after it has been trained. TensorFlow provides a wide variety of built-in metrics for both classification and regression tasks, allo 4 min read Python - tensorflow.math.confusion_matrix() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks.  confusion_matrix() is used to find the confusion matrix from predictions and labels. Syntax: tensorflow.math.confusion_matrix( labels, predictions, num_classes, weights 2 min read Loss function for Linear regression in Machine Learning The loss function quantifies the disparity between the prediction value and the actual value. In the case of linear regression, the aim is to fit a linear equation to the observed data, the loss function evaluate the difference between the predicted value and true values. By minimizing this differen 6 min read How to Return the Fit Error in Python curve_fit The curve fitting method is used in statistics to estimate the output for the best-fit curvy line of a set of data values. Curve fitting is a powerful tool in data analysis that allows us to model the relationship between variables. In Python, the scipy.optimize.curve_fit function is widely used for 5 min read Python - tensorflow.math.erfinv() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. erfinv() is used to compute element wise inverse error function. Syntax: tensorflow.math.erfinv(  x, name) Parameters: x: It's the input tensor. Allowed dtypes are bfl 1 min read Like