[BUG]: missing multiplication in `_modifiedHuberLoss` implementation in `ml/incr/binary-classification`
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- javascript
- Domain
- machine-learning
Research direction
Read lib/node_modules/@stdlib/ml/incr/binary-classification/lib/model.js, starting at Model.prototype._modifiedHuberLoss, and compare the else branch with the expected gradient and referenced implementations. Done means the implementation applies the proposed factor of 2 consistently with the stated derivative and preserves the existing behavior of the other branch.
Written by the indexing model from the issue text.
Description
Description
I was going through the wikipedia pages as well as other library implementations of loss functions to implement standalone loss functions and their gradients under ml/base/loss/float64/*.
I noticed a possible bug in _modifiedHuberLoss function implemented under ml/incr/binary-classification
Current implementation:
setReadOnly( Model.prototype, '_modifiedHuberLoss', function modifiedHuber( x, y ) {
var eta;
var d;
eta = this[ this._learningRateMethod ]();
this._regularize( eta );
d = y * this._dot( x.data, x.strides[ 0 ], x.offset );
if ( d < -1.0 ) {
this._add( x, 4.0*eta*y );
} else {
this._add( x, eta*( y-(d*y) ) );
}
return this;
});
I believe in the else branch, it should be this._add( x, eta*2*( y-(d*y) ) ) instead of this._add( x, eta*( y-(d*y) ) ). That is, it seems like it is missing a multiplication with 2 here.
cc: @Planeshifter
Related Issues
No response
Questions
No.
Demo
No response
Reproduction
- a
- b
- c
Expected Results
\frac{\partial \ell}{\partial p} =
\begin{cases}
-4y & \text{if } yp < -1 \\
-2y(1 - yp) & \text{if } -1 \le yp \le 1 \\
0 & \text{if } yp > 1
\end{cases}
Actual Results
Version
No response
Environments
N/A
Browser Version
No response
Node.js / npm Version
No response
Platform
No response
Checklist
- Read and understood the Code of Conduct.
- Searched for existing issues and pull requests.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 1.3k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 559
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from stdlib-js/stdlib
-
Good First Issue
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Good First Issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Good First Issue
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
Good First Issue
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
All issues in stdlib-js/stdlib
Similar issues
-
curation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
amponce/archive-movie-browser#186 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
clerk/javascript#9852 ·
-
bug p1 tools
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
factory-active factory-automatic task-bug-reproduction-cannot-reproduce task-identify-harness-labels-done task-identify-issue-type-done
Difficulty 2/5 1-3 hours Newbie friendliness 84/100