Discussion:
[GitHub] mahout pull request #357: MAHOUT-2051 [WIP] Fix IllegalStateException in Mix...
pschaumann
2018-07-18 11:34:05 UTC
Permalink
GitHub user pschaumann opened a pull request:

https://github.com/apache/mahout/pull/357

MAHOUT-2051 [WIP] Fix IllegalStateException in MixedGradient.java

### Purpose of PR:
After initialization of a MixedGradient instance both variables "hasZero" and "hasOne" are false, which leads to an IllegalStateException in the function "apply" if random.nextDouble() < alpha.

The proposed change would avoid this by using only the base gradient until both cases (actual == 0 and actual == 1) occured at least once.


### Important ToDos
Please mark each with an "x"
- [x] A JIRA ticket exists (if not, please create this first)[https://issues.apache.org/jira/browse/ZEPPELIN/]
- [x] Title of PR is "MAHOUT-XXXX Brief Description of Changes" where XXXX is the JIRA number.
- [ ] Created unit tests where appropriate
- [x] Added licenses correct on newly added files
- [ ] Assigned JIRA to self
- [ ] Added documentation in scala docs/java docs, and to website
- [x] Successfully built and ran all unit tests, verified that all tests pass locally.

If all of these things aren't complete, but you still feel it is
appropriate to open a PR, please add [WIP] after MAHOUT-XXXX before the
descriptions- e.g. "MAHOUT-XXXX [WIP] Description of Change"

Does this change break earlier versions?
No

Is this the beginning of a larger project for which a feature branch should be made?
No


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/pschaumann/mahout patch-1

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/mahout/pull/357.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #357

----
commit e317713975b97169b8004126808dbb7696609372
Author: pschaum <41364203+***@...>
Date: 2018-07-18T09:50:30Z

Fix IllegalStateException in MixedGradient.java

After initialization of a MixedGradient both "hasZero" and "hasOne" are false, which leads to an IllegalStateException in the function "apply" if random.nextDouble() < alpha.

The proposed change would avoid this by using only the base gradient until both cases (actual == 0 and actual == 1) occured at least once.

----


---

Loading...