简体   繁体   English

Confusion_matrix ValueError:分类指标无法处理二进制和连续多输出目标的混合

[英]Confusion_matrix ValueError: Classification metrics can't handle a mix of binary and continuous-multioutput targets

can anyone fix undersampling confusion matrix error from the line: undersample_cm = confusion_matrix(original_ytest, undersample_fraud_predictions) I think the problem is from the import or original_ytest and undersample_fraud_predictions任何人都可以从以下行修复欠采样混淆矩阵错误:undersample_cm = chaos_matrix(original_ytest, undersample_fraud_predictions) 我认为问题出在导入或original_ytestundersample_fraud_predictions

undersample_cm = confusion_matrix(original_ytest, undersample_fraud_predictions)
actual_cm = confusion_matrix(original_ytest, original_ytest)
labels = ['No Fraud', 'Fraud']

The picture of the error here错误的图片在这里

confusion_matrix works with two arrays of same size, same type of data.混淆矩阵与两个大小相同、数据类型相同的 arrays 一起使用。

y_true = [1, 0, 0, 1, 0, 1]
y_pred = [0, 0, 0, 0, 0, 1]
confusion_matrix(y_true, y_pred)

I guess there is a continuous variable in any of your arrays.我猜你的任何 arrays 中都有一个连续变量。 For this, if you run the actual_cm line first, you can see which array is the problem.为此,如果您先运行 actual_cm 行,您可以看到问题所在的数组。 One of your arrays, namely original_ytest, contains integer values as it should, but you're probably getting an error because it contains continuous values in the undersample_fraud_predictions array.您的 arrays 之一,即 original_ytest,包含应有的 integer 值,但您可能会遇到错误,因为它在 undersample_fraud_predictions 数组中包含连续值。

original_ytest = [1, 0, 0, 1, 0, 1]
undersample_fraud_predictions = [1, 0, 0, 0, 0, 1.5]
confusion_matrix(original_ytest , undersample_fraud_predictions )

When you run the code I want to explain above, the error you get will be the same (Classification metrics can't handle a mix of binary and continuous targets).当您运行我上面要解释的代码时,您得到的错误将是相同的(分类指标无法处理二进制和连续目标的混合)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 混淆矩阵:ValueError:分类指标无法处理多类和连续多输出目标的混合 - Confusion matrix: ValueError: Classification metrics can't handle a mix of multiclass and continuous-multioutput targets 混淆矩阵() | ValueError:分类指标无法处理多类和多类多输出目标的混合 - confusion_matrix() | ValueError: Classification metrics can't handle a mix of multiclass and multiclass-multioutput targets hwo 修复 ValueError:分类指标无法处理多类和连续多输出目标的混合 - hwo to repair ValueError: Classification metrics can't handle a mix of multiclass and continuous-multioutput targets ValueError:分类指标无法处理多标签指标和连续多输出目标 sklearn 的混合 - ValueError: Classification metrics can't handle a mix of multilabel-indicator and continuous-multioutput targets sklearn ValueError:分类指标无法处理多标签指标和连续多输出目标错误的混合 - ValueError: Classification metrics can't handle a mix of multilabel-indicator and continuous-multioutput targets error ValueError:分类指标无法处理多标签指标和连续多输出目标的混合 - ValueError: Classification metrics can't handle a mix of multilabel-indicator and continuous-multioutput targets Keras混淆矩阵:ValueError:分类指标无法处理多类多输出和二进制目标的混合 - Keras confusion matrix: ValueError: Classification metrics can't handle a mix of multiclass-multioutput and binary targets f-score:ValueError:分类指标无法处理多标签指标和连续多输出目标的混合 - f-score: ValueError: Classification metrics can't handle a mix of multilabel-indicator and continuous-multioutput targets 分类指标无法处理连续多输出和多标签指标目标的混合 - classification metrics can't handle a mix of continuous-multioutput and multi-label-indicator targets 混淆矩阵 ValueError:分类指标无法处理二进制和连续目标的混合 - Confusion Matrix ValueError: Classification metrics can't handle a mix of binary and continuous targets
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM