Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.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
获取异常“;java.lang.ClassCastException:java.lang.Double不能强制转换为org.apache.spark.ml.linalg.Vector”;在数据集创建期间_Java_Apache Spark_Apache Spark Mllib - Fatal编程技术网

获取异常“;java.lang.ClassCastException:java.lang.Double不能强制转换为org.apache.spark.ml.linalg.Vector”;在数据集创建期间

获取异常“;java.lang.ClassCastException:java.lang.Double不能强制转换为org.apache.spark.ml.linalg.Vector”;在数据集创建期间,java,apache-spark,apache-spark-mllib,Java,Apache Spark,Apache Spark Mllib,我们有例外 “java.lang.ClassCastException:java.lang.Double无法强制转换为 org.apache.spark.ml.linalg.Vector” 在数据集创建期间 List<Row> setData = new ArrayList<>(); StructType schemasetData = new StructType( new StructField[] { new StructField("IsMatch", D

我们有例外

“java.lang.ClassCastException:java.lang.Double无法强制转换为 org.apache.spark.ml.linalg.Vector”

在数据集创建期间

List<Row> setData = new ArrayList<>();
StructType schemasetData = new StructType( new StructField[] 
 {
  new StructField("IsMatch", DataTypes.StringType, false,Metadata.empty()),
  new StructField("combinedscore", new  VectorUDT(), false,Metadata.empty()),
  new StructField("ProductDescriptionScore1", DataTypes.StringType, false,Metadata.empty()),
  new StructField("ProductDescriptionScore2", DataTypes.StringType, false,Metadata.empty()),
  new StructField("ProductDescriptionScore3", DataTypes.StringType, false,Metadata.empty()),
  new StructField("ProductDescriptionScore4", DataTypes.StringType, false,Metadata.empty()),
  new StructField("ProductDescriptionScore5", DataTypes.StringType, false,Metadata.empty()),
  new StructField("ManufacturerScore1", DataTypes.StringType, false,Metadata.empty()),
  new StructField("ManufacturerScore2", DataTypes.StringType, false,Metadata.empty()),
  new StructField("ManufacturerScore3", DataTypes.StringType, false,Metadata.empty()),
 });Dataset<Row> dataset = sparkSession.createDataFrame(setData, schemaSetData);
List setData=new ArrayList();
StructType schemasetData=new StructType(new StructField[]
{
新建StructField(“IsMatch”,DataTypes.StringType,false,Metadata.empty()),
new StructField(“combinedscore”、new VectorUDT()、false、Metadata.empty()),
新建StructField(“ProductDescriptionScore1”,DataTypes.StringType,false,Metadata.empty()),
新建StructField(“ProductDescriptionScore2”,DataTypes.StringType,false,Metadata.empty()),
新建StructField(“ProductDescriptionScore3”,DataTypes.StringType,false,Metadata.empty()),
新建StructField(“ProductDescriptionScore4”,DataTypes.StringType,false,Metadata.empty()),
新建StructField(“ProductDescriptionScore5”,DataTypes.StringType,false,Metadata.empty()),
新建StructField(“ManufacturerCore1”,DataTypes.StringType,false,Metadata.empty()),
新建StructField(“ManufacturerCore2”,DataTypes.StringType,false,Metadata.empty()),
新建StructField(“ManufacturerCore3”,DataTypes.StringType,false,Metadata.empty()),
});Dataset Dataset=sparkSession.createDataFrame(setData,schemaSetData);

这是spark中的一个问题。或者如何在模式向量中处理double。

您可以共享数据样本吗?什么是组合分数?