StochTree 0.0.1
Loading...
Searching...
No Matches
Public Member Functions | List of all members
StochTree::RandomEffectsDataset Class Reference

API for loading and accessing data used to sample (additive) random effects. More...

#include <data.h>

Public Member Functions

 RandomEffectsDataset ()
 Default constructor. No data is loaded at construction time.
 
void AddBasis (double *data_ptr, data_size_t num_row, int num_col, bool is_row_major)
 Copy / load basis matrix from raw memory buffer (often pointer to data in a R matrix or numpy array)
 
void AddVarianceWeights (double *data_ptr, data_size_t num_row)
 Copy / load variance weights from raw memory buffer (often pointer to data in a R vector or numpy array)
 
void AddGroupLabels (std::vector< int32_t > &group_labels)
 Copy / load group indices for random effects.
 
data_size_t NumObservations ()
 Number of observations (rows) in the dataset.
 
bool HasBasis ()
 Whether or not a RandomEffectsDataset has (yet) loaded basis data.
 
bool HasVarWeights ()
 Whether or not a RandomEffectsDataset has (yet) loaded variance weights.
 
bool HasGroupLabels ()
 Whether or not a RandomEffectsDataset has (yet) loaded group labels.
 
double BasisValue (data_size_t row, int col)
 Returns a dataset's basis value stored at (row, col)
 
double VarWeightValue (data_size_t row)
 Returns a dataset's variance weight stored at element row
 
int32_t GroupId (data_size_t row)
 Returns a dataset's group label stored at element row
 
Eigen::MatrixXd & GetBasis ()
 Return a reference to the raw Eigen::MatrixXd storing the basis data.
 
Eigen::VectorXd & GetVarWeights ()
 Return a reference to the raw Eigen::VectorXd storing the variance weights.
 
std::vector< int32_t > & GetGroupLabels ()
 Return a reference to the raw std::vector storing the group labels.
 

Detailed Description

API for loading and accessing data used to sample (additive) random effects.

Member Function Documentation

◆ AddBasis()

void StochTree::RandomEffectsDataset::AddBasis ( double *  data_ptr,
data_size_t  num_row,
int  num_col,
bool  is_row_major 
)
inline

Copy / load basis matrix from raw memory buffer (often pointer to data in a R matrix or numpy array)

Parameters
data_ptrPointer to first element of a contiguous array of data storing a basis matrix
num_rowNumber of rows in the basis matrix
num_colNumber of columns in the basis matrix
is_row_majorWhether or not the data in data_ptr are organized in a row-major or column-major fashion

◆ AddVarianceWeights()

void StochTree::RandomEffectsDataset::AddVarianceWeights ( double *  data_ptr,
data_size_t  num_row 
)
inline

Copy / load variance weights from raw memory buffer (often pointer to data in a R vector or numpy array)

Parameters
data_ptrPointer to first element of a contiguous array of data storing weights
num_rowNumber of rows in the weight vector

◆ AddGroupLabels()

void StochTree::RandomEffectsDataset::AddGroupLabels ( std::vector< int32_t > &  group_labels)
inline

Copy / load group indices for random effects.

Parameters
group_labelsVector of integers with as many elements as num_row in the basis matrix, where each element corresponds to the group label for a given observation.

◆ BasisValue()

double StochTree::RandomEffectsDataset::BasisValue ( data_size_t  row,
int  col 
)
inline

Returns a dataset's basis value stored at (row, col)

Parameters
rowRow number to query in the basis matrix
colColumn number to query in the basis matrix

◆ VarWeightValue()

double StochTree::RandomEffectsDataset::VarWeightValue ( data_size_t  row)
inline

Returns a dataset's variance weight stored at element row

Parameters
rowIndex to query in the weight vector

◆ GroupId()

int32_t StochTree::RandomEffectsDataset::GroupId ( data_size_t  row)
inline

Returns a dataset's group label stored at element row

Parameters
rowIndex to query in the group label vector

◆ GetBasis()

Eigen::MatrixXd & StochTree::RandomEffectsDataset::GetBasis ( )
inline

Return a reference to the raw Eigen::MatrixXd storing the basis data.

Returns
Reference to internal Eigen::MatrixXd

◆ GetVarWeights()

Eigen::VectorXd & StochTree::RandomEffectsDataset::GetVarWeights ( )
inline

Return a reference to the raw Eigen::VectorXd storing the variance weights.

Returns
Reference to internal Eigen::VectorXd

◆ GetGroupLabels()

std::vector< int32_t > & StochTree::RandomEffectsDataset::GetGroupLabels ( )
inline

Return a reference to the raw std::vector storing the group labels.

Returns
Reference to internal std::vector

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