Skip to content

This library implements a Random Forest algorithm tailored for compositional data, using Dirichlet-based criteria. Each node in the decision tree is split by maximizing the likelihood under the Dirichlet distribution, allowing the model to naturally handle compositional targets (vectors of proportions that sum to one).

Notifications You must be signed in to change notification settings

Xaleed/DirichletForest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DirichletForest

This repository contains an implementation of a Dirichlet Random Forest, designed for modeling compositional (Dirichlet-distributed) data.

⚠️ Note: This project is still in progress. For a parallel version, see my DirichletRandomParallel repository.


📦 Installation

Clone this repository and install locally in R:

devtools::install_github("https://github.com/Xaleed/DirichletForest.git")
 
library(DirichletForest)

# Generate predictors
n <- 500
p <- 4
X <- matrix(rnorm(n * p), n, p)

# Generate Dirichlet responses
if (!requireNamespace("MCMCpack", quietly = TRUE)) {
  install.packages("MCMCpack")
}
alpha <- c(2, 3, 4)
Y <- MCMCpack::rdirichlet(n, alpha)

# Fit a distributed Dirichlet Forest with 50 trees using 3 cores
df_par3 <- dirichlet_forest(X, Y, B = 50)

# Predict on new data (here we reuse X for illustration)
pred3 <- predict_dirichlet_forest(df_par3, X)

About

This library implements a Random Forest algorithm tailored for compositional data, using Dirichlet-based criteria. Each node in the decision tree is split by maximizing the likelihood under the Dirichlet distribution, allowing the model to naturally handle compositional targets (vectors of proportions that sum to one).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published