LabeledPoint(y[i], X[i])

复制来自http://spark.apache.org/docs/latest/mllib-data-types.html
A labeled point is represented by LabeledPoint.

Refer to the LabeledPoint Python docs for more details on the API.

from pyspark.mllib.linalg import SparseVector
from pyspark.mllib.regression import LabeledPoint

# Create a labeled point with a positive label and a dense feature vector.创建带有正标签和密集特征向量的标记点。
pos = LabeledPoint(1.0, [1.0, 0.0, 3.0])

# Create a labeled point with a negative label and a sparse feature vector.
neg = LabeledPoint(0.0, SparseVector(3, [0, 2], [1.0, 3.0]))

猜你喜欢

转载自blog.csdn.net/wqqGo/article/details/82584981
I