Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache spark Spark GBTClassier始终以100%的准确度进行预测_Apache Spark_Machine Learning_Pyspark_Apache Spark Mllib_Apache Spark Ml - Fatal编程技术网

Apache spark Spark GBTClassier始终以100%的准确度进行预测

Apache spark Spark GBTClassier始终以100%的准确度进行预测,apache-spark,machine-learning,pyspark,apache-spark-mllib,apache-spark-ml,Apache Spark,Machine Learning,Pyspark,Apache Spark Mllib,Apache Spark Ml,我使用SparkML GBTClassier在一个广泛的特征数据集上训练二进制分类问题: Xtrain.selectlabelCol.groupBylabelCol.count.orderBylabelCol.show +---+---+ |标签|计数| +---+---+ | 0|631608| | 1| 18428| +---+---+ va=向量汇编语言putcols=列标题,outputCol=特征 tr=GBTClassifierlabelCol=labelCol,feat

我使用SparkML GBTClassier在一个广泛的特征数据集上训练二进制分类问题:

Xtrain.selectlabelCol.groupBylabelCol.count.orderBylabelCol.show +---+---+ |标签|计数| +---+---+ | 0|631608| | 1| 18428| +---+---+ va=向量汇编语言putcols=列标题,outputCol=特征 tr=GBTClassifierlabelCol=labelCol,featuresCol=features,maxIter=30,maxDepth=5,seed=420 管道=管道阶段=[va,tr] 模型=pipeline.fitXtrain 分类器运行速度非常快,并以100%的准确率学习,更多的过度测试集也以100%的准确率预测。当我打印时

model.stages[1]。功能重要性 SparseVector29,{0:0.0,1:0.0,2:0.0,3:0.0,4:0.0,5:0.0,6:0.0,7:0.0,8:0.0,9:0.0,10:0.0,11:0.0,12:0.0,13:0.0,14:0,15:0.0,16:0,17:0.0,18:0.0,19:0.0,20:0.0,21:0.0,22:0,23:0,24:0,25:0,28:0,27:0}
我注意到,在本例中,我的数据帧中的一个特性24为模型提供了100%的权重。当我删除这个字段并重新训练时,我看到了相同的图片唯一的区别是第二个字段现在对模型起作用,我得到了100%的准确性。显然,这是不对的,是什么?

在非退化数据集上出现这种行为的最常见原因是数据泄漏。数据泄漏可以采取不同的形式,但要考虑

在本例中,我的数据帧中的一个特性24贡献了100%的权重

我们可以大大缩小范围:

一个简单的编码错误-在功能中包含标签或转换标签。您应该仔细检查您的处理管道。 原始数据包含已用于衍生标签或从标签衍生的要素。您应该检查数据字典(如果存在)或其他可用的源,以确定应该从您的模型中丢弃哪些功能—通常查找原始数据中不需要的任何内容。