Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions lib/node_modules/@stdlib/stats/incr/nanmmse/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// MODULES //

var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
var incrmmean = require( '@stdlib/stats/incr/mmean' );
var incrmmse = require( '@stdlib/stats/incr/mmse' );
var format = require( '@stdlib/string/format' );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This module is not being used so you can remove it.

var isnan = require( '@stdlib/math/base/assert/is-nan' );

Expand Down Expand Up @@ -63,11 +63,11 @@ var isnan = require( '@stdlib/math/base/assert/is-nan' );
* // returns 33.0
*/
function incrnanmmse( W ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to create a thin wrapper around the @stdlib/stats/incr/mmse. So there is no need to implement it from scratch.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @hrshya, i have styled as per your request, please review.

var mean;
var mmse;
if ( !isPositiveInteger( W ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition is being handled in mmse so there is no need to check it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hrshya its also done, thanks for the review

throw new TypeError( format( 'invalid argument. Must provide a positive integer. Value: `%s`.', W ) );
}
mean = incrmmean( W );
mmse = incrmmse( W );
return accumulator;

/**
Expand All @@ -79,12 +79,10 @@ function incrnanmmse( W ) {
* @returns {(number|null)} mean squared error or null
*/
function accumulator( x, y ) {
var r;
if ( arguments.length === 0 || isnan( x ) || isnan( y ) ) {
return mean();
return mmse();
}
r = y - x;
return mean( r*r );
return mmse( x, y );
}
}

Expand Down
Loading