天软金融分析.NET函数大全
>
金融函数
>
专题函数
>
机器学习
>
机器学习算法评价方法
>
分类算法评价指标
confusion_matrix2
复制链接
简述
计算混淆矩阵,返回以分类标签为下标的混淆矩阵
定义
confusion_matrix2(y_true:Array;y_pred:Array;labels:Array;sample_weight:Array): matrix;
参数
名称
类型
说明
y_true
Array
真实值序列
y_pred
Array
预测值序列
labels
Array
混淆矩阵下标排序,
不给定labels时,可以通过labels读取出
内部排序
sample_weight
Array
样本权重,1表示等权重,与全一数组等效,默认等权重
返回
matrix
以分类标签为下标的混淆矩阵。横坐标为真实值,纵坐标为预测值
范例
//指定sample_weight
y_true := array("cat", "ant", "cat", "cat", "ant", "bird");
y_pred := array("ant", "ant", "cat", "cat", "ant", "cat");
sample_weight := array(1,1.5,2,1,1,3); //样本权重
cm := confusion_matrix2(y_true, y_pred, labels, sample_weight);
return array(
'混淆矩阵' : cm,
'下标对照表' : labels,
'---' : '---',
'字符串下标混淆矩阵' :
ReindexCopy(cm, labels, labels)
);
相关
Accuracy_Score
confusion_matrix
confusion_matrix2
multilabel_confusion_matrix
Hamming_loss
matthews_corrcoef
cohen_kappa_score
balanced_accuracy_score
precision_score
Log_loss
recall_score
fbeta_score
f1_score
roc_curve
precision_recall_curve
Auc
ks_curve