4
여기
는 JSON에 LogisticRegression
모델로부터 예측을 기록하는 코드의 결과이다 :Spark에서 CSV로 쓸 때 벡터 값에 대해 무엇을합니까?
(predictions
.drop(feature_col)
.rdd
.map(lambda x: Row(weight=x.weight,
target=x[target],
label=x.label,
prediction=x.prediction,
probability=DenseVector(x.probability)))
.coalesce(1)
.toDF()
.write
.json(
"{}/{}/summary/predictions".format(path, self._model.bestModel.uid)))
이다 일례 결과 JSON 개체 : 싶습니다
{"label":1.0,"prediction":0.0,"probability":{"type":1,"values":[0.5835784358591029,0.4164215641408972]},"target":"Male","weight":99}
가 출력 할 수 있도록 동일한 데이터를 CSV 파일에 저장하십시오 (값 배열의 첫 번째 요소 인
probability.values[0]
). 그러나 위 코드와 동일한 코드 조각을 사용하면
.json
을
.csv
으로 바꿔서 다음 결과를 얻습니다.
1.0,0.0,"[6,1,0,0,280000001c,c00000002,af154d3100000014,a1d5659f3fe2acac,3fdaa6a6]",Male,99
세 번째 열 (문자열에 값의 묶음이있는 배열)은 어떻게됩니까?