Skip to content
Back to skills

Boruta

ASecurity

R Boruta package for feature selection. Use for all-relevant feature selection using random forest.

  • 5 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added June 4, 2026
data

Security analysis

A100/100

Scanned June 4, 2026

npx -y skills add LeoLin990405/r-analytics-skill --skill Boruta --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Boruta?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Boruta
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/leolin990405-boruta/badge)](https://www.skillsdirectory.com/skills/leolin990405-boruta)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: Boruta
description: R Boruta package for feature selection. Use for all-relevant feature selection using random forest.
---

# Boruta

All-relevant feature selection.

## Basic Usage

```r
library(Boruta)

# Run Boruta
boruta_result <- Boruta(target ~ ., data = df, doTrace = 2)

# With formula
boruta_result <- Boruta(y ~ x1 + x2 + x3, data = df)

# Without formula
boruta_result <- Boruta(x = df[, -1], y = df$target)
```

## Parameters

```r
boruta_result <- Boruta(
  target ~ .,
  data = df,
  maxRuns = 100,        # Max iterations
  doTrace = 2,          # Verbosity (0, 1, 2)
  holdHistory = TRUE,   # Keep importance history
  getImp = getImpRfZ    # Importance function
)
```

## Results

```r
# Summary
print(boruta_result)

# Get decisions
boruta_result$finalDecision

# Confirmed important
getSelectedAttributes(boruta_result, withTentative = FALSE)

# Including tentative
getSelectedAttributes(boruta_result, withTentative = TRUE)

# Importance scores
attStats(boruta_result)
```

## Handling Tentative

```r
# Resolve tentative features
boruta_final <- TentativeRoughFix(boruta_result)

# Get final selection
getSelectedAttributes(boruta_final)
```

## Visualization

```r
# Plot importance
plot(boruta_result)

# With labels
plot(boruta_result, las = 2, cex.axis = 0.7)

# Custom plot
plotImpHistory(boruta_result)
```

## Custom Importance

```r
# Use different importance measure
boruta_result <- Boruta(
  target ~ .,
  data = df,
  getImp = getImpRfGini  # Gini importance
)

# Custom function
my_imp <- function(x, y) {
  # Return importance vector
}
boruta_result <- Boruta(target ~ ., data = df, getImp = my_imp)
```

## With Different Models

```r
# Using ranger
library(ranger)
getImpRanger <- function(x, y) {
  rf <- ranger(y ~ ., data = data.frame(y, x), importance = "impurity")
  return(rf$variable.importance)
}

boruta_result <- Boruta(target ~ ., data = df, getImp = getImpRanger)
```

## Parallel Processing

```r
library(doParallel)
registerDoParallel(cores = 4)

boruta_result <- Boruta(
  target ~ .,
  data = df,
  doTrace = 2
)
```

## Feature Selection Workflow

```r
# 1. Run Boruta
boruta_result <- Boruta(target ~ ., data = train_df, maxRuns = 100)

# 2. Fix tentative
boruta_final <- TentativeRoughFix(boruta_result)

# 3. Get selected features
selected <- getSelectedAttributes(boruta_final)

# 4. Create formula
formula <- as.formula(paste("target ~", paste(selected, collapse = " + ")))

# 5. Train final model
final_model <- randomForest(formula, data = train_df)
```

## Comparison with Other Methods

```r
# Boruta vs RFE
# Boruta: finds ALL relevant features
# RFE: finds MINIMAL optimal subset

# Boruta is better when:
# - You want to understand all important features
# - Feature interpretation is important
# - You have correlated features
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…