huaxingao commented on a change in pull request #25776:
[SPARK-28985][PYTHON][ML] Add common classes
(JavaPredictor/JavaClassificationModel/JavaProbabilisticClassifier) in PYTHON
URL: https://github.com/apache/spark/pull/25776#discussion_r324928807
##########
File path: python/pyspark/ml/tests/test_param.py
##########
@@ -343,7 +343,8 @@ def test_java_params(self):
for module in modules:
for name, cls in inspect.getmembers(module, inspect.isclass):
if not name.endswith('Model') and not name.endswith('Params') \
- and issubclass(cls, JavaParams) and not
inspect.isabstract(cls):
+ and issubclass(cls, JavaParams) and not
inspect.isabstract(cls) \
+ and not name.startswith('Java'):
Review comment:
If not have the above change,
```pyspark.ml.tests.test_param.DefaultValuesTests``` will fail because this
```_java_obj``` is never set.
```
ERROR: test_java_params (pyspark.ml.tests.test_param.DefaultValuesTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/Users/hgao/spark081119/spark/python/pyspark/ml/tests/test_param.py", line
348, in test_java_params
check_params(self, cls(), check_params_exist=False)
File "/Users/hgao/spark081119/spark/python/pyspark/testing/mlutils.py",
line 40, in check_params
java_stage = py_stage._to_java()
File "/Users/hgao/spark081119/spark/python/pyspark/ml/wrapper.py", line
222, in _to_java
self._transfer_params_to_java()
File "/Users/hgao/spark081119/spark/python/pyspark/ml/wrapper.py", line
145, in _transfer_params_to_java
pair = self._make_java_param_pair(param, self._defaultParamMap[param])
File "/Users/hgao/spark081119/spark/python/pyspark/ml/wrapper.py", line
131, in _make_java_param_pair
java_param = self._java_obj.getParam(param.name)
AttributeError: 'NoneType' object has no attribute 'getParam'
```
----------------------------------------------------------------
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]