用法:
class mxnet.metric.MCC(name='mcc', output_names=None, label_names=None, average='macro')
- name:(
str
) - 此度量實例的名稱用於顯示。 - output_names:(
list of str
, or
None
) - 使用update_dict 更新時應使用的預測名稱。默認情況下包括所有預測。 - label_names:(
list of str
, or
None
) - 使用update_dict 更新時應使用的標簽名稱。默認情況下包括所有標簽。 - average:(
str
,
default 'macro'
) -- 用於跨小批量聚合的策略。
”macro”:平均每批次的 MCC。 “micro”:跨所有批次計算單個 MCC。
- name:(
參數:
計算二元分類問題的馬修斯相關係數。
雖然計算速度比 F1 慢,但 MCC 可以提供 F1 或 Accuracy 無法提供的洞察力。例如,如果網絡總是預測相同的結果,那麽 MCC 將立即顯示這一點。 MCC 在正分類和負分類方麵也是對稱的,但是,標簽中需要同時存在正樣本和負樣本,否則它將始終返回 0。MCC 為 0 是不相關的,1 是完全相關的,-1 是負樣本相關。
其中分母中的 0 項被 1 替換。
注意:
此版本的 MCC 僅支持二進製分類。見 PCC。
例子:
>>> # In this example the network almost always predicts positive >>> false_positives = 1000 >>> false_negatives = 1 >>> true_positives = 10000 >>> true_negatives = 1 >>> predicts = [mx.nd.array( [[.3, .7]]*false_positives + [[.7, .3]]*true_negatives + [[.7, .3]]*false_negatives + [[.3, .7]]*true_positives )] >>> labels = [mx.nd.array( [0.]*(false_positives + true_negatives) + [1.]*(false_negatives + true_positives) )] >>> f1 = mx.metric.F1() >>> f1.update(preds = predicts, labels = labels) >>> mcc = mx.metric.MCC() >>> mcc.update(preds = predicts, labels = labels) >>> print f1.get() ('f1', 0.95233560306652054) >>> print mcc.get() ('mcc', 0.01917751877733392)
相關用法
- Python mxnet.metric.MAE用法及代碼示例
- Python mxnet.metric.MSE用法及代碼示例
- Python mxnet.metric.F1用法及代碼示例
- Python mxnet.metric.TopKAccuracy用法及代碼示例
- Python mxnet.metric.CompositeEvalMetric用法及代碼示例
- Python mxnet.metric.create用法及代碼示例
- Python mxnet.metric.RMSE用法及代碼示例
- Python mxnet.metric.CrossEntropy用法及代碼示例
- Python mxnet.metric.CustomMetric用法及代碼示例
- Python mxnet.metric.np用法及代碼示例
- Python mxnet.metric.Accuracy用法及代碼示例
- Python mxnet.metric.PCC用法及代碼示例
- Python mxnet.metric.Perplexity用法及代碼示例
- Python mxnet.metric.PearsonCorrelation用法及代碼示例
- Python mxnet.metric.NegativeLogLikelihood用法及代碼示例
- Python mxnet.module.BaseModule.get_outputs用法及代碼示例
- Python mxnet.module.BaseModule.forward用法及代碼示例
- Python mxnet.module.BaseModule.bind用法及代碼示例
- Python mxnet.module.BaseModule.init_params用法及代碼示例
- Python mxnet.module.BaseModule.get_params用法及代碼示例
- Python mxnet.module.BaseModule.set_params用法及代碼示例
- Python mxnet.module.BaseModule.update用法及代碼示例
- Python mxnet.module.SequentialModule.add用法及代碼示例
- Python mxnet.module.BaseModule.iter_predict用法及代碼示例
- Python mxnet.module.BaseModule.save_params用法及代碼示例
注:本文由純淨天空篩選整理自apache.org大神的英文原創作品 mxnet.metric.MCC。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。