sklearn.metrics
时间: 2023-12-15 22:06:03 浏览: 29
The sklearn.metrics module provides various functions to evaluate the performance of machine learning models. It contains metrics for classification, regression, and clustering tasks. Some of the commonly used metrics are:
Classification Metrics:
- accuracy_score(): computes accuracy classification score.
- confusion_matrix(): computes confusion matrix to evaluate the performance of a classification model.
- precision_score(): computes precision score for a classification model.
- recall_score(): computes recall score for a classification model.
- f1_score(): computes f1 score for a classification model.
- classification_report(): generates a text report showing the main classification metrics.
Regression Metrics:
- mean_absolute_error(): computes mean absolute error regression loss.
- mean_squared_error(): computes mean squared error regression loss.
- r2_score(): computes R² (coefficient of determination) regression score function.
Clustering Metrics:
- adjusted_rand_score(): computes adjusted Rand index to evaluate the performance of a clustering model.
- silhouette_score(): computes the mean silhouette coefficient to evaluate the performance of a clustering model.
Overall, the sklearn.metrics module provides a comprehensive set of functions to evaluate the performance of machine learning models.