diff options
author | Yanbo Liang <ybliang8@gmail.com> | 2016-06-02 11:10:13 -0500 |
---|---|---|
committer | Sean Owen <sowen@cloudera.com> | 2016-06-02 11:10:13 -0500 |
commit | 4fe7c7bd1eeb4ae954e750e521e6d72dc8ff5225 (patch) | |
tree | 5d94eaa919d3474b3a27215ecbf6ff698934031b /scalastyle-config.xml | |
parent | a0eec8e8ffd5a43cae67aa0f5dbcf7ca19a4f3aa (diff) | |
download | spark-4fe7c7bd1eeb4ae954e750e521e6d72dc8ff5225.tar.gz spark-4fe7c7bd1eeb4ae954e750e521e6d72dc8ff5225.tar.bz2 spark-4fe7c7bd1eeb4ae954e750e521e6d72dc8ff5225.zip |
[SPARK-15605][ML][EXAMPLES] Fix broken ML JavaDeveloperApiExample.
## What changes were proposed in this pull request?
See [SPARK-15605](https://issues.apache.org/jira/browse/SPARK-15605) for the detail of this bug. This PR fix 2 major bugs in this example:
* The java example class use Param ```maxIter```, it will fail when calling ```Param.shouldOwn```. We need add a public method which return the ```maxIter``` Object. Because ```Params.params``` use java reflection to list all public method whose return type is ```Param```, and invoke them to get all defined param objects in the instance.
* The ```uid``` member defined in Java class will be initialized after Scala traits such as ```HasFeaturesCol```. So when ```HasFeaturesCol``` being constructed, they get ```uid``` with null, which will cause ```Param.shouldOwn``` check fail.
so, here is my changes:
* Add public method:
```public IntParam getMaxIterParam() {return maxIter;}```
* Use Java anonymous class overriding ```uid()``` to defined the ```uid```, and it solve the second problem described above.
* To make the ```getMaxIterParam ``` can be invoked using java reflection, we must make the two class (MyJavaLogisticRegression and MyJavaLogisticRegressionModel) public. so I make them become inner public static class.
## How was this patch tested?
Offline tests.
Author: Yanbo Liang <ybliang8@gmail.com>
Closes #13353 from yanboliang/spark-15605.
Diffstat (limited to 'scalastyle-config.xml')
0 files changed, 0 insertions, 0 deletions