Statistics and Machine Learning Toolbox: Reference

Complete specification of workbook controls, hyperparameter rules, capacity limits, published output schemas, diagnostic thresholds, tolerances, and troubleshooting.

← Statistics and Machine Learning Toolbox overview · Getting started · Modeling guide · Methods guide · Examples

Control panel reference

The Start sheet hosts global model execution controls in range Start!A5:B10:

Cell Control Name Data Type Default Value Allowed Values / Range Validation Rule Behavioral Impact
Start!B6 Active model String (List) customer_churn_logistic customer_churn_logistic, housing_regression_ridge, iris_clustering_kmeans, credit_default_tree, feature_pca Excel List validation bound to Start!D5:D10 Selects which dataset rows on Data are ingested and which scikit-learn estimator family is instantiated.
Start!B7 Test size Float 0.25 \(0.00 \le \text{Test size} < 0.50\) Numeric decimal input Proportion of active samples held out for testing. When \(> 0\), assigns samples to Train or Test partitions. Classification tasks use stratified holdout.
Start!B8 Random seed Integer 42 Integers \(\ge 0\) Numeric integer input Controls pseudo-random number generator for train/test splitting, cross-validation partitioning, k-means++ centroid seeding, and stochastic solvers.
Start!B9 CV folds Integer 3 Integers \(2 \le K \le 5\) Numeric integer input (clamped in runtime) Number of cross-validation partitions. Sets out-of-fold evaluation granularity. Clamped to minimum class count if minority count \(< K\).
Start!B10 Scale features String (List) Standard Standard, MinMax, None Excel List validation Normalization method applied to predictor columns before fitting.

Hyperparameter reference

Hyperparameters are configured on Model Config!A5:D20. Each parameter has strict boundary validation and automatic clamping:

Model ID Parameter Type Default Min Bound Max Bound Clamping & Fallback Behavior
customer_churn_logistic C Float 1.0 \(10^{-4}\) \(10^4\) Clamped to \([10^{-4}, 10^4]\); if invalid type, defaults to 1.0. Check 2 flags FAIL if unclamped input is out of bounds.
customer_churn_logistic max_iter Integer 200 \(10\) \(5000\) Clamped to \([10, 5000]\); if invalid type, defaults to 200.
housing_regression_ridge alpha Float 1.0 \(10^{-5}\) \(10^5\) Clamped to \([10^{-5}, 10^5]\); if invalid type, defaults to 1.0. Check 2 flags FAIL if out of bounds.
housing_regression_ridge max_iter Integer 1000 \(10\) \(5000\) Clamped to \([10, 5000]\); if invalid type, defaults to 1000.
iris_clustering_kmeans n_clusters Integer 3 \(2\) \(\min(n - 1, 10)\) Clamped to \([2, \min(n-1, 10)]\); defaults to 3. Check 2 flags FAIL if out of bounds.
iris_clustering_kmeans max_iter Integer 300 \(10\) \(5000\) Clamped to \([10, 5000]\); defaults to 300.
credit_default_tree max_depth Integer 3 \(1\) \(20\) Clamped to \([1, 20]\); defaults to 3. Check 2 flags FAIL if out of bounds.
feature_pca n_components Integer 2 \(1\) \(\min(n, p)\) Clamped to \([1, \min(n, p)]\); defaults to 2. Check 2 flags FAIL if out of bounds.

Input boundaries and capacity limits

The notebook ingests fixed worksheet bands defined via bf.ref(...):

Sheet Range Bound Name Capacity Limit Notes
Start!A5:B10 controls 5 control pairs Reads global switches.
Start!D5:H10 models 5 model definitions Model ID, Label, Task, Algorithm, Description.
Data!A5:G70 data Up to 65 observation rows Model, SampleID, 4 numeric features, Target.
Model Config!A5:D20 config 15 hyperparameter rows Model, Hyperparameter, Value, Description.

Capacity and runtime limits

  • Observation rows: The default reference band reads up to row 70 (approx. 65 observation rows across models). For larger datasets, extend the Data!A5:G... reference range in notebook.py and expand the workbook table.
  • Maximum recommended dataset size: 1,000 observations and 30 features for interactive browser recalculation.
  • Pyodide WebAssembly constraints: Execution runs within a single-threaded WebAssembly worker. CPU-intensive operations (such as fine-grained grid searches or deep trees on massive tables) should be partitioned or pre-computed.

Published output schemas

