utils.imput package
Submodules
utils.imput.imputer module
- exception utils.imput.imputer.ImputerException(message='')
Bases:
VL3DException- Author:
Alberto M. Esmoris Pena
Class for exceptions related to imputation components. See
VL3DException.- __init__(message='')
- class utils.imput.imputer.Imputer(**kwargs)
Bases:
object- Author:
Alberto M. Esmoris Pena
Class for imputation operations.
- Variables:
target_val (str or int or float) – The target value, i.e., features that match this value will be imputed.
fnames (list or tuple) – The names of the features to be imputed (by default).
impute_coordinates (bool) – Whether to consider the point-wise coordinates for the imputation (True) or not (False, default).
impute_references (bool) – Whether to consider the point-wise references for the imputation (True) or not (False, default).
- static extract_imputer_args(spec)
Extract the arguments to initialize/instantiate an Imputer from a key-word specification.
- Parameters:
spec – The key-word specification containing the arguments.
- Returns:
The arguments to initialize/instantiate an Imputer.
- __init__(**kwargs)
Initialize/instantiate an Imputer.
- Parameters:
kwargs – The attributes for the Imputer.
- abstractmethod impute(F, y=None)
The fundamental imputation logic defining the imputer.
- Parameters:
F – The input matrix of features to be imputed.
y – The input vector of classes as an optional argument. When given, the imputation in F will be propagated to y if necessary. This imputation is not often needed, but some strategies demand it to keep the consistency between features and expected classes. For example, when the imputation strategy consists of removing points with NaN values, the corresponding component from the vector of classes must also be removed.
- Returns:
The matrix of features and the vector of classes after imputation. If the vector of classes is not given (i.e., is None), then only imputed F will be returned.
- Return type:
np.ndarrayor tuple
- impute_pcloud(pcloud, fnames=None)
Apply the impute method to a point cloud.
See
imputer.Imputer.impute().- Parameters:
pcloud (
PointCloud) – The point cloud to be imputed.fnames (list or tuple) – The list of features to be imputed. If None, it will be taken from the internal fnames of the imputer. If those are None too, then an exception will raise.
- Returns:
The updated point cloud after the imputations.
- Return type:
- find_fnames(fnames=None)
Find the feature names. First, given ones will be considered. If they are not given, then member feature names will be considered if available. Otherwise, an exception will be thrown.
- Parameters:
fnames – The list of features to be imputed. If None, it will be taken from the memember feature names of the imputer. If those are not available, then an exception will be thrown.
- Returns:
The found feature names.
- Return type:
list of str
- extract_pcloud_matrix(pcloud, fnames)
Extract values from the point cloud to build a matrix representing it.
- Parameters:
fnames – The names of the features that must be considered.
- Returns:
The matrix representing the point cloud.
- Return type:
np.ndarray
utils.imput.removal_imputer module
- class utils.imput.removal_imputer.RemovalImputer(**kwargs)
Bases:
Imputer- Author:
Alberto M. Esmoris Pena
Class to remove missing values.
- __init__(**kwargs)
Initialize/instantiate a RemovalImputer
- Parameters:
kwargs – The attributes for the RemovalImputer
- impute(F, y=None)
The fundamental imputation logic defining the removal imputer.
See
Imputerandimputer.Imputer.impute().
- impute_pcloud(pcloud, fnames=None)
Overwrite the logic of
Imputer.impute_pcloud()becauseRemovalImputermight need to remove points from the point cloud.See
Imputer.imput_pcloud().
- find_target_mask(F)
Obtain a boolean mask that specifies whether a given point matches the target value (True) or not (False).
- Parameters:
F – The matrix of point-wise features representing the point cloud.
- Returns:
The
utils.imput.univariate_imputer module
- class utils.imput.univariate_imputer.UnivariateImputer(**kwargs)
Bases:
Imputer- Author:
Alberto M. Esmoris Pena
Class to compute univariate imputations.
- static extract_imputer_args(spec)
Extract the arguments to initialize/instantiate an UnivariateImputer from a key-word specification.
- Parameters:
spec – The key-word specification containing the arguments.
- Returns:
The arguments to initialize/instantiate an UnivariateImputer.
- __init__(**kwargs)
Initialize/instantiate a UnivariateImputer
- Parameters:
kwargs – The attributes for the UnivariateImputer
- impute(F, y=None)
The fundamental imputation logic defining the univariate imputer See
ImputerIn this case, since imputation will not remove points, the y argument will be ignored, no matter what. However, in case y is given as not None, the return will be (imputed F, y) for compatibility and fluent programming. If y is None, only imputed F will be return.
Module contents
- author:
Alberto M. Esmoris Pena
The imputation package contains the logic to impute missing values from point clouds and potential complementary data sources.