Scala MLlib Spark中MultilayerPerceptronClassifier函数的输入格式应该是什么?

Scala MLlib Spark中MultilayerPerceptronClassifier函数的输入格式应该是什么?,scala,apache-spark,machine-learning,neural-network,word2vec,Scala,Apache Spark,Machine Learning,Neural Network,Word2vec,我有这个示例代码。输入文件“data/mllib/sample\u multiclass\u classification\u data.txt”的格式如下: import org.apache.spark.ml.classification.MultilayerPerceptronClassifier import org.apache.spark.ml.evaluation.MulticlassClassificationEvaluator import org.apache.spark.m

我有这个示例代码。输入文件“data/mllib/sample\u multiclass\u classification\u data.txt”的格式如下:

import org.apache.spark.ml.classification.MultilayerPerceptronClassifier
import org.apache.spark.ml.evaluation.MulticlassClassificationEvaluator
import org.apache.spark.mllib.util.MLUtils
import org.apache.spark.sql.Row

// Load training data
val data = MLUtils.loadLibSVMFile(sc,"data/mllib/sample_multiclass_classification_data.txt").toDF()
// Split the data into train and test
val splits = data.randomSplit(Array(0.6, 0.4), seed = 1234L)
val train = splits(0)
val test = splits(1)
// specify layers for the neural network: 
// input layer of size 4 (features), two intermediate of size 5 and 4 and output of size 3 (classes)
val layers = Array[Int](4, 5, 4, 3)
// create the trainer and set its parameters
val trainer = new MultilayerPerceptronClassifier()
  .setLayers(layers)
  .setBlockSize(128)
  .setSeed(1234L)
  .setMaxIter(100)
// train the model
val model = trainer.fit(train)
// compute precision on the test set
val result = model.transform(test)
val predictionAndLabels = result.select("prediction", "label")
val evaluator = new MulticlassClassificationEvaluator().setMetricName("precision")
println("Precision:" + evaluator.evaluate(predictionAndLabels))
我的输入文件(CSV):

我的输出如下所示:

关键余额-0.0036513722,7.4863195E-4,0.0026168288,0.0018019283,3.6993028E-5,0.0015877665,-0.0023806596,-0.0044850614,0.0030128842,-0.0027919186,0.0029404194,0.001331976,-0.002444722,-0.0022837287,0.0033935083,-1.0614514E-4,0.004019062,0.001854306,28591,0.001875,-0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.414178787-4、-4.0.978080808080807-4-4-4-4-4-4-4-4-4-4-4-4.0.0.0.97808080808080807 7 7-7-7-5-5-5-5-4-4-5-4-5-4.0.0.97808080808080807-5-5-5-5-5-5-4-5-4-5-4-5-4-5-5-4-5-5-4-5-4.5-5-5-5-5-4-5-5-4.0.5-5-5-5-5-5-4.0.0.978080808080808080285,-0.0045714066,-其中,0.00449494503-3.7978787-3-3-3.78787878787-3.7978787-3-3.797878787-7-3-3.7878787 7 7 7 7 7 7-4,-0.0.00235959877 7-4-0.7978787878787 7 7 7 7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7.78787878787878787-7-7-7-7-7-7,-0.78787878787878787878787-7-4,-0.78787-0.7878787-0.7878787-0.78787-0.787-0-0.7878787878787-0.787-0.787-0-7-0 8982,-0.0.0.2123734-4-0.0.41414848484848404040404040404040404040404040404041414141414141414141414141414141414141414141414141414141414141414141414141414141414-4-4-4-4.0.0.0.0.2123232373737314-0.0.0.0.0.0.0.0.0.0.0 0.2123232373737373737314、0.0.0.0.0.0.0 0 0 0 0 0.0.0 0 0 0 0 0.0 0 0 0 0 0 0 0 0 0 0 0.0 0 0 0.0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0 0 0 0 0 0 0 0.0 0 0 0 0.0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 37607,6.298947E-4,0.00294445,-2.794385E-4,-0.004432401,0.0034545213,0.002706862

我想执行以下操作:输入->word2vec->输出->神经网络,
但是示例代码的输出格式与我的输出不匹配。有人能帮我吗?

你能显示示例代码的输出吗?问题已解决。谢谢你,你应该在将来发布答案来帮助与你相同的人。word2vector的输出如下:[-0.069206687747853142,0.04828440344759396,0.0406973444185900874,-0.017867059313825196]MultilayerPerceptronClassifier的输入应采用以下格式:3 1:-0.040327 2:0.054813 3:0.034227 4:-0.033958,其中3表示标签或类别,1,2,3,4表示功能数量。是否显示示例代码的输出?问题已解决。谢谢你,你应该在将来发布答案来帮助与你相同的人。word2vector的输出如下:[-0.069206687747853142,0.04828440344759396,0.0406973444185900874,-0.017867059313825196]多层受体分类器的输入应采用以下格式:3 1:-0.040327 2:0.054813 3:0.034227 4:-0.033958,其中3表示标签或类别,1,2,3,4表示特征数量
1 1:-0.222222 2:0.5 3:-0.762712 4:-0.833333 
1 1:-0.555556 2:0.25 3:-0.864407 4:-0.916667 
1 1:-0.722222 2:-0.166667 3:-0.864407 4:-0.833333 
1 1:-0.722222 2:0.166667 3:-0.694915 4:-0.916667
Help me with my Account Balance, Balance
Want to know my Balance, Balance
What is the available Balance in my Account, Balance
Balance in Account, Balance
Available bank Balance, Balance
Help me with my Account Balance, Balance
Want to know my Balance, Balance
What is the available Balance in my Account, Balance
Balance in Account, Balance