Calculator
Example Data Table
| Actual | Prediction | Group | Decision at 0.50 |
|---|---|---|---|
| 1 | 0.82 | Protected | Positive |
| 0 | 0.31 | Protected | Negative |
| 1 | 0.76 | Reference | Positive |
| 0 | 0.61 | Reference | Positive |
Formula Used
Prediction bias = mean prediction - mean actual.
Bias percentage = prediction bias / absolute mean actual × 100.
Generalization gap = validation error - training error.
MSE estimate = bias squared + model variance + irreducible noise.
Selection rate = predicted positives / total group cases.
Demographic parity difference = protected selection rate - reference selection rate.
True positive rate = true positives / true positives + false negatives.
False positive rate = false positives / false positives + true negatives.
Equalized odds gap = average of absolute TPR gap and absolute FPR gap.
How to Use This Calculator
Enter the model name and decision threshold first.
Add actual mean, predicted mean, model variance, and error values.
Enter protected and reference group confusion matrix counts.
You may paste row level CSV data instead.
Press submit to display results above the form.
Download the result as CSV or PDF for reporting.
Understanding Machine Learning Bias in Electrical Models
Why Bias Matters
Machine learning bias appears when a model misses the real pattern. It can predict too high, too low, or favor one group. In electrical systems, this matters. A load forecast, fault detector, or battery controller can affect real equipment. Small bias can become costly when decisions repeat every second.
Prediction Bias
This calculator joins two ideas. First, it measures prediction bias. That is the difference between average prediction and average actual value. It also estimates bias share, error balance, and the bias variance estimate. These numbers help you see whether the model underfits, overfits, or needs better features.
Fairness Bias
Second, it checks fairness bias. You can compare a protected group with a reference group. The tool calculates selection rate, true positive rate, false positive rate, demographic parity gap, opportunity gap, and equalized odds gap. These measures are useful when automated decisions affect users, devices, inspections, or service quality.
Data Entry
Use raw CSV when you have row level data. Enter actual value, prediction score, and group name. The calculator can derive means, errors, and group counts from that data. Use summary fields when you already have totals from a notebook, dashboard, or experiment log.
Review Limits
The formula output should not replace model review. Bias can come from training data, sensor drift, labels, sampling, class imbalance, or missing variables. Electrical datasets often include seasonal load changes, noisy meters, and rare fault cases. A fair result needs technical checks and domain review together.
Reading Results
Start by checking the prediction bias sign. A positive value means the model predicts higher than actual values. A negative value means it predicts lower. Then read the validation gap. A large gap may show overfitting. A high bias share may show underfitting.
Fairness Review
Next, compare fairness metrics. A large selection rate gap shows different approval or alert rates. A large true positive rate gap shows one group receives correct positive decisions less often. A large false positive rate gap shows one group receives more incorrect alerts.
Improvement Steps
Improve the model by cleaning data, balancing samples, adding features, tuning complexity, and testing thresholds. Review metrics after each change. Keep exports with model records. Clear evidence makes audits easier and safer.
Repeat the review after deployment, because live data can shift beyond training assumptions and create fresh bias.
FAQs
What is bias in machine learning?
Bias is a consistent difference between model predictions and real outcomes. It can also mean unfair outcome differences between groups.
Why is this listed under Electrical?
Electrical models often predict load, faults, battery behavior, demand, and equipment risk. Bias in these systems can affect operations.
Can I use CSV data?
Yes. Paste actual value, prediction score, and group name. The calculator will derive many metrics from the rows.
What is demographic parity gap?
It is the absolute difference between group selection rates. A large gap may show unequal model decision rates.
What is equal opportunity gap?
It compares true positive rates between two groups. It shows whether correct positive outcomes differ across groups.
What does positive prediction bias mean?
It means the average prediction is higher than the average actual value. The model may be overestimating outcomes.
Does a low bias score prove fairness?
No. Prediction bias and fairness bias are different checks. Review both metrics and inspect the dataset carefully.
Can the PDF replace an audit?
No. The PDF is a report helper. Use it with validation notes, model documentation, and domain review.