Modeling and MLflow
Use this sub-skill when the task is to train or inspect H2O AutoML workflows, evaluate a trained H2O model deterministically, manage MLflow experiments/runs/models with the package tools, or troubleshoot optional ML dependencies for ai-data-science-team.
Route here for
H2OMLAgent, make_h2o_ml_agent, and the train_h2o_automl LangChain tool.
- Dataset/target validation before H2O AutoML training and safe extraction of leaderboard, best model id, model path, generated function, recommended steps, and log summary.
- Deterministic holdout evaluation with
ModelEvaluationAgent, including classification metrics, regression metrics, confusion matrix, ROC curve when available, and residual plots.
MLflowToolsAgent, make_mlflow_tools_agent, and direct ai_data_science_team.tools.mlflow helpers for experiment/run search, logging, artifacts, prediction, model registry, and UI status.
- Optional dependency triage for
h2o, mlflow, Java/H2O runtime, local MLflow UI/process issues, and import-time notebook display helpers.
Route away
- For data loading, EDA summaries, and optional EDA reports before modeling, use the sibling
data-access-and-eda sub-skill.
- For feature engineering, generated pandas code, wrangling, cleaning, or visualization before training, use the sibling
dataframe-code-agents sub-skill.
- For supervisor teams, Streamlit apps, or cross-agent orchestration around modeling, use the sibling
multiagent-and-app-workflows sub-skill.
- For SQL-backed feature extraction, use the sibling
sql-analysis sub-skill first, then return here with a pandas DataFrame.
Safe operating defaults
- Treat H2O and MLflow as optional extras. Run the bundled optional import check before promising runtime availability.
- Do not launch the MLflow UI, kill UI processes, start H2O training, download artifacts, or write model/log artifacts unless the user explicitly asked for that side effect.
- Keep AutoML bounded with
max_runtime_secs, max_models, seed, and usually exclude_algos=["DeepLearning"] for quick local experiments.
- Prefer explicit
target_variable/target and verify the target exists, has non-null values, and has at least two classes for classification.
- Use local/disposable MLflow tracking locations for experiments unless the user provides and authorizes a remote tracking/registry URI.
- Never embed API keys, service tokens, tracking-server credentials, local environment prefixes, or absolute checkout paths in generated logs or reports.
Quick routes
Check optional ML readiness without side effects
python sub-skills/modeling-and-mlflow/scripts/check_ml_optional_imports.py
python sub-skills/modeling-and-mlflow/scripts/check_ml_optional_imports.py --inspect-public-apis --require h2o mlflow
The script only checks imports, package metadata, public signatures, and Java availability. It does not train, start H2O, launch MLflow, call an LLM, download data, or write artifacts.
Train with H2OMLAgent when the caller supplies an LLM
from ai_data_science_team.ml_agents import H2OMLAgent
llm = ... # caller-provided LangChain-compatible chat model
df = ... # pandas DataFrame already loaded and cleaned
agent = H2OMLAgent(
model=llm,
log=False,
model_directory=None,
enable_mlflow=False,
bypass_recommended_steps=True,
bypass_explain_code=True,
)
agent.invoke_agent(
data_raw=df,
target_variable="target",
user_instructions="Train a bounded H2O AutoML model; use max_models=3 and seed=42.",
)
leaderboard = agent.get_leaderboard()
best_model_id = agent.get_best_model_id()
model_path = agent.get_model_path()
Use workflows before enabling model saving, MLflow logging, human review, or large AutoML budgets.
Evaluate a trained H2O model deterministically
from langchain_core.messages import HumanMessage
from ai_data_science_team.ml_agents import ModelEvaluationAgent
model_artifacts = {
"model_path": agent.get_model_path(),
"best_model_id": agent.get_best_model_id(),
}
evaluator = ModelEvaluationAgent()
evaluator.invoke_messages(
[HumanMessage(content="Evaluate the trained model on a holdout split.")],
data_raw=df,
model_artifacts=model_artifacts,
target_variable="target",
test_size=0.2,
random_state=42,
)
artifacts = evaluator.get_eval_artifacts()
ModelEvaluationAgent does not need an LLM response to compute metrics, but it does need H2O available and a resolvable saved model path or H2O model id.
Inspect MLflow without natural-language tool calling
from ai_data_science_team.tools.mlflow import mlflow_tracking_info, mlflow_search_experiments
tracking_msg, tracking_artifact = mlflow_tracking_info.invoke({})
experiments_msg, experiments_artifact = mlflow_search_experiments.invoke({"filter_string": None})
Use the direct tools for deterministic scripting. Use MLflowToolsAgent only when the user wants natural-language MLflow operations and supplies an LLM.
References and bundled checks
- API reference: public imports, constructor signatures, response fields, and API boundaries.
- Workflows: H2O AutoML training, deterministic evaluation, H2O-to-MLflow logging, and validation patterns.
- MLflow tools: tool catalog, safe direct use, agent use, UI/process behavior, artifacts, prediction, and registry operations.
- Optional dependencies: extras, runtime expectations, Java/H2O notes, and dependency gates.
- Troubleshooting: symptoms, likely causes, and recovery steps for optional ML workflows.
- Optional import check: safe readiness checker with no LLM call, service launch, download, training, or destructive write.
1---2name: modeling-and-mlflow3description: "Operate ai-data-science-team H2O AutoML, deterministic model4 evaluation, MLflow tools, and optional ML dependency checks."5disable-model-invocation: true6metadata:7 source: https://skillmd.com/skills/vectorspacelab/modeling-and-mlflow8 disco-role: operating9license: MIT10---1112# Modeling and MLflow1314Use this sub-skill when the task is to train or inspect H2O AutoML workflows, evaluate a trained H2O model deterministically, manage MLflow experiments/runs/models with the package tools, or troubleshoot optional ML dependencies for `ai-data-science-team`.1516## Route here for1718- `H2OMLAgent`, `make_h2o_ml_agent`, and the `train_h2o_automl` LangChain tool.19- Dataset/target validation before H2O AutoML training and safe extraction of leaderboard, best model id, model path, generated function, recommended steps, and log summary.20- Deterministic holdout evaluation with `ModelEvaluationAgent`, including classification metrics, regression metrics, confusion matrix, ROC curve when available, and residual plots.21- `MLflowToolsAgent`, `make_mlflow_tools_agent`, and direct `ai_data_science_team.tools.mlflow` helpers for experiment/run search, logging, artifacts, prediction, model registry, and UI status.22- Optional dependency triage for `h2o`, `mlflow`, Java/H2O runtime, local MLflow UI/process issues, and import-time notebook display helpers.2324## Route away2526- For data loading, EDA summaries, and optional EDA reports before modeling, use the sibling `data-access-and-eda` sub-skill.27- For feature engineering, generated pandas code, wrangling, cleaning, or visualization before training, use the sibling `dataframe-code-agents` sub-skill.28- For supervisor teams, Streamlit apps, or cross-agent orchestration around modeling, use the sibling `multiagent-and-app-workflows` sub-skill.29- For SQL-backed feature extraction, use the sibling `sql-analysis` sub-skill first, then return here with a pandas DataFrame.3031## Safe operating defaults32331. Treat H2O and MLflow as optional extras. Run the bundled optional import check before promising runtime availability.342. Do not launch the MLflow UI, kill UI processes, start H2O training, download artifacts, or write model/log artifacts unless the user explicitly asked for that side effect.353. Keep AutoML bounded with `max_runtime_secs`, `max_models`, `seed`, and usually `exclude_algos=["DeepLearning"]` for quick local experiments.364. Prefer explicit `target_variable`/`target` and verify the target exists, has non-null values, and has at least two classes for classification.375. Use local/disposable MLflow tracking locations for experiments unless the user provides and authorizes a remote tracking/registry URI.386. Never embed API keys, service tokens, tracking-server credentials, local environment prefixes, or absolute checkout paths in generated logs or reports.3940## Quick routes4142### Check optional ML readiness without side effects4344```bash45python sub-skills/modeling-and-mlflow/scripts/check_ml_optional_imports.py46python sub-skills/modeling-and-mlflow/scripts/check_ml_optional_imports.py --inspect-public-apis --require h2o mlflow47```4849The script only checks imports, package metadata, public signatures, and Java availability. It does not train, start H2O, launch MLflow, call an LLM, download data, or write artifacts.5051### Train with H2OMLAgent when the caller supplies an LLM5253```python54from ai_data_science_team.ml_agents import H2OMLAgent5556llm = ... # caller-provided LangChain-compatible chat model57df = ... # pandas DataFrame already loaded and cleaned5859agent = H2OMLAgent(60 model=llm,61 log=False,62 model_directory=None,63 enable_mlflow=False,64 bypass_recommended_steps=True,65 bypass_explain_code=True,66)67agent.invoke_agent(68 data_raw=df,69 target_variable="target",70 user_instructions="Train a bounded H2O AutoML model; use max_models=3 and seed=42.",71)7273leaderboard = agent.get_leaderboard()74best_model_id = agent.get_best_model_id()75model_path = agent.get_model_path()76```7778Use [workflows](references/workflows.md) before enabling model saving, MLflow logging, human review, or large AutoML budgets.7980### Evaluate a trained H2O model deterministically8182```python83from langchain_core.messages import HumanMessage84from ai_data_science_team.ml_agents import ModelEvaluationAgent8586model_artifacts = {87 "model_path": agent.get_model_path(),88 "best_model_id": agent.get_best_model_id(),89}90evaluator = ModelEvaluationAgent()91evaluator.invoke_messages(92 [HumanMessage(content="Evaluate the trained model on a holdout split.")],93 data_raw=df,94 model_artifacts=model_artifacts,95 target_variable="target",96 test_size=0.2,97 random_state=42,98)99artifacts = evaluator.get_eval_artifacts()100```101102`ModelEvaluationAgent` does not need an LLM response to compute metrics, but it does need H2O available and a resolvable saved model path or H2O model id.103104### Inspect MLflow without natural-language tool calling105106```python107from ai_data_science_team.tools.mlflow import mlflow_tracking_info, mlflow_search_experiments108109tracking_msg, tracking_artifact = mlflow_tracking_info.invoke({})110experiments_msg, experiments_artifact = mlflow_search_experiments.invoke({"filter_string": None})111```112113Use the direct tools for deterministic scripting. Use `MLflowToolsAgent` only when the user wants natural-language MLflow operations and supplies an LLM.114115## References and bundled checks116117- [API reference](references/api-reference.md): public imports, constructor signatures, response fields, and API boundaries.118- [Workflows](references/workflows.md): H2O AutoML training, deterministic evaluation, H2O-to-MLflow logging, and validation patterns.119- [MLflow tools](references/mlflow-tools.md): tool catalog, safe direct use, agent use, UI/process behavior, artifacts, prediction, and registry operations.120- [Optional dependencies](references/optional-dependencies.md): extras, runtime expectations, Java/H2O notes, and dependency gates.121- [Troubleshooting](references/troubleshooting.md): symptoms, likely causes, and recovery steps for optional ML workflows.122- [Optional import check](scripts/check_ml_optional_imports.py): safe readiness checker with no LLM call, service launch, download, training, or destructive write.