![]() |
|
Macros | |
#define | Switch_back |
Functions | |
apop_data * | apop_data_listwise_delete (apop_data *d, char inplace) |
apop_model * | apop_ml_impute (apop_data *d, apop_model *mvn) |
Variables | |
apop_model * | apop_swap_model = &(apop_model){"Model with data and params swapped", .estimate=i_est, .p = i_p, .log_likelihood=i_ll, .constraint = i_constraint} |
Some missing data handlers.
If there is an NaN anywhere in the row of data (including the matrix, the vector, the weights, and the text) then delete the row from the data set.
NULL
. apop_opts.nan_string
is not NULL
, then I will make case-insensitive comparisons to the text elements to check for bad data as well. inplace
= 'y', then I'll free each element of the input data set and refill it with the pruned elements. I'll still take up (up to) twice the size of the data set in memory during the function. If every row has an NaN, then your apop_data
set will end up with NULL
vector, matrix, .... if inplace
= 'n', then the original data set is left unmolested. more
element is ignored). d | The data, with NaNs |
inplace | If 'y' , clear out the pointer-to-apop_data that you sent in and refill with the pruned data. If 'n' , leave the set alone and return a new data set. Default='n' . |
inplace=='y'
, a pointer to the input, which was shortened in place. If the entire data set is cleared out, then this will be NULL
. apop_model* apop_ml_impute | ( | apop_data * | d, |
apop_model * | mvn | ||
) |
Impute the most likely data points to replace NaNs in the data, and insert them into the given data. That is, the data set is modified in place.
How it works: this uses the machinery for apop_model_fix_params. The only difference is that this searches over the data space and takes the parameter space as fixed, while basic fix params model searches parameters and takes data as fixed. So this function just does the necessary data-parameter switching to make that happen.
d | The data set. It comes in with NaNs and leaves entirely filled in. |
mvn | A parametrized apop_model from which you expect the data was derived. if NULL , then I'll use the Multivariate Normal that best fits the data after listwise deletion. |
apop_ml_impute_model
. Also, the data input will be filled in and ready to use.