File tree Expand file tree Collapse file tree 9 files changed +33
-47
lines changed
Expand file tree Collapse file tree 9 files changed +33
-47
lines changed Original file line number Diff line number Diff line change @@ -136,14 +136,6 @@ console.log( accumulator() );
136136
137137<section class =" related " >
138138
139- * * *
140-
141- ## See Also
142-
143- - <span class =" package-name " >[ ` @stdlib/stats/incr/mrss ` ] [ @stdlib/stats/incr/mrss ] </span ><span class =" delimiter " >: </span ><span class =" description " >compute a moving residual sum of squares (RSS) incrementally.</span >
144- - <span class =" package-name " >[ ` @stdlib/stats/incr/mse ` ] [ @stdlib/stats/incr/mse ] </span ><span class =" delimiter " >: </span ><span class =" description " >compute the mean squared error (MSE) incrementally.</span >
145- - <span class =" package-name " >[ ` @stdlib/stats/incr/rmse ` ] [ @stdlib/stats/incr/rmse ] </span ><span class =" delimiter " >: </span ><span class =" description " >compute the root mean squared error (RMSE) incrementally.</span >
146-
147139</section >
148140
149141<!-- /.related -->
@@ -156,14 +148,8 @@ console.log( accumulator() );
156148
157149<!-- <related-links> -->
158150
159- [ @stdlib/stats/incr/mrss ] : https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/mrss
160-
161- [ @stdlib/stats/incr/mse ] : https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/mse
162-
163- [ @stdlib/stats/incr/rmse ] : https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/rmse
164-
165151<!-- </related-links> -->
166152
167153</section >
168154
169- <!-- /.links -->
155+ <!-- /.links -->
Original file line number Diff line number Diff line change @@ -66,4 +66,4 @@ bench( pkg+'::accumulator', function benchmark( b ) {
6666 }
6767 b . pass ( 'benchmark finished' ) ;
6868 b . end ( ) ;
69- } ) ;
69+ } ) ;
Original file line number Diff line number Diff line change @@ -57,4 +57,4 @@ declare function incrnanrss(): accumulator;
5757
5858// EXPORTS //
5959
60- export = incrnanrss ;
60+ export = incrnanrss ;
Original file line number Diff line number Diff line change @@ -66,4 +66,4 @@ import incrnanrss from './index';
6666 acc ( 3.14 , [ ] ) ; // $ExpectError
6767 acc ( 3.14 , { } ) ; // $ExpectError
6868 acc ( 3.14 , ( x : number ) : number => x ) ; // $ExpectError
69- }
69+ }
Original file line number Diff line number Diff line change @@ -33,14 +33,14 @@ accumulator = incrnanrss();
3333// For each simulated datum, update the residual sum of squares...
3434console . log ( '\nValue\tValue\tRSS\n' ) ;
3535for ( i = 0 ; i < 100 ; i ++ ) {
36- if ( randu ( ) < 0.2 ) {
36+ if ( randu ( ) < 0.2 ) {
3737 v1 = NaN ;
38- v2 = NaN ;
38+ v2 = NaN ;
3939 } else {
4040 v1 = ( randu ( ) * 100.0 ) - 50.0 ;
4141 v2 = ( randu ( ) * 100.0 ) - 50.0 ;
4242 }
4343 rss = accumulator ( v1 , v2 ) ;
4444 console . log ( '%d\t%d\t%d' , v1 . toFixed ( 3 ) , v2 . toFixed ( 3 ) , ( rss === null ) ? NaN : rss . toFixed ( 3 ) ) ;
4545}
46- console . log ( '\nFinal RSS: %d\n' , accumulator ( ) ) ;
46+ console . log ( '\nFinal RSS: %d\n' , accumulator ( ) ) ;
Original file line number Diff line number Diff line change 3333*
3434* r = accumulator( 2.0, 3.0 );
3535* // returns 1.0
36- *
36+ *
3737* r = accumulator( 1.0, NaN );
3838* // returns 1.0
3939*
@@ -51,4 +51,4 @@ var main = require( './main.js' );
5151
5252// EXPORTS //
5353
54- module . exports = main ;
54+ module . exports = main ;
Original file line number Diff line number Diff line change 1515 * See the License for the specific language governing permissions and
1616 * limitations under the License.
1717 */
18-
19- 'use strict' ;
20-
21- // MODULES //
22-
23- var incrrss = require ( '@stdlib/stats/incr/rss' ) ;
24- var isnan = require ( '@stdlib/math/base/assert/is-nan' ) ;
25-
26-
27- // MAIN //
28-
29- /**
18+
19+ 'use strict' ;
20+
21+ // MODULES //
22+
23+ var incrrss = require ( '@stdlib/stats/incr/rss' ) ;
24+ var isnan = require ( '@stdlib/math/base/assert/is-nan' ) ;
25+
26+
27+ // MAIN //
28+
29+ /**
3030 * Returns an accumulator function which incrementally computes the residual sum of squares, ignoring `NaN` values.
3131 *
3232 * @returns {Function } accumulator function
3939 *
4040 * r = accumulator( 2.0, 3.0 );
4141 * // returns 1.0
42- *
42+ *
4343 * r = accumulator( 1.0, NaN );
4444 * // returns 1.0
4545 *
4949 * r = accumulator();
5050 * // returns 50.0
5151 */
52- function incrnanrss ( ) {
52+ function incrnanrss ( ) {
5353 var rss = incrrss ( ) ;
5454 return accumulator ;
5555
7272
7373// EXPORTS //
7474
75- module . exports = incrnanrss ;
75+ module . exports = incrnanrss ;
Original file line number Diff line number Diff line change 8181 " distance" ,
8282 " dist"
8383 ]
84- }
84+ }
Original file line number Diff line number Diff line change @@ -64,9 +64,9 @@ tape( 'the accumulator function incrementally computes the residual sum of squar
6464 [ 2.0 , 3.0 ] ,
6565 [ 3.0 , - 1.0 ] ,
6666 [ 2.0 , 5.0 ] ,
67- [ 1.0 , NaN ] ,
67+ [ 1.0 , NaN ] ,
6868 [ 4.0 , - 4.0 ] ,
69- [ NaN , 2.0 ] ,
69+ [ NaN , 2.0 ] ,
7070 [ 3.0 , 0.0 ] ,
7171 [ - 4.0 , 5.0 ]
7272 ] ;
@@ -78,10 +78,10 @@ tape( 'the accumulator function incrementally computes the residual sum of squar
7878 for ( i = 0 ; i < N ; i ++ ) {
7979 x = data [ i ] [ 0 ] ;
8080 y = data [ i ] [ 1 ] ;
81- if ( isnan ( x ) === false && isnan ( y ) === false ) {
82- r = y - x ;
81+ if ( isnan ( x ) === false && isnan ( y ) === false ) {
82+ r = y - x ;
8383 sum += r * r ;
84- }
84+ }
8585 expected = sum ;
8686 actual = acc ( x , y ) ;
8787 if ( actual === expected ) {
@@ -106,9 +106,9 @@ tape( 'if not provided an input value, the accumulator function returns the curr
106106
107107 data = [
108108 [ 2.0 , 3.0 ] ,
109- [ 1.0 , NaN ] ,
109+ [ 1.0 , NaN ] ,
110110 [ 3.0 , - 5.0 ] ,
111- [ NaN , 2.0 ] ,
111+ [ NaN , 2.0 ] ,
112112 [ 1.0 , 10.0 ]
113113 ] ;
114114 acc = incrnanrss ( ) ;
@@ -121,4 +121,4 @@ tape( 'if not provided an input value, the accumulator function returns the curr
121121 tol = 1.0 * EPS * abs ( expected ) ;
122122 t . equal ( delta <= tol , true , 'within tolerance. Actual: ' + actual + '. Expected: ' + expected + '. Delta: ' + delta + '. Tol: ' + tol + '.' ) ;
123123 t . end ( ) ;
124- } ) ;
124+ } ) ;
You can’t perform that action at this time.
0 commit comments