Skip to content

Commit 5095d9a

Browse files
chore: update package.json & README notes & example
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: passed - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 2b82801 commit 5095d9a

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

lib/node_modules/@stdlib/stats/incr/nanmpe/README.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The [mean percentage error][mean-percentage-error] is defined as
3333
```
3434

3535
<!-- <div class="equation" align="center" data-raw-text="\operatorname{MPE} = \frac{100}{n} \sum_{i=0}^{n-1} \frac{a_i - f_i}{a_i}" data-equation="eq:mean_percentage_error">
36-
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@2acedf866c9a4f1353af22f95780535612c5ee06/lib/node_modules/@stdlib/stats/incr/nampe/docs/img/equation_mean_percentage_error.svg" alt="Equation for the mean percentage error.">
36+
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@2acedf866c9a4f1353af22f95780535612c5ee06/lib/node_modules/@stdlib/stats/incr/nanmpe/docs/img/equation_mean_percentage_error.svg" alt="Equation for the mean percentage error.">
3737
<br>
3838
</div> -->
3939

@@ -95,8 +95,8 @@ m = accumulator();
9595

9696
## Notes
9797

98-
- Input values are **not** type checked. If provided `NaN`, the accumulated value is `NaN` for **all** future invocations **until** a non-`NaN` value pair is provided. If non-numeric inputs are possible, you are advised to type check and handle accordingly **before** passing the value to the accumulator function.
99-
- Note that if either `f` or `a` is `NaN`, the input value pair is **skipped** (i.e., the pair does not contribute to the accumulated value).
98+
- Input values are **not** type checked.If provided `NaN`, the value is ignored and the accumulator function returns the current [mean percentage error][mean-percentage-error] without updating the window. If non-numeric inputs are possible, you are advised to type check and handle accordingly **before** passing the value to the accumulator function.
99+
- If either `f` or `a` is `NaN`, the input value pair is **skipped** (i.e., the pair does not contribute to the accumulated value).
100100
- Be careful when interpreting the [mean percentage error][mean-percentage-error] as errors can cancel. This stated, that errors can cancel makes the [mean percentage error][mean-percentage-error] suitable for measuring the bias in forecasts.
101101
- **Warning**: the [mean percentage error][mean-percentage-error] is **not** suitable for intermittent demand patterns (i.e., when `a_i` is `0`). Interpretation is most straightforward when actual and forecast values are positive valued (e.g., number of widgets sold).
102102

@@ -112,21 +112,19 @@ m = accumulator();
112112

113113
```javascript
114114
var bernoulli = require( '@stdlib/random/base/bernoulli' );
115-
var randu = require( '@stdlib/random/base/randu' );
115+
var uniform = require( '@stdlib/random/base/uniform' );
116116
var incrnanmpe = require( '@stdlib/stats/incr/nanmpe' );
117117

118-
var accumulator;
119-
var v1;
120-
var v2;
121-
var i;
122-
123118
// Initialize an accumulator:
124-
accumulator = incrnanmpe();
119+
var accumulator = incrnanmpe();
125120

126121
// For each simulated datum, update the mean percentage error...
122+
var v1;
123+
var v2;
124+
var i;
127125
for ( i = 0; i < 100; i++ ) {
128-
v1 = ( bernoulli( 0.8 ) === 0 ) ? NaN : ( randu()*100.0 ) + 50.0;
129-
v2 = ( bernoulli( 0.8 ) === 0 ) ? NaN : ( randu()*100.0 ) + 50.0;
126+
v1 = ( bernoulli( 0.8 ) < 1 ) ? NaN : uniform( -50.0, 50.0 );
127+
v2 = ( bernoulli( 0.8 ) < 1 ) ? NaN : uniform( -50.0, 50.0 );
130128
accumulator( v1, v2 );
131129
}
132130
console.log( accumulator() );

lib/node_modules/@stdlib/stats/incr/nanmpe/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@
7373
"time series",
7474
"timeseries",
7575
"forecasting",
76-
"forecast"
76+
"forecast",
77+
"nan",
78+
"ignore"
7779
]
7880
}

0 commit comments

Comments
 (0)