ml_metrics 0.1.0 copy "ml_metrics: ^0.1.0" to clipboard
ml_metrics: ^0.1.0 copied to clipboard

A lightweight and easy-to-use Dart library for evaluating machine learning models. Includes accuracy, precision, recall, F1 score, and confusion matrix for binary classification.

πŸ“Š ml_metrics #

A lightweight and efficient Dart library for evaluating machine learning models.
Supports binary classification metrics such as Accuracy, Precision, Recall, F1 Score, and Confusion Matrix.


✨ Features #

  • βœ… Accuracy score
  • βœ… Precision & Recall (binary classification)
  • βœ… F1 Score
  • βœ… Confusion Matrix
  • βœ… Fully tested & null-safe

πŸ“¦ Installation #

Add the following to your pubspec.yaml:

dependencies:
  ml_metrics: ^0.1.0

Then run:

dart pub get

πŸš€ Quick Example #

import 'package:ml_metrics/ml_metrics.dart';

void main() {
  final yTrue = [1, 0, 1, 1, 0];
  final yPred = [1, 0, 0, 1, 1];

  print('Accuracy: ${accuracy(yTrue, yPred)}');
  print('Precision: ${precision(yTrue, yPred)}');
  print('Recall: ${recall(yTrue, yPred)}');
  print('F1 Score: ${f1Score(yTrue, yPred)}');
  print('Confusion Matrix: ${binaryConfusionMatrix(yTrue, yPred)}');
}

πŸ“š Metrics Reference #

Metric Description
accuracy Ratio of correct predictions
precision TP / (TP + FP)
recall TP / (TP + FN)
f1Score Harmonic mean of precision and recall
binaryConfusionMatrix Returns [TP, FP, FN, TN] as a list

πŸ§ͺ Run Tests #

dart test


πŸ“„ License #

This project is licensed under the MIT License. See the LICENSE file for details.

0
likes
140
points
24
downloads

Publisher

unverified uploader

Weekly Downloads

A lightweight and easy-to-use Dart library for evaluating machine learning models. Includes accuracy, precision, recall, F1 score, and confusion matrix for binary classification.

Repository (GitHub)
View/report issues

Topics

#machine-learning #metrics #evaluation #classification #dart

Documentation

API reference

License

MIT (license)

More

Packages that depend on ml_metrics