The Marimo reactive application exports four dataframes via bf.publish(), anchored to dedicated workbook ranges:

1. Results Summary (Results!A5:B16)

Cell Range Metric Label Value Type Description
A5:B5 Header String Metric, Value
A6:B6 Active model String Full descriptive model title.
A7:B7 Task String Machine learning task (Classification, Regression, Clustering, Decomposition).
A8:B8 Status String Solver status string (OPTIMAL).
A9:B9 Algorithm String Scikit-learn estimator class name.
A10:B10 Total samples Integer Number of observations evaluated (\(n\)).
A11:B11 Feature count Integer Number of predictor columns (\(p\)).
A12:B12 Primary metric Float (6 decimals) Task primary score (Accuracy, \(R^2\), Silhouette, Total Explained Variance).
A13:B13 Secondary metric Float (6 decimals) Task secondary score (F1 score, RMSE, Inertia, PC1 Explained Variance Ratio).
A14:B14 Tertiary metric Float (6 decimals) Task tertiary score (ROC-AUC, MAE, Calinski-Harabasz, PC2 Explained Variance Ratio).
A15:B15 CV score mean Float (6 decimals) Stratified or standard \(K\)-fold cross-validation arithmetic mean.
A16:B16 Scaling method String Normalization method applied (Standard, Minmax, None).

2. Results Coefficients & Importances (Results!D5:I16)

Features are sorted strictly descending by AbsImportance, with alphabetical tie-breaking on Feature:

Column Header Type Format Description
D Feature String Text Feature name (Feature1 through Feature4).
E Weight Float 0.000000 Signed regression coefficient, PCA loading, or cluster variance fraction.
F OddsRatio Float 0.0000 \(\exp(w_j)\) for logistic regression; 0.0 for other models.
G AbsImportance Float 0.000000 Absolute value \(|w_j|\) used for sorting and ranking.
H Rank Integer 0 Ranking index (\(1\) = highest importance).
I Significance String Text Category: High, Moderate, ClusterFeature, GiniImportance, PC1_Loading.

3. Predictions Table (Predictions!A5:F55)

Spills row-level inferences for all observations of the active model:

Column Header Type Description
A SampleID Integer / String Sample identifier from Data!B.
B Actual Numeric Ground truth target from Data!Target.
C Predicted Numeric Estimated class (\(0/1\)), price ($k), cluster label (\(0/1/2\)), or PC1 coordinate.
D Probability Float Classification probability \(P(y=1)\), regression residual (\(y - \hat{y}\)), cluster centroid distance, or PC2 coordinate.
E Split String Holdout partition assignment: Train or Test.
F Correct String Verification flag: YES, NO, Residual, ClusterAssigned, PCA.

4. Diagnostics Table (Diagnostics!A5:C25)

Spills the complete 7-check health report:

Column Header Type Allowed Values Description
A Check String Fixed check title Name of the diagnostic test.
B Severity String PASS, WARN, FAIL Standardized alert level.
C Detail String Text Specific quantitative values, thresholds, and diagnostic guidance.

Diagnostic check thresholds reference

The table below documents the exact evaluation rules and thresholds for all seven automated diagnostics:

