"Hadamard" (Machine Learning Method)
- Method for DimensionReduction, DimensionReduce, FeatureSpacePlot and FeatureSpacePlot3D.
- Reduce the dimension of data using the Hadamard transformation.
Details & Suboptions
- "Hadamard" is a linear dimensionality-reduction method that does not learn from the data. The method projects input data on a lower-dimensional space using a slice of a HadamardMatrix. This method attempts to approximate a random projection.
- "Hadamard" is computationally efficient for datasets that have a large number of features; however, since there is no learning, the embedding will not be as good as other methods.
- The following shows two-dimensional embeddings learned by the "Hadamard" method applied to the benchmark datasets Fisher's Irises, MNIST and FashionMNIST:
- The "Hadamard" method nearly preserves the pairwise distances of high-dimensional data, similarly to a random projection.
- DimensionReduce[…,Method"Hadamard", FeatureExtractor"Minimal"] should be used to take full advantage of the computational efficiency of this method.
- The suboption Method can be used to set the type of the matrix manipulation. Method"Matrix" should only be used for datasets with a small number of inputs and reduced features.
- The following suboption can be given:
-
Method Automatic matrix computation method - Possible settings for Method include:
-
"Matrix" constructs the Hadamard matrix explicitly "Transform" uses a direct transformation for the reduction
Examples
open all close allBasic Examples (1)
Options (1)
Method (1)
Compare the performance of "Hadamard" with different suboptions on a high-dimensional vector:
vectors = RandomReal[1, {10, 10 ^ 5}];
First@AbsoluteTiming[DimensionReduce[vectors, 1000, Method -> {"Hadamard", Method -> "Matrix"}, FeatureExtractor -> "Minimal"];]
First@AbsoluteTiming[DimensionReduce[vectors, 1000, Method -> {"Hadamard", Method -> "Transform"}, FeatureExtractor -> "Minimal"];]Applications (1)
Dataset Visualization (1)
Load the Fisher Iris dataset from ExampleData:
iris = ExampleData[{"MachineLearning", "FisherIris"}, "Data"];RandomSample[iris, 5]Generate a reducer function using "Hadamard" with the features of each example:
dr = DimensionReduction[iris[[All, 1]], 2, Method -> "Hadamard"]Group the examples by their species:
byspecies = GroupBy[iris, Last -> First];Reduce the dimension of the features:
ListPlot[dr /@ Values[byspecies], PlotLegends -> Keys@byspecies,
... ]