huaxingao commented on issue #26439: [SPARK-29801][ML] ML models unify toString 
method
URL: https://github.com/apache/spark/pull/26439#issuecomment-552035418
 
 
   I recall the problem we had earlier on Python side when setting params for 
ML models, for example: 
   ```
       >>> gm = GaussianMixture(k=3, tol=0.0001, seed=10)
       >>> model = gm.fit(df)
       >>> model.setPredictionCol("newPrediction")
       GaussianMixture...
   ```
   I had to put ```GaussianMixture...``` in the last line because 
```GaussianMixtureModel...``` would fail.
   Now since the ```toString``` is available in ML models on scala side, I will 
open a jira to fix the python side problem by adding a ```__repr__(self)``` 
method in the ML models
   ```
       def __repr__(self):
           return self._call_java("toString")
   ```
   so I can have 
   ```
       >>> gm = GaussianMixture(k=3, tol=0.0001, seed=10)
       >>> model = gm.fit(df)
       >>> model.setPredictionCol("newPrediction")
       GaussianMixtureModel...
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to