coremat 0.9.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.
- coremat/__init__.py +200 -0
- coremat/cli.py +938 -0
- coremat/config/__init__.py +37 -0
- coremat/config/config.py +5 -0
- coremat/config/settings.py +54 -0
- coremat/config/types.py +10 -0
- coremat/core/__init__.py +17 -0
- coremat/core/config/__init__.py +46 -0
- coremat/core/config/config.py +17 -0
- coremat/core/config/defaults.yaml +264 -0
- coremat/core/config/evaluation.py +84 -0
- coremat/core/config/framework.py +27 -0
- coremat/core/config/loader.py +483 -0
- coremat/core/config/models.py +237 -0
- coremat/core/config/paths.py +54 -0
- coremat/core/config/preprocessing.py +70 -0
- coremat/core/config/presets/fast.yaml +35 -0
- coremat/core/config/presets/full.yaml +29 -0
- coremat/core/config/run.py +12 -0
- coremat/core/config/training.py +116 -0
- coremat/core/config/transforms.py +52 -0
- coremat/core/config/types.py +10 -0
- coremat/core/constants.py +82 -0
- coremat/core/metrics.py +416 -0
- coremat/core/types/__init__.py +36 -0
- coremat/core/types/enums.py +32 -0
- coremat/core/types/policies.py +53 -0
- coremat/core/types/scalers.py +38 -0
- coremat/data/__init__.py +0 -0
- coremat/data/generator.py +186 -0
- coremat/design/__init__.py +61 -0
- coremat/design/assets/cdma-black.svg +1 -0
- coremat/design/assets/cdma-blue.svg +1 -0
- coremat/design/assets/cdma-mark-black.png +0 -0
- coremat/design/assets/cdma-mark-blue.png +0 -0
- coremat/design/assets/cdma-mark-orange.png +0 -0
- coremat/design/assets/cdma-mark-white.png +0 -0
- coremat/design/assets/cdma-negative.svg +1 -0
- coremat/design/assets/cdma-positive.png +0 -0
- coremat/design/assets/cdma-positive.svg +1 -0
- coremat/design/assets/cdma-white.svg +1 -0
- coremat/design/palettes.json +98 -0
- coremat/design/tokens.css +114 -0
- coremat/design/tokens.json +267 -0
- coremat/design/tokens.py +75 -0
- coremat/evallab/__init__.py +7 -0
- coremat/evallab/base.py +140 -0
- coremat/evallab/comparison_report/__init__.py +17 -0
- coremat/evallab/comparison_report/discovery.py +213 -0
- coremat/evallab/comparison_report/ecdf_view.py +481 -0
- coremat/evallab/comparison_report/ensemble_view.py +225 -0
- coremat/evallab/comparison_report/oom_bars_view.py +114 -0
- coremat/evallab/comparison_report/report.py +442 -0
- coremat/evallab/comparison_report/trajectory_view.py +336 -0
- coremat/evallab/eda_report/__init__.py +234 -0
- coremat/evallab/eda_report/__main__.py +101 -0
- coremat/evallab/eda_report/loader.py +157 -0
- coremat/evallab/eda_report/plots.py +2120 -0
- coremat/evallab/eda_report/report.py +362 -0
- coremat/evallab/eda_report/style.py +71 -0
- coremat/evallab/ensemble.py +438 -0
- coremat/evallab/ensemble_artifact.py +316 -0
- coremat/evallab/ensemble_report/__init__.py +908 -0
- coremat/evallab/evaluation.py +1015 -0
- coremat/evallab/export_predictor/__init__.py +15 -0
- coremat/evallab/export_predictor/ensemble_generator.py +498 -0
- coremat/evallab/export_predictor/generator.py +1039 -0
- coremat/evallab/model_report/__init__.py +573 -0
- coremat/evallab/model_report/__main__.py +121 -0
- coremat/evallab/model_report/importance_plots.py +410 -0
- coremat/evallab/model_report/loader.py +564 -0
- coremat/evallab/model_report/plots.py +2543 -0
- coremat/evallab/model_report/report.py +3477 -0
- coremat/evallab/model_report/reproduction.py +554 -0
- coremat/evallab/model_report/shap_plots.py +811 -0
- coremat/evallab/outlier_report/__init__.py +5 -0
- coremat/evallab/outlier_report/outliers.py +264 -0
- coremat/evallab/outlier_report/outliers_core.py +235 -0
- coremat/evallab/reports/__init__.py +15 -0
- coremat/preplab/__init__.py +12 -0
- coremat/preplab/features/__init__.py +0 -0
- coremat/preplab/preprocessing/__init__.py +20 -0
- coremat/preplab/preprocessing/custom_preprocessor.py +473 -0
- coremat/preplab/preprocessing/dataframe_pipeline.py +473 -0
- coremat/preplab/preprocessing/preprocess_policy.py +6 -0
- coremat/preplab/preprocessing/transformers.py +212 -0
- coremat/preplab/ui/__init__.py +0 -0
- coremat/py.typed +0 -0
- coremat/runtime/__init__.py +21 -0
- coremat/runtime/cuda.py +59 -0
- coremat/runtime/eval_runner.py +17 -0
- coremat/runtime/evaluator.py +194 -0
- coremat/runtime/train_runner.py +17 -0
- coremat/runtime/trainer.py +796 -0
- coremat/shared/__init__.py +35 -0
- coremat/shared/heartbeat.py +135 -0
- coremat/shared/logging_config.py +139 -0
- coremat/shared/safe_scaler.py +153 -0
- coremat/shared/status_reporter.py +202 -0
- coremat/shared/step_runner.py +71 -0
- coremat/shared/utils.py +422 -0
- coremat/shared/utils_paths.py +38 -0
- coremat/trainlab/__init__.py +27 -0
- coremat/trainlab/debug_pipeline.py +807 -0
- coremat/trainlab/feature_importance.py +786 -0
- coremat/trainlab/feature_selector.py +193 -0
- coremat/trainlab/models/__init__.py +36 -0
- coremat/trainlab/models/__main__.py +84 -0
- coremat/trainlab/models/boost_catboost.py +437 -0
- coremat/trainlab/models/boost_lgbm.py +480 -0
- coremat/trainlab/models/boost_xgb.py +167 -0
- coremat/trainlab/models/cd.py +226 -0
- coremat/trainlab/models/foundation.py +370 -0
- coremat/trainlab/models/gp.py +189 -0
- coremat/trainlab/models/group_preambles.py +161 -0
- coremat/trainlab/models/kernel.py +370 -0
- coremat/trainlab/models/linear.py +967 -0
- coremat/trainlab/models/neighbors.py +156 -0
- coremat/trainlab/models/neuronal_net.py +721 -0
- coremat/trainlab/models/registry.py +14 -0
- coremat/trainlab/models/tree.py +277 -0
- coremat/trainlab/recommend.py +206 -0
- coremat/trainlab/registry.py +420 -0
- coremat/trainlab/report_view.py +134 -0
- coremat/trainlab/reporting.py +903 -0
- coremat/trainlab/shap_runner.py +1816 -0
- coremat/trainlab/splitter.py +118 -0
- coremat/trainlab/train.py +1972 -0
- coremat/trainlab/train_test_split.py +1183 -0
- coremat/trainlab/transforms.py +242 -0
- coremat-0.9.0.dist-info/METADATA +165 -0
- coremat-0.9.0.dist-info/RECORD +136 -0
- coremat-0.9.0.dist-info/WHEEL +5 -0
- coremat-0.9.0.dist-info/entry_points.txt +4 -0
- coremat-0.9.0.dist-info/licenses/LICENSE +21 -0
- coremat-0.9.0.dist-info/top_level.txt +1 -0
coremat/__init__.py
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"""
|
|
2
|
+
COREMat Framework -- Public API
|
|
3
|
+
================================
|
|
4
|
+
|
|
5
|
+
COREMat (COmputable REgression for Materials) is a Python framework for
|
|
6
|
+
tabular machine learning covering the full workflow from raw data to
|
|
7
|
+
predictions and evaluation.
|
|
8
|
+
|
|
9
|
+
Quick Start::
|
|
10
|
+
|
|
11
|
+
from coremat import ModelTrainer, FrameworkConfig, PathsConfig
|
|
12
|
+
|
|
13
|
+
All heavy dependencies (scikit-learn, optuna, tabpfn, shapiq, torch) are
|
|
14
|
+
imported lazily so that ``import coremat`` is fast and lightweight.
|
|
15
|
+
|
|
16
|
+
Exports
|
|
17
|
+
-------
|
|
18
|
+
Configuration (always available):
|
|
19
|
+
FrameworkConfig, PathsConfig, DataPreprocessingConfig, PreprocessSettings,
|
|
20
|
+
TrainConfig, OptunaConfig, ModelsConfig, ModelRunOverride, ResolvedModelConfig,
|
|
21
|
+
TransformConfig, EvalConfig, RunConfig
|
|
22
|
+
|
|
23
|
+
Types (always available):
|
|
24
|
+
PreprocessPolicy
|
|
25
|
+
|
|
26
|
+
Training (lazy):
|
|
27
|
+
ModelTrainer
|
|
28
|
+
|
|
29
|
+
Preprocessing (lazy):
|
|
30
|
+
CustomPreprocessor, DataframePreprocessingPipeline
|
|
31
|
+
|
|
32
|
+
Evaluation (lazy):
|
|
33
|
+
compute_metrics
|
|
34
|
+
|
|
35
|
+
Registry (lazy):
|
|
36
|
+
ModelSpec, get_model_spec
|
|
37
|
+
|
|
38
|
+
Runtime (lazy):
|
|
39
|
+
run_training, run_evaluation
|
|
40
|
+
"""
|
|
41
|
+
from __future__ import annotations
|
|
42
|
+
|
|
43
|
+
import importlib
|
|
44
|
+
|
|
45
|
+
# ---------------------------------------------------------------------------
|
|
46
|
+
# Version -- derived from installed package metadata (setuptools-scm)
|
|
47
|
+
# ---------------------------------------------------------------------------
|
|
48
|
+
from importlib.metadata import PackageNotFoundError
|
|
49
|
+
from importlib.metadata import version as _metadata_version
|
|
50
|
+
from typing import TYPE_CHECKING, Any
|
|
51
|
+
|
|
52
|
+
try:
|
|
53
|
+
__version__: str = _metadata_version("coremat")
|
|
54
|
+
except PackageNotFoundError:
|
|
55
|
+
__version__ = "unknown"
|
|
56
|
+
|
|
57
|
+
# ---------------------------------------------------------------------------
|
|
58
|
+
# Lightweight config imports (dataclasses only, no heavy deps)
|
|
59
|
+
# ---------------------------------------------------------------------------
|
|
60
|
+
from .core.config import (
|
|
61
|
+
DataPreprocessingConfig,
|
|
62
|
+
EvalConfig,
|
|
63
|
+
FrameworkConfig,
|
|
64
|
+
ModelRunOverride,
|
|
65
|
+
ModelsConfig,
|
|
66
|
+
OptunaConfig,
|
|
67
|
+
PathsConfig,
|
|
68
|
+
PreprocessSettings,
|
|
69
|
+
ResolvedModelConfig,
|
|
70
|
+
RunConfig,
|
|
71
|
+
TrainConfig,
|
|
72
|
+
TransformConfig,
|
|
73
|
+
)
|
|
74
|
+
from .core.types import PreprocessPolicy
|
|
75
|
+
|
|
76
|
+
# ---------------------------------------------------------------------------
|
|
77
|
+
# __all__ -- defines the public API surface
|
|
78
|
+
# ---------------------------------------------------------------------------
|
|
79
|
+
__all__ = [
|
|
80
|
+
# Metadata
|
|
81
|
+
"__version__",
|
|
82
|
+
# Configuration dataclasses
|
|
83
|
+
"FrameworkConfig",
|
|
84
|
+
"PathsConfig",
|
|
85
|
+
"DataPreprocessingConfig",
|
|
86
|
+
"PreprocessSettings",
|
|
87
|
+
"TrainConfig",
|
|
88
|
+
"OptunaConfig",
|
|
89
|
+
"ModelsConfig",
|
|
90
|
+
"ModelRunOverride",
|
|
91
|
+
"ResolvedModelConfig",
|
|
92
|
+
"TransformConfig",
|
|
93
|
+
"EvalConfig",
|
|
94
|
+
"RunConfig",
|
|
95
|
+
# Core types
|
|
96
|
+
"PreprocessPolicy",
|
|
97
|
+
# Training (lazy)
|
|
98
|
+
"ModelTrainer",
|
|
99
|
+
# Preprocessing (lazy)
|
|
100
|
+
"CustomPreprocessor",
|
|
101
|
+
"DataframePreprocessingPipeline",
|
|
102
|
+
# Evaluation (lazy)
|
|
103
|
+
"compute_metrics",
|
|
104
|
+
# Registry (lazy) — custom-model extension point (#141)
|
|
105
|
+
"ModelSpec",
|
|
106
|
+
"get_model_spec",
|
|
107
|
+
"register",
|
|
108
|
+
"model_description",
|
|
109
|
+
# Recommend (lazy)
|
|
110
|
+
"recommend",
|
|
111
|
+
"RecommendResult",
|
|
112
|
+
# Runtime (lazy)
|
|
113
|
+
"run_training",
|
|
114
|
+
"run_evaluation",
|
|
115
|
+
]
|
|
116
|
+
|
|
117
|
+
# ---------------------------------------------------------------------------
|
|
118
|
+
# Lazy imports -- heavy modules are only loaded on first access
|
|
119
|
+
# ---------------------------------------------------------------------------
|
|
120
|
+
# Mapping from attribute name to (module_path, attribute_name)
|
|
121
|
+
_LAZY_IMPORTS: dict[str, tuple[str, str]] = {
|
|
122
|
+
# Training
|
|
123
|
+
"ModelTrainer": (".trainlab.train", "ModelTrainer"),
|
|
124
|
+
# Preprocessing
|
|
125
|
+
"CustomPreprocessor": (".preplab.preprocessing", "CustomPreprocessor"),
|
|
126
|
+
"DataframePreprocessingPipeline": (
|
|
127
|
+
".preplab.preprocessing",
|
|
128
|
+
"DataframePreprocessingPipeline",
|
|
129
|
+
),
|
|
130
|
+
# Evaluation
|
|
131
|
+
"compute_metrics": (".evallab.evaluation", "compute_metrics"),
|
|
132
|
+
# Registry
|
|
133
|
+
"ModelSpec": (".trainlab.registry", "ModelSpec"),
|
|
134
|
+
"get_model_spec": (".trainlab.registry", "get_model_spec"),
|
|
135
|
+
"register": (".trainlab.registry", "register"),
|
|
136
|
+
"model_description": (".trainlab.registry", "model_description"),
|
|
137
|
+
# Recommend
|
|
138
|
+
"recommend": (".trainlab.recommend", "recommend"),
|
|
139
|
+
"RecommendResult": (".trainlab.recommend", "RecommendResult"),
|
|
140
|
+
# Runtime
|
|
141
|
+
"run_training": (".runtime.train_runner", "run_training"),
|
|
142
|
+
"run_evaluation": (".runtime.eval_runner", "run_evaluation"),
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if TYPE_CHECKING:
|
|
146
|
+
# Provide static type information for lazy imports
|
|
147
|
+
from .evallab.evaluation import compute_metrics as compute_metrics
|
|
148
|
+
from .preplab.preprocessing import (
|
|
149
|
+
CustomPreprocessor as CustomPreprocessor,
|
|
150
|
+
)
|
|
151
|
+
from .preplab.preprocessing import (
|
|
152
|
+
DataframePreprocessingPipeline as DataframePreprocessingPipeline,
|
|
153
|
+
)
|
|
154
|
+
from .runtime.eval_runner import run_evaluation as run_evaluation
|
|
155
|
+
from .runtime.train_runner import run_training as run_training
|
|
156
|
+
from .trainlab.recommend import (
|
|
157
|
+
RecommendResult as RecommendResult,
|
|
158
|
+
)
|
|
159
|
+
from .trainlab.recommend import (
|
|
160
|
+
recommend as recommend,
|
|
161
|
+
)
|
|
162
|
+
from .trainlab.registry import (
|
|
163
|
+
ModelSpec as ModelSpec,
|
|
164
|
+
)
|
|
165
|
+
from .trainlab.registry import (
|
|
166
|
+
get_model_spec as get_model_spec,
|
|
167
|
+
)
|
|
168
|
+
from .trainlab.registry import (
|
|
169
|
+
model_description as model_description,
|
|
170
|
+
)
|
|
171
|
+
from .trainlab.registry import (
|
|
172
|
+
register as register,
|
|
173
|
+
)
|
|
174
|
+
from .trainlab.train import ModelTrainer as ModelTrainer
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def __getattr__(name: str) -> Any:
|
|
178
|
+
"""Lazy-load heavy modules on first attribute access.
|
|
179
|
+
|
|
180
|
+
This keeps ``import coremat`` fast by deferring imports of modules that
|
|
181
|
+
pull in scikit-learn, optuna, tabpfn, shapiq, or torch until they are
|
|
182
|
+
actually needed.
|
|
183
|
+
|
|
184
|
+
Args:
|
|
185
|
+
name: The attribute name being accessed.
|
|
186
|
+
|
|
187
|
+
Returns:
|
|
188
|
+
The lazily imported object.
|
|
189
|
+
|
|
190
|
+
Raises:
|
|
191
|
+
AttributeError: If *name* is not a public API member.
|
|
192
|
+
"""
|
|
193
|
+
if name in _LAZY_IMPORTS:
|
|
194
|
+
module_path, attr_name = _LAZY_IMPORTS[name]
|
|
195
|
+
module = importlib.import_module(module_path, package=__name__)
|
|
196
|
+
obj = getattr(module, attr_name)
|
|
197
|
+
# Cache on the module so __getattr__ is not called again
|
|
198
|
+
globals()[name] = obj
|
|
199
|
+
return obj
|
|
200
|
+
raise AttributeError(f"module 'coremat' has no attribute {name!r}")
|