[
https://issues.apache.org/jira/browse/SPARK-6523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14380873#comment-14380873
]
Joseph K. Bradley commented on SPARK-6523:
------------------------------------------
This is not a bug, just missing API. Currently, in PySpark,
StandardScalerModel only exposes the transform() method, not the other model
info. I've created a JIRA for adding this API:
[https://issues.apache.org/jira/browse/SPARK-6261]
> Error when get attribute of StandardScalerModel, When use python api
> --------------------------------------------------------------------
>
> Key: SPARK-6523
> URL: https://issues.apache.org/jira/browse/SPARK-6523
> Project: Spark
> Issue Type: Bug
> Components: Examples, MLlib, PySpark
> Affects Versions: 1.3.0
> Reporter: lee.xiaobo.2006
>
> test code
> =======================================
> from pyspark.mllib.util import MLUtils
> from pyspark.mllib.linalg import Vectors
> from pyspark.mllib.feature import StandardScaler
> conf = SparkConf().setAppName('Test')
> sc = SparkContext(conf=conf)
> data = MLUtils.loadLibSVMFile(sc, "data/mllib/sample_libsvm_data.txt")
> label = data.map(lambda x: x.label)
> features = data.map(lambda x: x.features)
> scaler1 = StandardScaler().fit(features)
> print scaler1.std # error
> sc.stop()
> -----------------------------------------------
> error:
> Traceback (most recent call last):
> File "/data1/s/apps/spark-app/app/test_ssm.py", line 22, in <module>
> print scaler1.std
> AttributeError: 'StandardScalerModel' object has no attribute 'std'
> 15/03/25 12:17:28 INFO Utils: path =
> /data1/s/apps/spark-1.4.0-SNAPSHOT/data/spark-eb1ed7c0-a5ce-4748-a817-3cb0687ee282/blockmgr-5398b477-127d-4259-a71b-608a324e1cd3,
> already present as root for deletion.
> =================================
> Another question, how to serialize or save the scaler model ?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]