svemnet 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
svemnet/__init__.py ADDED
@@ -0,0 +1,89 @@
1
+ """svemnet: Self-Validated Ensemble Models (SVEM) for Python.
2
+
3
+ Gaussian SVEM regression for small-sample design-of-experiments workflows:
4
+ SVEM lasso / elastic net (:func:`fit_svem`) and SVEM forward selection
5
+ (:func:`fit_svem_forward`), tuned per bootstrap by validation-weighted
6
+ information criteria, plus a deterministic forward-AICc benchmark
7
+ (:func:`forward_select`).
8
+
9
+ Interfaces
10
+ ----------
11
+ * Matrix API: :func:`fit_svem`, :func:`fit_svem_forward`,
12
+ :func:`forward_select` on numeric arrays.
13
+ * scikit-learn API: :class:`SVEMRegressor` for pipelines and
14
+ cross-validation.
15
+ * Formula API (optional, ``pip install svemnet[formula]``): :func:`svem` and
16
+ :func:`forward_aicc` on DataFrames with R-style formulas, mirroring the R
17
+ package SVEMnet.
18
+
19
+ References
20
+ ----------
21
+ Lemkus, Gotwalt, Ramsey, and Weese (2021), "Self-Validated Ensemble Models
22
+ for Design of Experiments", Chemometrics and Intelligent Laboratory Systems,
23
+ doi:10.1016/j.chemolab.2021.104439. Karl (2024), doi:10.1016/j.chemolab.2024.105122.
24
+ Karl (2026), "SVEMnet: ...", Chemometrics and Intelligent Laboratory Systems,
25
+ doi:10.1016/j.chemolab.2026.105660. R package: https://CRAN.R-project.org/package=SVEMnet
26
+ """
27
+
28
+ from __future__ import annotations
29
+
30
+ from .core import (
31
+ SVEMGaussianResult,
32
+ fit_svem,
33
+ kish_effective_n,
34
+ make_svem_weights,
35
+ predict_svem,
36
+ support_size,
37
+ weighted_ic_scores,
38
+ )
39
+ from .estimator import SVEMRegressor
40
+ from .expansion import response_surface_formula
41
+ from .forward import (
42
+ ForwardICResult,
43
+ SVEMForwardResult,
44
+ fit_svem_forward,
45
+ forward_select,
46
+ )
47
+
48
+ __version__ = "0.1.0"
49
+
50
+ # The formula-interface names (svem, forward_aicc, SVEMFormulaModel,
51
+ # ForwardAICcModel) are provided lazily via __getattr__ and deliberately
52
+ # excluded from __all__ so `from svemnet import *` works on installs
53
+ # without the [formula] extra.
54
+ __all__ = [
55
+ "SVEMGaussianResult",
56
+ "SVEMForwardResult",
57
+ "ForwardICResult",
58
+ "SVEMRegressor",
59
+ "fit_svem",
60
+ "fit_svem_forward",
61
+ "forward_select",
62
+ "predict_svem",
63
+ "make_svem_weights",
64
+ "kish_effective_n",
65
+ "support_size",
66
+ "weighted_ic_scores",
67
+ "response_surface_formula",
68
+ "__version__",
69
+ ]
70
+
71
+ _FORMULA_EXPORTS = {"svem", "forward_aicc", "SVEMFormulaModel", "ForwardAICcModel"}
72
+
73
+
74
+ def __getattr__(name: str):
75
+ if name in _FORMULA_EXPORTS:
76
+ try:
77
+ from . import formula as _formula
78
+ except ImportError as exc:
79
+ raise AttributeError(
80
+ f"svemnet.{name} requires the optional formula dependencies "
81
+ "(formulaic, pandas). Install them with: "
82
+ "pip install svemnet[formula]"
83
+ ) from exc
84
+ return getattr(_formula, name)
85
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
86
+
87
+
88
+ def __dir__():
89
+ return sorted(set(globals()) | _FORMULA_EXPORTS)