简体   繁体   English

如何在CNTK中使用scikit学习指标?

[英]How to use scikit-learn metrics in CNTK?

I wish to use classification metrics like matthews_corrcoef as a metric to a neural network built with CNTK. 我希望将诸如matthews_corrcoef类的分类指标用作使用CNTK构建的神经网络的指标。 The way I could find as of now was to evaluate the value by passing the predictions and label as shown 到目前为止,我可以找到的方法是通过传递预测和标签来评估值,如下所示

matthews_corrcoef(cntk.argmax(y_true, axis=-1).eval(), cntk.argmax(y_pred, axis=-1).eval())

Ideally I'd like to pass the metric to the trainer object while building my network. 理想情况下,我想在构建网络时将指标传递给培训对象。 One of the ways would be to create own custom metric and pass that to the trainer object. 一种方法是创建自己的自定义指标,并将其传递给Trainer对象。 Although possible, it'll be better to be able to reuse the already existing metrics present in other libraries. 虽然可能,但最好能够重用其他库中已经存在的指标。

除非该度量标准已经在CNTK中实现,否则请以CNTK要求的任何格式实现您自己的自定义“度量”函数,并将其输入传递给scikit-learn的度量函数。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM