KMDS Modeling
kmds-modeling is a lightweight supporting package for KMDS modeling workflows. It provides the runtime plumbing, evaluation orchestration, artifact export utilities, and modeling contract documentation needed to bridge KMDS feature outputs and production-ready model assets.
Overview
- Supports KMDS workspace modeling without embedding domain-specific business logic.
- Provides a generic
ExperimentRunnerengine for cross-validation, transformer orchestration, and candidate model evaluation. - Includes a CLI for standard evaluation and production export flows.
- Keeps workspace-specific examples and artifacts outside the installable package.
Key Features
- Config-driven modeling pipeline via YAML configuration files (e.g.
model_config.yaml) - Safe cross-validation with fold-specific transformer fitting
- Uniform candidate wrapper support for any model implementation
- Export of serialized model weights, feature pipeline, and metadata
- Path coordination for KMDS workspace layout handling
- Task contract documentation under
documents/modeling_contracts/
Installation
pip install kmds-modeling
Package discovery
Clients can discover runtime metadata using the package API or import installed package metadata.
from kmds_modeling import get_package_info
info = get_package_info()
print(info)
The discovery payload includes standard fields used across KMDS packages:
package_nameversionentry_pointscli_commandsprovided_packagesdocumentation_note
This package publishes the kmds-modeling console script entry point as:
kmds-modeling = "kmds_modeling.cli:cli"
Clients can inspect the loaded entry points at runtime using the package metadata:
from kmds_modeling import get_package_info
info = get_package_info()
print(info["entry_points"])
print(info["cli_commands"])
The package also exposes a spec discovery API for building a validated modeling configuration from minimal instructions.
from kmds_modeling import get_spec_questions, build_model_spec
requirements = {
"project": {"task_type": "TABULAR_CLASSIFICATION"},
"data": {"working_dir": "."},
}
questions = get_spec_questions(requirements)
print(questions)
# After supplying answers to the spec questions,
# build the final model config and write it to YAML.
spec = build_model_spec(requirements)
spec.to_yaml("model_config.yaml")
When the client provides modeling instructions that answer the required spec questions, this package can build the model spec and run the evaluation/export workflow to produce model artifacts.
When installed, the package can also be resolved via importlib.metadata:
from importlib.metadata import version
print(version("kmds-modeling"))
CLI
The package exposes a command-line interface for model evaluation and export.
kmds-modeling evaluate --config /path/to/modeling_config.yaml
kmds-modeling export --config /path/to/modeling_config.yaml
Configuration
The package expects a YAML configuration file that defines:
projectsettings such as name, version, task type, and target variabledatasettings including working directory, index column, and featurization pathsexperiment_settingsfor cross-validation and metricscandidateslisting candidate models and their hyperparametersproduction_targetfor champion export paths
The PathCoordinator resolves workspace-relative paths, including documents/modeling_contracts/, and ensures the package operates on KMDS-generated modeling artifacts.
Spec discovery and build
Clients can use the package's spec discovery API to ask what configuration items are still required and then build a complete model_config.yaml.
from kmds_modeling import get_spec_questions, build_model_spec
requirements = {
"project": {
"task_type": "TABULAR_CLASSIFICATION",
"target_variable": "label",
"user_intent": "Predict the probability of the positive class for business interventions.",
},
"data": {
"working_dir": ".",
},
}
questions = get_spec_questions(requirements)
for question in questions:
print(question["field"], question["question"])
# Supply the remaining answers and build the final model spec.
requirements.update({
"project": {
**requirements["project"],
"name": "customer_churn_classifier",
"strategy": "MAX_ACCURACY",
},
"candidates": [
{
"name": "random_forest",
"class_path": "my_models.RandomForestCandidate",
"hyperparameters": {"n_estimators": 100},
}
],
"production_target": {"champion_candidate_name": "random_forest"},
})
spec = build_model_spec(requirements)
spec.to_yaml("model_config.yaml")
When modeling instructions cover the returned spec questions, this package can build the model spec and then run the evaluation/export workflow to produce model artifacts.
Recommended Workflow
- Generate feature-engineered data with KMDS upstream tools such as
kmds-featurization. - Author a
modeling_config.yamlwith the correct workspace layout and candidate definitions. - Run
kmds-modeling evaluateto compare candidate models and generate a leaderboard. - Select the champion candidate and run
kmds-modeling exportto produce model artifacts.
Project Structure
src/kmds_modeling/— installable package sourcesrc/kmds_modeling/cli.py— CLI entrypointsrc/kmds_modeling/core/runner.py— evaluation and export orchestrationsrc/kmds_modeling/core/path_coordinator.py— workspace path resolutionsrc/kmds_modeling/core/notebook_utils.py— notebook-friendly utilitiesdocuments/modeling_contracts/— task contract documentation for KMDS modeling
Contribution Notes
- Keep core modeling logic generic and focused on KMDS pipeline support.
- Add workspace-specific examples or experimental workflows outside the installable source tree.
- Avoid coupling the package to any single KMDS project domain.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kmds_modeling-0.6.1.tar.gz.
File metadata
- Download URL: kmds_modeling-0.6.1.tar.gz
- Upload date:
- Size: 21.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a905767355901024caaf1fcc7d6c06442611518547d45fd47fd7f99601278c4
|
|
| MD5 |
c05753e3bd7e369ffcd17020eae84035
|
|
| BLAKE2b-256 |
17cea78a1900a7eab9c50e3aa2805cf4913b5a4abf795a984afa82749091b7d3
|
File details
Details for the file kmds_modeling-0.6.1-py3-none-any.whl.
File metadata
- Download URL: kmds_modeling-0.6.1-py3-none-any.whl
- Upload date:
- Size: 24.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bfbc682773312414766d1776e3af5b9f04ef0d9ae7afe9ee6454f187e00dbfd
|
|
| MD5 |
7c251dbe429a0714fe21019ca6f2ffea
|
|
| BLAKE2b-256 |
aba1a9237a979f862d7f6a43c129f4cda2fd44dad9c058265f9c95c7f63cb916
|