# Xgboost Analysis

Use when building XGBoost models on tabular data and returning feature importance...

- Repository: https://github.com/aipoch/medical-research-skills (2020 stars)
- Category: Testing
- License: MIT
- Last updated: 2026-09-17
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add aipoch/medical-research-skills --skill xgboost-analysis -g -a claude-code -y`
Codex: `npx skills add aipoch/medical-research-skills --skill xgboost-analysis -g -a codex -y`
Cursor: `npx skills add aipoch/medical-research-skills --skill xgboost-analysis -g -a cursor -y`
Gemini CLI: `npx skills add aipoch/medical-research-skills --skill xgboost-analysis -g -a gemini-cli -y`

## Description

Use when building XGBoost models on tabular data and returning feature importance ranking outputs. Supports binary classification and regression with automatic task detection, train-test split, performance tables, feature importance ranking tables, and PNG importance plots.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

> **Source**: [https://github.com/aipoch/medical-research-skills](https://github.com/aipoch/medical-research-skills)

# XGBoost Modeling And Feature Importance Ranking

Use this skill to train an XGBoost model from a tabular dataset and export both feature importance ranking tables and feature importance plots.

## Use This Skill When

- You need a command-line XGBoost workflow in R for tabular data.
- You need a reproducible train-test split, model training, and evaluation.
- You need feature importance ranking outputs as both a table and a figure.
- You need automatic one-hot encoding for categorical predictors.
- Your data may contain a first unnamed sample ID column such as `V1` that should not enter the model.

## Do Not Use This Skill When

- Your classification target has more than 2 classes.
- Your input is not tabular CSV, TXT, or TSV data.
- You need causal interpretation, mechanism claims, or policy, business, or clinical conclusions.
- You only need narrative interpretation or triage of an existing result rather than model training.

## Primary Command

```bash
Rscript scripts/main.R \
  --data_file <input_file> \
  --target_var <target_column> \
  --task_type <auto|classification|regression> \
  --output_dir <output_dir>
```

## Prerequisites

- `Rscript` is available in the shell.
- Required R packages: `optparse`, `data.table`, `Matrix`, `xgboost`.
- Install missing packages with `Rscript -e 'install.packages(c("optparse", "data.table", "Matrix", "xgboost"), repos="https://cloud.r-project.org")'`.

## Core Arguments

The rest: https://github.com/aipoch/medical-research-skills/blob/HEAD/awesome-med-research-skills/Data Analysis/XGBoost-analysis/SKILL.md
