StochTree 0.5.0.9000
Loading...
Searching...
No Matches
StochTree::OrdinalSampler Class Reference

Sampler for ordinal model hyperparameters. More...

#include <ordinal_sampler.h>

Public Member Functions

void UpdateLatentVariables (ForestDataset &dataset, Eigen::VectorXd &outcome, std::mt19937 &gen)
 Update truncated exponential latent variables (Z).
void UpdateGammaParams (ForestDataset &dataset, Eigen::VectorXd &outcome, double alpha_gamma, double beta_gamma, double gamma_0, std::mt19937 &gen)
 Update gamma cutpoint parameters.
void UpdateCumulativeExpSums (ForestDataset &dataset)
 Update cumulative exponential sums (seg).

Static Public Member Functions

static double SampleTruncatedExponential (std::mt19937 &gen, double rate, double low=0.0, double high=1.0)
 Sample from truncated exponential distribution.

Detailed Description

Sampler for ordinal model hyperparameters.

This class handles MCMC sampling for ordinal-specific parameters:

  • Truncated exponential latent variables (Z)
  • Cutpoint parameters (gamma)
  • Cumulative sum of exp(gamma) (seg) [derived parameter]

Member Function Documentation

◆ SampleTruncatedExponential()

double StochTree::OrdinalSampler::SampleTruncatedExponential ( std::mt19937 & gen,
double rate,
double low = 0.0,
double high = 1.0 )
static

Sample from truncated exponential distribution.

Samples from exponential distribution truncated to [low,high]

Parameters
genRandom number generator
rateRate parameter for exponential distribution
lowLower truncation bound
highUpper truncation bound
Returns
Sampled value from truncated exponential

◆ UpdateLatentVariables()

void StochTree::OrdinalSampler::UpdateLatentVariables ( ForestDataset & dataset,
Eigen::VectorXd & outcome,
std::mt19937 & gen )

Update truncated exponential latent variables (Z).

Parameters
datasetForest dataset containing training data (covariates) and auxiliary data needed for sampling
outcomeVector of outcome values
genRandom number generator

◆ UpdateGammaParams()

void StochTree::OrdinalSampler::UpdateGammaParams ( ForestDataset & dataset,
Eigen::VectorXd & outcome,
double alpha_gamma,
double beta_gamma,
double gamma_0,
std::mt19937 & gen )

Update gamma cutpoint parameters.

Parameters
datasetForest dataset containing training data (covariates) and auxiliary data needed for sampling
outcomeVector of outcome values
alpha_gammaShape parameter for log-gamma prior on cutpoints gamma
beta_gammaRate parameter for log-gamma prior on cutpoints gamma
gamma_0Fixed value for first cutpoint parameter (for identifiability)
genRandom number generator

◆ UpdateCumulativeExpSums()

void StochTree::OrdinalSampler::UpdateCumulativeExpSums ( ForestDataset & dataset)

Update cumulative exponential sums (seg).

Parameters
datasetForest dataset containing training data (covariates) and auxiliary data needed for sampling

The documentation for this class was generated from the following file: