# Ensemble ML for soil

> Ensemble ML for soil is an open-source agent skill for health and science. Measures whether combining soil ML models can beat the best single model, and how. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/ccarbajal16/soil-dsm-skills/tree/main/plugins/dsm-soil/skills/ensemble-ml-for-soil
- **Repository:** https://github.com/ccarbajal16/soil-dsm-skills
- **GitHub stars:** 13
- **License:** MIT
- **Skill name:** ensemble-ml-for-soil
- **Collection:** https://github.com/ccarbajal16/soil-dsm-skills
- **Categories:** [health and science](https://ai-powered.com/categories/health-and-science)
- **Listing updated:** 2026-12-03

## About

This skill helps an agent decide whether an ensemble of machine-learning models is worth building for soil mapping before any combiner is fitted. It has the agent compute out-of-fold predictions under spatial cross-validation, examine how the base learners' errors correlate, and derive the ambiguity term that sets the ceiling on any possible gain from combining them. If that ceiling is negligible, the guidance is to keep the best single model.

When a combination is justified, the skill walks through a spectrum of weighting schemes, from simple and R²-weighted averages to full Bates-Granger, non-negative least squares, and unconstrained Granger-Ramanathan regression. Each combiner is meant to be cross-fitted so that the data choosing the weights never also scores them. It also covers voting for classification, testing whether a margin is statistically meaningful, and a separate use of several models to quantify how much an estimate depends on modelling choice.

The guidance is written around R with mlr3 and includes a runnable pipeline, the spatial fold helpers CAST, blockCV and mlr3spatiotempcv, and a reporting checklist. The skill ships as a single SKILL.md with no bundled scripts.

## When your agent uses it

> Decide whether to combine machine-learning models at all, and if so how — by measuring the gain available before building any combiner. Covers the ambiguity/diversity ceiling, the weighting spectrum (simple average, R²-weighted, Bates–Granger, AIC/BIC, NNLS/SuperLearner, Granger–Ramanathan, learned meta-models, attention, per-pixel selection), out-of-fold stacking under spatial CV, cross-fitting the combiner, voting for classification, and significance testing of the margin. Use when someone proposes an ensemble, reports an ensemble gain, or asks whether their averaging scheme is "too simple". Triggers: "ensemble machine learning", "model stacking", "stacked generalisation", "SuperLearner", "meta-learner", "meta-model", "weighted average ensemble", "R2-weighted ensemble", "simple average ensemble", "Bates-Granger", "Granger-Ramanathan", "NNLS weights", "non-negative least squares", "caretStack", "mlr3pipelines stacking", "voting ensemble", "hard voting", "soft voting", "blending", "bagging vs boosting vs stac

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/ccarbajal16/soil-dsm-skills/tree/HEAD/plugins/dsm-soil/skills/ensemble-ml-for-soil)
- [License: MIT](https://github.com/ccarbajal16/soil-dsm-skills/tree/HEAD/plugins/dsm-soil/skills/ensemble-ml-for-soil)

## Features

- **Ensemble gain ceiling:** Computes the ambiguity term from out-of-fold errors to estimate the maximum gain available before building a combiner.
- **Spatial out-of-fold stacking:** Builds out-of-fold prediction matrices using spatial block folds rather than random splits.
- **Weighting scheme comparison:** Compares simple, R²-weighted, Bates-Granger, NNLS and Granger-Ramanathan combiners under cross-fitting.
- **Error correlation diagnostics:** Examines correlations and covariance of base-learner errors to judge whether members add diversity.
- **Classification voting guidance:** Explains hard and soft voting and how they relate to regression averaging schemes.
- **Gain significance testing:** Describes Friedman and Nemenyi tests or repeated CV for checking whether an ensemble margin is real.

## Good for

- Check whether stacking my RF and XGBoost soil models is worth the effort
- Fit a cross-fitted Bates-Granger or NNLS combiner over spatial folds
- Review a paper's reported ensemble gain for evaluation leakage
- Decide whether to combine my soil model with SoilGrids per region
- Test whether a small accuracy margin between ensemble members is significant

## Install

### Claude Code

This skill ships in the `dsm-soil` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add ccarbajal16/soil-dsm-skills
/plugin install dsm-soil@soil-dsm-skills
```

Or copy only this skill to `~/.claude/skills/ensemble-ml-for-soil`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ccarbajal16/soil-dsm-skills.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/ensemble-ml-for-soil &&
cp -R "$tmp/plugins/dsm-soil/skills/ensemble-ml-for-soil" ~/.claude/skills/ensemble-ml-for-soil &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/ensemble-ml-for-soil` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/ensemble-ml-for-soil` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ccarbajal16/soil-dsm-skills.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/ensemble-ml-for-soil &&
cp -R "$tmp/plugins/dsm-soil/skills/ensemble-ml-for-soil" ~/.agents/skills/ensemble-ml-for-soil &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/ensemble-ml-for-soil` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/ensemble-ml-for-soil` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ccarbajal16/soil-dsm-skills.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/ensemble-ml-for-soil &&
cp -R "$tmp/plugins/dsm-soil/skills/ensemble-ml-for-soil" ~/.cursor/skills/ensemble-ml-for-soil &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/ensemble-ml-for-soil` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/ccarbajal16/soil-dsm-skills.git --path plugins/dsm-soil/skills/ensemble-ml-for-soil
```

Or copy the folder to `~/.gemini/skills/ensemble-ml-for-soil` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/ensemble-ml-for-soil`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ccarbajal16/soil-dsm-skills.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/ensemble-ml-for-soil &&
cp -R "$tmp/plugins/dsm-soil/skills/ensemble-ml-for-soil" ~/.copilot/skills/ensemble-ml-for-soil &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/ensemble-ml-for-soil` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/ccarbajal16/soil-dsm-skills.git
```

Then copy `soil-dsm-skills/plugins/dsm-soil/skills/ensemble-ml-for-soil` into your agent's skills folder as `ensemble-ml-for-soil`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does the skill need to run?

The guidance uses R 4.5.3 with mlr3 and the spatial fold packages CAST, blockCV or mlr3spatiotempcv. The skill folder includes only its SKILL.md file and no bundled scripts.

### Does Ensemble ML for soil recommend always using a stacked ensemble?

No. It first measures the ambiguity ceiling, and if the base learners barely disagree it says to ship the best single model instead.

### Which combiner does Ensemble ML for soil recommend?

It recommends a full Bates-Granger combiner, then NNLS, both cross-fitted. It advises against using a bare unconstrained lm() combiner.

### Does Ensemble ML for soil cover classification tasks?

Yes. It describes hard and soft voting as the classification counterparts of simple and weighted averaging, noting that soft voting needs calibrated probabilities.

### How do I install Ensemble ML for soil in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/ensemble-ml-for-soil to use it in all your projects, or to .claude/skills/ensemble-ml-for-soil in one project. Or install the dsm-soil plugin, which includes it: /plugin marketplace add ccarbajal16/soil-dsm-skills, then /plugin install dsm-soil@soil-dsm-skills.

### Does Ensemble ML for soil run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Ensemble ML for soil?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Ensemble ML for soil?

The closest alternatives to Ensemble ML for soil are ML for soil prediction, Soil map validation, Hybrid process ML soc, Soil fertility mapping and Digital soil mapping workflow.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [ML for soil prediction](https://ai-powered.com/skills/ml-for-soil-prediction): ML for soil prediction is an open-source agent skill for health and science.
- [Soil map validation](https://ai-powered.com/skills/soil-map-validation): Soil map validation is an open-source agent skill for health and science.
- [Hybrid process ML soc](https://ai-powered.com/skills/hybrid-process-ml-soc): Hybrid process ML soc is an open-source agent skill for health and science.
- [Soil fertility mapping](https://ai-powered.com/skills/soil-fertility-mapping): Soil fertility mapping is an open-source agent skill for health and science.
- [Digital soil mapping workflow](https://ai-powered.com/skills/digital-soil-mapping-workflow): Digital soil mapping workflow is an open-source agent skill for health and science.
- [Soil quality index](https://ai-powered.com/skills/soil-quality-index): Soil quality index is an open-source agent skill for health and science.
- [Soc stock mrv](https://ai-powered.com/skills/soc-stock-mrv): Soc stock mrv is an open-source agent skill for health and science.
- [Codonfm score](https://ai-powered.com/skills/codonfm-score): Codonfm score is an open-source agent skill for health and science.

---
Source: https://ai-powered.com/skills/ensemble-ml-for-soil
