ab.impute¶
Layers that impute missing data.
-
class
aboleth.impute.
FixedNormalImpute
(datalayer, masklayer, mu_array, std_array)¶ Bases:
aboleth.impute.ImputeOp
Impute the missing values using marginal Gaussians over each column.
Takes two layers, one the returns a data tensor and the other returns a mask layer. Creates a layer that returns a tensor in which the masked values have been imputed as random draws from the marginal Gaussians.
Parameters: - datalayer (callable) – A layer that returns a data tensor. Must be of form
f(**kwargs)
. - masklayer (callable) – A layer that returns a boolean mask tensor where True values are
masked. Must be of form
f(**kwargs)
. - mu_array (array-like) – A list of the global mean values of each dat column
- std_array (array-like) – A list of the global standard deviation of each data column
-
__call__
(**kwargs)¶ Construct the subgraph for this layer.
Parameters: **kwargs – the inputs to this layer (Tensors) Returns: - Net (Tensor) – the output of this layer
- KL (float, Tensor) – the regularizer/Kullback Leibler ‘cost’ of the parameters in this layer.
- datalayer (callable) – A layer that returns a data tensor. Must be of form
-
class
aboleth.impute.
ImputeOp
(datalayer, masklayer)¶ Bases:
aboleth.baselayers.MultiLayer
Abstract Base Impute operation. These specialise MultiLayers.
They expect a data InputLayer and a mask InputLayer. They return layers in which the masked values have been imputed.
Parameters: - datalayer (callable) – A layer that returns a data tensor. Must be of form
f(**kwargs)
. - masklayer (callable) – A layer that returns a boolean mask tensor where True values are
masked. Must be of form
f(**kwargs)
.
-
__call__
(**kwargs)¶ Construct the subgraph for this layer.
Parameters: **kwargs – the inputs to this layer (Tensors) Returns: - Net (Tensor) – the output of this layer
- KL (float, Tensor) – the regularizer/Kullback Leibler ‘cost’ of the parameters in this layer.
- datalayer (callable) – A layer that returns a data tensor. Must be of form
-
class
aboleth.impute.
LearnedNormalImpute
(datalayer, masklayer)¶ Bases:
aboleth.impute.ImputeOp
Impute the missing values with draws from learned normal distributions.
Takes two layers, one the returns a data tensor and the other returns a mask layer. This creates a layer that will learn marginal Gaussian parameters per column, and infill missing values using draws from these Gaussians.
Parameters: - datalayer (callable) – A layer that returns a data tensor. Must be an InputLayer.
- masklayer (callable) – A layer that returns a boolean mask tensor where True values are masked. Must be an InputLayer.
-
__call__
(**kwargs)¶ Construct the subgraph for this layer.
Parameters: **kwargs – the inputs to this layer (Tensors) Returns: - Net (Tensor) – the output of this layer
- KL (float, Tensor) – the regularizer/Kullback Leibler ‘cost’ of the parameters in this layer.
-
class
aboleth.impute.
LearnedScalarImpute
(datalayer, masklayer)¶ Bases:
aboleth.impute.ImputeOp
Impute the missing values using learnt scalar for each column.
Takes two layers, one the returns a data tensor and the other returns a mask layer. Creates a layer that returns a tensor in which the masked values have been imputed with a learned scalar value per colum.
Parameters: - datalayer (callable) – A layer that returns a data tensor. Must be an InputLayer.
- masklayer (callable) – A layer that returns a boolean mask tensor where True values are masked. Must be an InputLayer.
-
__call__
(**kwargs)¶ Construct the subgraph for this layer.
Parameters: **kwargs – the inputs to this layer (Tensors) Returns: - Net (Tensor) – the output of this layer
- KL (float, Tensor) – the regularizer/Kullback Leibler ‘cost’ of the parameters in this layer.
-
class
aboleth.impute.
MeanImpute
(datalayer, masklayer)¶ Bases:
aboleth.impute.ImputeOp
Impute the missing values using the stochastic mean of their column.
Takes two layers, one the returns a data tensor and the other returns a mask layer. Returns a layer that returns a tensor in which the masked values have been imputed as the column means calculated from the batch.
Parameters: - datalayer (callable) – A layer that returns a data tensor. Must be of form
f(**kwargs)
. - masklayer (callable) – A layer that returns a boolean mask tensor where True values are
masked. Must be of form
f(**kwargs)
.
-
__call__
(**kwargs)¶ Construct the subgraph for this layer.
Parameters: **kwargs – the inputs to this layer (Tensors) Returns: - Net (Tensor) – the output of this layer
- KL (float, Tensor) – the regularizer/Kullback Leibler ‘cost’ of the parameters in this layer.
- datalayer (callable) – A layer that returns a data tensor. Must be of form