StochTree 0.0.1
|
API for loading and accessing data used to sample tree ensembles The covariates / bases / weights used in sampling forests are stored internally as a ForestDataset
by the sampling functions (see Forest Sampler API).
More...
#include <data.h>
Public Member Functions | |
ForestDataset () | |
Default constructor. No data is loaded at construction time. | |
void | AddCovariates (double *data_ptr, data_size_t num_row, int num_col, bool is_row_major) |
Copy / load covariates from raw memory buffer (often pointer to data in a R matrix or numpy array) | |
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 | AddCovariatesFromCSV (std::string filename, std::string column_index_string, bool header=true, bool precise_float_parser=false) |
Copy / load covariates from CSV file. | |
void | AddBasisFromCSV (std::string filename, std::string column_index_string, bool header=true, bool precise_float_parser=false) |
Copy / load basis matrix from CSV file. | |
void | AddVarianceWeightsFromCSV (std::string filename, int32_t column_index, bool header=true, bool precise_float_parser=false) |
Copy / load variance / case weights from CSV file. | |
bool | HasCovariates () |
Whether or not a ForestDataset has (yet) loaded covariate data. | |
bool | HasBasis () |
Whether or not a ForestDataset has (yet) loaded basis data. | |
bool | HasVarWeights () |
Whether or not a ForestDataset has (yet) loaded variance weights. | |
data_size_t | NumObservations () |
Number of observations (rows) in the dataset. | |
int | NumCovariates () |
Number of covariate columns in the dataset. | |
int | NumBasis () |
Number of bases in the dataset. This is 0 if the dataset has not been provided a basis matrix. | |
double | CovariateValue (data_size_t row, int col) |
Returns a dataset's covariate value stored at (row , col ) | |
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 | |
Eigen::MatrixXd & | GetCovariates () |
Return a reference to the raw Eigen::MatrixXd storing the covariate data. | |
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. | |
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 | SetCovariateValue (data_size_t row_id, int col, double new_value) |
Update an observation in the internal covariate matrix to a new value. | |
void | SetBasisValue (data_size_t row_id, int col, double new_value) |
Update an observation in the internal basis matrix to a new value. | |
void | SetVarWeightValue (data_size_t row_id, double new_value, bool exponentiate=true) |
Update an observation in the internal variance weight vector to a new value. | |
API for loading and accessing data used to sample tree ensembles The covariates / bases / weights used in sampling forests are stored internally as a ForestDataset
by the sampling functions (see Forest Sampler API).
|
inline |
Copy / load covariates 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 covariate matrix |
num_row | Number of rows in the covariate matrix |
num_col | Number of columns / covariates in the covariate 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 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 |
Copy / load covariates from CSV file.
filename | Name of the file (including any necessary path prefixes) |
column_index_string | Comma-delimited string listing columns to extract into covariates matrix |
|
inline |
Copy / load basis matrix from CSV file.
filename | Name of the file (including any necessary path prefixes) |
column_index_string | Comma-delimited string listing columns to extract into covariates matrix |
|
inline |
Copy / load variance / case weights from CSV file.
filename | Name of the file (including any necessary path prefixes) |
column_index | Integer index of column containing weights |
|
inline |
Returns a dataset's covariate value stored at (row
, col
)
row | Row number to query in the covariate matrix |
col | Column number to query in the covariate matrix |
|
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 |
Return a reference to the raw Eigen::MatrixXd
storing the covariate data.
|
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 |
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 an observation in the internal covariate matrix to a new value.
row | Row number to be overwritten in the covariate matrix |
col | Column number to be overwritten in the covariate matrix |
new_value | New covariate value |
|
inline |
Update an observation in the internal basis matrix to a new value.
row | Row number to be overwritten in the basis matrix |
col | Column number to be overwritten in the basis matrix |
new_value | New basis value |
|
inline |
Update an observation in the internal variance weight vector to a new value.
row_id | Row ID in the variance weight vector to be overwritten |
new_value | New variance weight value |
exponentiate | Whether or not input should be exponentiated before being saved to var weight vector |