![]() |
ImputationT Class |
Namespace: Accord.Statistics.Filters
[SerializableAttribute] public class Imputation<T> : BaseFilter<ImputationTOptions, Imputation<T>>, IAutoConfigurableFilter, IFilter, ITransform<T[], T[]>, ICovariantTransform<T[], T[]>, ITransform, IUnsupervisedLearning<Imputation<T>, T[], T[]>
The ImputationT type exposes the following members.
Name | Description | |
---|---|---|
![]() | ImputationT |
Creates a new Imputation filter.
|
![]() | ImputationT(String) |
Creates a new Imputation filter.
|
![]() | ImputationT(T) |
Creates a new Imputation filter.
|
![]() | ImputationT(String, T) |
Creates a new Imputation filter.
|
Name | Description | |
---|---|---|
![]() | Active |
Gets or sets whether this filter is active. An inactive
filter will repass the input table as output unchanged.
(Inherited from BaseFilterTOptions, TFilter.) |
![]() | Columns |
Gets the collection of filter options.
(Inherited from BaseFilterTOptions, TFilter.) |
![]() | ItemInt32 |
Gets options associated with a given variable (data column).
(Inherited from BaseFilterTOptions, TFilter.) |
![]() | ItemString |
Gets options associated with a given variable (data column).
(Inherited from BaseFilterTOptions, TFilter.) |
![]() | NumberOfInputs |
Gets the number of inputs accepted by the model.
(Inherited from BaseFilterTOptions, TFilter.) |
![]() | NumberOfOutputs |
Gets the number of outputs generated by the model.
|
![]() | Token |
Gets or sets a cancellation token that can be used to
stop the learning algorithm while it is running.
(Inherited from BaseFilterTOptions, TFilter.) |
Name | Description | |
---|---|---|
![]() | Add |
Add a new column options definition to the collection.
(Inherited from BaseFilterTOptions, TFilter.) |
![]() | Apply(DataTable) |
Applies the Filter to a DataTable.
(Inherited from BaseFilterTOptions, TFilter.) |
![]() | Apply(DataTable, String) |
Applies the Filter to a DataTable.
(Inherited from BaseFilterTOptions, TFilter.) |
![]() | Detect |
Auto detects the filter options by analyzing a given DataTable.
|
![]() | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetEnumerator |
Returns an enumerator that iterates through the collection.
(Inherited from BaseFilterTOptions, TFilter.) |
![]() | GetHashCode | Serves as the default hash function. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | Learn(DataTable, Double) |
Learns a model that can map the given inputs to the desired outputs.
|
![]() | Learn(T, Double) |
Learns a model that can map the given inputs to the desired outputs.
|
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | OnAddingOptions |
Called when a new column options definition is being added.
Can be used to validate or modify these options beforehand.
(Inherited from BaseFilterTOptions, TFilter.) |
![]() | ProcessFilter |
Processes the current filter.
(Overrides BaseFilterTOptions, TFilterProcessFilter(DataTable).) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
![]() | Transform(T) |
Applies the transformation to an input, producing an associated output.
|
![]() | Transform(T) |
Applies the transformation to a set of input vectors,
producing an associated set of output vectors.
|
![]() | Transform(T, T) |
Applies the transformation to a set of input vectors,
producing an associated set of output vectors.
|
Name | Description | |
---|---|---|
![]() | HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) |
![]() | IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) |
![]() | To(Type) | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) |
![]() | ToT | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) |
// Suppose we have the following double data containing missing values // (indicated by Double.NaN values). Let's say we would like to replace // those NaN values by inputing likely values at their original locations: double[][] data = { new[] { Double.NaN, 0.5, 0.2, 0.7 }, new[] { 1.2, 6.2, 1.2, 4.2 }, new[] { 10, 2.2, -1.1, Double.NaN }, new[] { 10, Double.NaN, -1.1, 1.0 }, new[] { 10, 2.2, Double.NaN, 1.0 }, }; // Let's create a new data imputation filter: var imputation = new Imputation<double>(); // Let's instruct it to replace NaN values in the first // column by their median, values in the second column // by their average, values in the third column by a fixed // value and values in the last column by their mode: imputation[0].Strategy = ImputationStrategy.Median; imputation[1].Strategy = ImputationStrategy.Mean; imputation[2].Strategy = ImputationStrategy.FixedValue; imputation[2].ReplaceWith = 42; imputation[3].Strategy = ImputationStrategy.Mode; // Learn from the data: imputation.Learn(data); // Now, let's transform the input data using the // data imputation rules we just defined above: double[][] result = imputation.Transform(data); // The result should be: // // double[][] expected = new double[][] // { // new[] { a, 0.5, 0.2, 0.7 }, // new[] { 1.2, 6.2, 1.2, 4.2 }, // new[] { 10, 2.2, -1.1, d }, // new[] { 10, b, -1.1, 1.0 }, // new[] { 10, 2.2, c, 1.0 }, // };