[英]Custom loss function for Multiclass claasification in Scala and Spark
I want to ask is this possible to write a custom loss function for Multi class Classification in Spark using Scala. 我想问一下是否有可能使用Scala在Spark中为多类分类编写自定义损失函数。 I want to code multi-class logarithmic loss in Scala.
我想在Scala中编写多类对数损失代码。 I searched Spark documentation but could not get any hint.
我搜索了Spark文档,但没有得到任何提示。
From the Spark 2.2.0 MLlib guide : 从Spark 2.2.0 MLlib指南 :
Currently, only binary classification is supported.. This will likely change when multiclass classification is supported.
当前仅支持二进制分类。当支持多类分类时,这可能会改变。
If you are not restricted to a particular classification technique I would suggest using XGBoost. 如果您不局限于特定的分类技术,建议您使用XGBoost。 It has a Spark-compatible implementation, and it makes it possible to use any loss function provided you can compute is derivative twice.
它具有Spark兼容的实现,并且可以使用任何损失函数,只要您可以计算两次导数即可。
You can find a tutorial here . 您可以在此处找到教程。
Also the explanation about why it is possible to use a custom loss function can be found here . 另外,有关为什么可以使用自定义损失函数的说明也可以在此处找到。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.