StochTree 0.1.1
|
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 | UpdateBasis (double *data_ptr, data_size_t num_row, int num_col, bool is_row_major) |
Update the data in the internal basis matrix to new values stored in a raw double array. | |
void | UpdateVarWeights (double *data_ptr, data_size_t num_row, bool exponentiate=true) |
Update the data in the internal variance weight vector to new values stored in a raw double array. | |
void | UpdateGroupLabels (std::vector< int32_t > &group_labels, data_size_t num_row) |
Update a RandomEffectsDataset's group indices. | |
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. | |
int | NumBases () |
Number of columns of the basis vector 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. | |
API for loading and accessing data used to sample (additive) random effects.
|
inline |
Copy / load basis matrix from raw memory buffer (often pointer to data in a R matrix or numpy array)
data_ptr | Pointer to first element of a contiguous array of data storing a basis matrix |
num_row | Number of rows in the basis matrix |
num_col | Number of columns in the basis matrix |
is_row_major | Whether or not the data in data_ptr are organized in a row-major or column-major fashion |
|
inline |
Copy / load variance weights from raw memory buffer (often pointer to data in a R vector or numpy array)
data_ptr | Pointer to first element of a contiguous array of data storing weights |
num_row | Number of rows in the weight vector |
|
inline |
Update the data in the internal basis matrix to new values stored in a raw double array.
data_ptr | Pointer to first element of a contiguous array of data storing a basis matrix |
num_row | Number of rows in the basis matrix |
num_col | Number of columns in the basis matrix |
is_row_major | Whether or not the data in data_ptr are organized in a row-major or column-major fashion |
|
inline |
Update the data in the internal variance weight vector to new values stored in a raw double array.
data_ptr | Pointer to first element of a contiguous array of data storing a weight vector |
num_row | Number of rows in the weight vector |
exponentiate | Whether or not inputs should be exponentiated before being saved to var weight vector |
|
inline |
Update a RandomEffectsDataset's group indices.
data_ptr | Pointer to first element of a contiguous array of data storing a weight vector |
num_row | Number of rows in the weight vector |
exponentiate | Whether or not inputs should be exponentiated before being saved to var weight vector |
|
inline |
Copy / load group indices for random effects.
group_labels | Vector 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. |
|
inline |
Returns a dataset's basis value stored at (row
, col
)
row | Row number to query in the basis matrix |
col | Column number to query in the basis matrix |
|
inline |
Returns a dataset's variance weight stored at element row
row | Index to query in the weight vector |
|
inline |
Returns a dataset's group label stored at element row
row | Index to query in the group label vector |
|
inline |
Return a reference to the raw Eigen::MatrixXd
storing the basis data.
|
inline |
Return a reference to the raw Eigen::VectorXd
storing the variance weights.
|
inline |
Return a reference to the raw std::vector
storing the group labels.