官网是最好的学习区。
sklearn.metrics 模块包括评分函数、性能指标、成对指标和距离计算
Model Selection Interface 模型可选接口Get a scorer from string
Make a scorer from a performance metric or loss function.
Classification metrics 分类问题的指标
See theClassification metricssection of the user guide for further details.分类准确性得分
metrics.auc(x, y[, reorder])计算AUC
Compute average precision (AP) from prediction scores
Compute the Brier score.
Build a text report showing the main classification metrics
Cohen’s kappa: a statistic that measures inter-annotator agreement.
Compute confusion matrix to evaluate the accuracy of a classification
metrics.f1_score(y_true, y_pred[, labels, …])Compute the F1 score, also known as balanced F-score or F-measure
metrics.fbeta_score(y_true, y_pred, beta[, …])Compute the F-beta score
metrics.hamming_loss(y_true, y_pred[, …])Compute the average Hamming loss.
metrics.hinge_loss(y_true, pred_decision[, …])Average hinge loss (non-regularized)
Jaccard similarity coefficient score
metrics.log_loss(y_true, y_pred[, eps, …])Log loss, aka logistic loss or cross-entropy loss.
Compute the Matthews correlation coefficient (MCC)
Compute precision-recall pairs for different probability thresholds
Compute precision, recall, F-measure and support for each class
Compute the precision
metrics.recall_score(y_true, y_pred[, …])Compute the recall
metrics.roc_auc_score(y_true, y_score[, …])Compute Area Under the Receiver Operating Characteristic Curve (ROC AUC) from prediction scores.
metrics.roc_curve(y_true, y_score[, …])Compute Receiver operating characteristic (ROC)
metrics.zero_one_loss(y_true, y_pred[, …])Zero-one classification loss.
Regression metrics 回归问题的指标
See theRegression metricssection of the user guide for further details.Explained variance regression score function
Mean absolute error regression loss
Mean squared error regression loss
Mean squared logarithmic error regression loss
Median absolute error regression loss
metrics.r2_score(y_true, y_pred[, …])R^2 (coefficient of determination) regression score function.
Multilabel ranking metrics 多标签排序指标
See theMultilabel ranking metricssection of the user guide for further details.metrics.coverage_error(y_true, y_score[, …])Coverage error measure
Compute Ranking loss measure
Clustering metrics 聚类指标
See theClustering performance evaluationsection of the user guide for further details.
Thesklearn.metrics.clustersubmodule contains evaluation metrics for cluster analysis results. There are two forms of evaluation:supervised, which uses a ground truth class values for each sample.
unsupervised, which does not and measures the ‘quality’ of the model itself.Adjusted Mutual Information between two clusterings.
Rand index adjusted for chance.
Compute the Calinski and Harabaz score.
Completeness metric of a cluster labeling given a ground truth.
Measure the similarity of two clusterings of a set of points.
Compute the homogeneity and completeness and V-Measure scores at once.
Homogeneity metric of a cluster labeling given a ground truth.
Mutual Information between two clusterings.
Normalized Mutual Information between two clusterings.
Compute the mean Silhouette Coefficient of all samples.
Compute the Silhouette Coefficient for each sample.
metrics.v_measure_score(labels_true, labels_pred)V-measure cluster labeling given a ground truth.
Biclustering metrics
See theBiclustering evaluationsection of the user guide for further details.The similarity of two sets of biclusters.
Pairwise metrics
See thePairwise metrics, Affinities and Kernelssection of the user guide for further details.
Computes the additive chi-squared kernel between observations in X and Y
Computes the exponential chi-squared kernel X and Y.
Compute cosine similarity between samples in X and Y.
Compute cosine distance between samples in X and Y.
Valid metrics for pairwise_distances.
Considering the rows of X (and Y=X) as vectors, compute the distance matrix between each pair of vectors.
Valid metrics for pairwise_kernels
Compute the laplacian kernel between X and Y.
Compute the linear kernel between X and Y.
Compute the L1 distances between the vectors in X and Y.
Compute the distance matrix from a vector array X and optional Y.
Compute the kernel between arrays X and optional array Y.
Compute the polynomial kernel between X and Y:
Compute the rbf (gaussian) kernel between X and Y:
Compute the sigmoid kernel between X and Y:
Computes the paired euclidean distances between X and Y
Compute the L1 distances between the vectors in X and Y.
Computes the paired cosine distances between X and Y
Computes the paired distances between X and Y.
Compute the distance matrix from a vector array X and optional Y.
Compute minimum distances between one point and a set of points.
Compute minimum distances between one point and a set of points.