Skip to content

Commit 9fe0c6c

Browse files
author
minjk-bl
committed
Added RMSE for Statistics' Regression
1 parent f1ebe04 commit 9fe0c6c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

visualpython/html/m_stats/regression.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
<label><input type="checkbox" id="normTest" class="vp-state" checked><span>Residual Normality test</span></label>
7777
<label><input type="checkbox" id="histogram" class="vp-state" checked><span>Residual histogram</span></label>
7878
<label><input type="checkbox" id="scatterplot" class="vp-state" checked><span>Residual scatterplot</span></label>
79+
<label><input type="checkbox" id="rmse" class="vp-state" checked><span>RMSE</span></label>
7980
</div>
8081
</div>
8182
</div>

visualpython/js/m_stats/Regression.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ define([
5858
normTest: true,
5959
histogram: true,
6060
scatterplot: true,
61+
rmse: false,
6162
...this.state
6263
};
6364

@@ -259,7 +260,7 @@ define([
259260
// Multi-collinearity
260261
multiCollinearity,
261262
// Residual option
262-
statistics, normTest, histogram, scatterplot
263+
statistics, normTest, histogram, scatterplot, rmse,
263264
} = this.state;
264265
let codeList = [];
265266
let code = new com_String();
@@ -697,7 +698,7 @@ define([
697698
}
698699

699700
// Residual option
700-
if (statistics === true || normTest === true || histogram === true || scatterplot === true) {
701+
if (statistics === true || normTest === true || histogram === true || scatterplot === true || rmse === true) {
701702
let residualTitle = 'Residual'
702703
if (lastModelNum > 0) {
703704
residualTitle += ' - Model ' + lastModelNum;
@@ -768,6 +769,14 @@ define([
768769
code.appendLine(" plt.tight_layout()");
769770
code.append(" plt.show()");
770771
}
772+
if (rmse === true) {
773+
code.appendLine();
774+
code.appendLine();
775+
code.appendLine("# RMSE (Root Mean Squared Error)");
776+
code.appendLine("_rmse = np.sqrt(_result.mse_resid)");
777+
code.appendLine("display(Markdown('### RMSE (Root Mean Squared Error)'))");
778+
code.append("display(Markdown(f'RMSE: {_rmse}'))");
779+
}
771780
}
772781

773782
codeList.push(code.toString());

0 commit comments

Comments
 (0)