Hilbert Space-Filling curve and its application in Machine Learning

Dr. Manoj Kumar Yadav
redbus India Blog
Published in
3 min readJul 10, 2022
Source : Wikipedia

Introducing an ML library that combines Hilbert Curve(s) with the Classic ML algorithms like k-means clustering to match up deep learning. MKHilberML An ML library that combines Hilbert Curve(s) with the Classic ML algorithms like k-means clustering to match up deep learning. Some information about Hilbert Curve can be obtained from Wikipedia link

A grayscale photograph can be converted to a dithered black-and-white image using thresholding, with the leftover amount from each pixel added to the next pixel along the Hilbert curve. Code to do this would map from 1D to 2D, and the Hilbert curve is sometimes used because it does not create the distracting patterns that would be visible to the eye if the order were simply left to right across each row of pixels. Hilbert curves in higher dimensions are an instance of a generalization of Gray codes, and are sometimes used for similar purposes, for similar reasons. For multidimensional databases, Hilbert order has been proposed to be used instead of Z order because it has better locality-preserving behavior. For example, Hilbert curves have been used to compress and accelerate R-tree indexes[5] (see Hilbert R-tree). They have also been used to help compress data warehouses.[6][7]

Example : Detect Comet :)

Source Image | Fed to detect 3 Objects

The algorithm is is able to detect three distinct regions of the image as shown in the example below:

Result of object clustering using mkHilbertML | It has done what we need it to

Conclusion

This is just a demonstration of the approaches to use the space filling curves to simply achieve results without needing the deep learning or any other complicated machine learning models. One more example shown below confirms the reach of this new approach.

Second Example
Detected regions and boundaries.

More details are available on Github.

References:

True Geometry’s Blog | Reverse engineering on popularly known 3D file formats.Applying state of the art machine learning algorithms to do so.

GitHub — Azmechatech/mkHilbertML: [WIP]An ML library that combines Hilbert Curve(s) with the Classic ML algorithms like k-means clustering to match up deep learning

--

--

Dr. Manoj Kumar Yadav
redbus India Blog

Doctor of Business Administration | VP - Engineering at redBus | Data Engineering | ML | Servers | Serverless | Java | Python | Dart | 3D/2D