Check Name Target Condition Evaluation Rule Severity
1. Data validation Sample sufficiency & missing data \(n > p\) and \(\sum \mathbf{1}_{\text{missing}} = 0\)
\(n > p\) and \(\sum \mathbf{1}_{\text{missing}} > 0\)
\(n \le p\)
PASS
WARN
FAIL
2. Convergence & configuration Estimator convergence & parameter bounds Solver status OPTIMAL and all hyperparameters within documented bounds
Solver failure or out-of-bounds parameter
PASS
FAIL
3. Model performance Viability threshold per task Classification: \(\text{Accuracy} \ge 0.80\)
Classification: \(0.65 \le \text{Accuracy} < 0.80\)
Classification: \(\text{Accuracy} < 0.65\)
Regression: \(R^2 \ge 0.80\)
Regression: \(0.60 \le R^2 < 0.80\)
Regression: \(R^2 < 0.60\)
Clustering: \(\text{Silhouette} \ge 0.40\)
Clustering: \(0.25 \le \text{Silhouette} < 0.40\)
Clustering: \(\text{Silhouette} < 0.25\)
PCA: \(\text{ExpVar} \ge 0.80\)
PCA: \(0.60 \le \text{ExpVar} < 0.80\)
PCA: \(\text{ExpVar} < 0.60\)
PASS
WARN
FAIL
PASS
WARN
FAIL
PASS
WARN
FAIL
PASS
WARN
FAIL
4. Generalization & stability Overfitting gap \(\|M_{\text{train}} - \bar{M}_{\text{CV}}\|\) Gap \(\le 0.15\)
\(0.15 < \text{Gap} \le 0.25\)
Gap \(> 0.25\)
(K-Means: min cluster size \(\ge 2\) = PASS, \(< 2\) = WARN)
(PCA: cumulative variance \(\ge 0.80\) = PASS, \(< 0.80\) = WARN)
PASS
WARN
FAIL
5. Multicollinearity & conditioning 2-norm condition number \(\kappa(\mathbf{X})\) \(\kappa < 30.0\)
\(30.0 \le \kappa < 100.0\)
\(\kappa \ge 100.0\)
PASS
WARN
FAIL
6. Target balance & residual normality Class balance or residual distribution Classification minority ratio \(\ge 25\%\)
Classification minority ratio \(10\% \le \rho < 25\%\)
Classification minority ratio \(< 10\%\)
Regression: Shapiro-Wilk \(p \ge 0.05\)
Regression: Shapiro-Wilk \(p < 0.05\)
Clustering: min/max cluster ratio \(\ge 0.30\)
Clustering: min/max cluster ratio \(< 0.30\)
PCA: Scree dominance confirmed
PASS
WARN
FAIL
PASS
WARN
PASS
WARN
PASS
7. Outlier detection Standardized residuals \(\|z\| > 2.5\sigma\) Outlier count \(= 0\)
Outlier count \(\in \{1, 2\}\)
Outlier count \(> 2\)
PASS
WARN
FAIL

Numerical tolerances and verification benchmarks

All numerical outputs are verified against scikit-learn standard benchmarks under Python 3.14 / Pyodide:

  • Float precision: Metrics are rounded to 6 decimal places on Results, probabilities to 4 decimal places, and regression currency predictions to 2 decimal places.
  • Sorting determinism: Feature ranking breaks identical absolute weights by ascending alphabetical feature name.
  • Validation tolerances:
    • Accuracy / F1 / ROC-AUC / \(R^2\): \(\pm 10^{-4}\)
    • Coefficients / Weights: \(\pm 10^{-4}\)
    • Cross-validation means: \(\pm 10^{-4}\)

Troubleshooting guide

Symptom / Warning Likely Cause Recommended Remediation
Diagnostic Check 1 flags FAIL Sample count is less than or equal to the number of features (\(n \le p\)). Add more observation rows to Data so that \(n > p\).
Diagnostic Check 2 flags FAIL A hyperparameter value on Model Config exceeds its mathematical safety bounds, or the solver exceeded max_iter. Check values on Model Config against the allowed bounds above (e.g., ensure \(C > 0\), \(\alpha > 0\), \(n_{\text{clusters}} \ge 2\)). Increase max_iter to \(500\) or \(1000\).
Diagnostic Check 4 flags FAIL (Generalization gap) Severe overfitting: training performance is high, but out-of-fold cross-validation drops sharply. For Decision Trees, decrease max_depth (e.g. from 3 to 1). For Logistic/Ridge, increase regularization (decrease \(C\) or increase \(\alpha\)). Enable Standard scaling.
Diagnostic Check 5 flags FAIL (\(\kappa \ge 100\)) Predictor features have widely differing scales or near-perfect collinearity. On Start!B10, change Scale features to Standard. If features are intrinsically redundant, remove collinear columns or switch to feature_pca.
Diagnostic Check 6 flags WARN / FAIL (Class balance) One class accounts for less than 25% (or 10%) of the observations. Rebalance the dataset by adding minority class examples or adjust decision threshold probabilities.
Diagnostic Check 7 flags WARN / FAIL (Outliers) One or more samples have standardized residuals \(|z| > 2.5\). Open the Predictions sheet, find rows with extreme residual/probability values, and verify the data integrity of those specific observations.
Dropdown does not show model options Excel data validation broken or overwritten. Restore data validation on Start!B6 bound to range Start!D5:D10.
#VALUE! or #REF! in output blocks The spill range was partially overwritten by manual cell entries. Clear any cells in Results!A5:B16, Results!D5:I16, Predictions!A5:F55, or Diagnostics!A5:C25 to allow the formulas to spill freely.