API Reference
Documentation for the OptImpute public interface.
Index
IAI.ImputationLearnerIAI.MeanImputationLearnerIAI.OptKNNImputationLearnerIAI.OptSVMImputationLearnerIAI.OptTreeImputationLearnerIAI.RandImputationLearnerIAI.SingleKNNImputationLearnerIAI.ZeroImputationLearnerIAI.fit!IAI.fit_and_expand!IAI.imputeIAI.impute_cvIAI.transform_and_expand
Learners
IAI.ImputationLearner — Type
ImputationLearner(; method=:opt_knn, keyword_arguments...)Abstract type containing all imputation learners.
Can be used to construct instances of imputation learners using the method keyword argument.
Additional keyword arguments can be used to specify parameters for the given learner, refer to the documentation for available parameters.
IAI.OptKNNImputationLearner — Type
Learner for conducting optimal k-NN imputation.
The following parameters are supported (refer to the documentation for each):
For optimal k-NN imputation, you should prefer using fit_transform! when imputing on the training set, instead of fit! followed by transform, as the former makes better use of the training data.
IAI.OptSVMImputationLearner — Type
Learner for conducting optimal SVM imputation.
The following parameters are supported (refer to the documentation for each):
IAI.OptTreeImputationLearner — Type
Learner for conducting optimal tree-based imputation.
The following parameters are supported (refer to the documentation for each):
IAI.SingleKNNImputationLearner — Type
Learner for conducting heuristic k-NN imputation.
The following parameters are supported (refer to the documentation for each):
IAI.MeanImputationLearner — Type
Learner for conducting mean imputation.
The following parameters are supported (refer to the documentation for each):
IAI.RandImputationLearner — Type
Learner for conducting random imputation.
The following parameters are supported (refer to the documentation for each):
IAI.ZeroImputationLearner — Type
Learner for conducting zero imputation.
The following parameters are supported (refer to the documentation for each):
IAI.fit! — Method
fit!(lnr::ImputationLearner, X::FeatureInput,
X_warm::FeatureInput=DataFrame())Fit lnr with training features X.
X_warm can be used to provide a warmstart, in which case it must be the same as X except for the missing values being filled in. If not provided, the algorithm will automatically generate and choose from multiple warm starts.
Expansion with Adaptive Indicator Features
IAI.fit_and_expand! — Function
fit_and_expand!(lnr::ImputationLearner, X::FeatureInput;
type::Union{Symbol,String})Fit lnr with training features X and create adaptive indicator features to encode the missing pattern according to type.
The permissible values for type are:
:finitefor finitely-adaptive expansion, whereXis imputed, and missing indicators are added for each feature:affinefor affinely-adaptive expansion, whereXis imputed, and affine combinations of missing indicators and features are added as correction terms
IAI.transform_and_expand — Function
transform_and_expand(lnr::ImputationLearner, X::FeatureInput;
type::Union{Symbol,String})Transform features X with trained lnr and create adaptive indicator features to encode the missing pattern according to type.
See fit_and_expand! for more information.
Simple Imputation Interface
IAI.impute — Function
impute(X::FeatureInput, method::Union{Symbol,AbstractString}=:opt_knn;
X_warm::FeatureInput=DataFrame(), keyword_arguments...)Impute the missing values in X using the specified imputation method.
A warmstart solution X_warm can optionally be supplied, which must be the same data as X with the missing values filled in. If not supplied, the algorithm will automatically generate and choose between multiple warm starts.
Additional keyword arguments can be used to specify parameters for the given method, refer to the documentation for available parameters.
impute(X::FeatureInput, params::Dict; train_proportion::Number=0.7,
keyword arguments...)Impute the missing values in X, validating over params using a grid search.
params should be a Dict specifying the learner parameters and corresponding ranges to be validated over.
train_proportion can be specified to control the proportion of data that is used for training.
Additional keyword arguments can be used to specify learner parameters that should be used for all parameter combinations in the grid, refer to the documentation for available parameters.
IAI.impute_cv — Function
impute_cv(X::FeatureInput, params::Dict; n_folds::Int=5,
keyword arguments...)Like impute(X, params) but uses cross-validation to select the best parameter combination.
n_folds can be specified to control the number of folds used in the cross-validation.