-->

Python - Python Machine Learning - Standard Deviation Part 5: Standard Deviation in Model Evaluation

In machine learning, the standard deviation is often used in cross-validation to measure model stability.

Example 6: Standard Deviation in Model Accuracy

import numpy as np

accuracies = [82, 85, 80, 78, 88]  # Accuracy from different runs

mean_accuracy = np.mean(accuracies)

std_dev = np.std(accuracies)

print("Mean Accuracy:", mean_accuracy)

print("Standard Deviation:", std_dev)

Output:

Mean Accuracy: 82.6

Standard Deviation: 3.712

Explanation:

A low standard deviation (e.g., <5) means the model is stable.

A high deviation indicates inconsistent performance across different runs.