project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4
project screenshot 5

Sketch-stylus

This is a hand written and optimized machine learning library written in Rust using Arbitrum's Stylus consisting of KNN, ML math , etc.

Sketch-stylus

Created At

Scaling Ethereum 2024

Winner of

Arbitrum - Best Use of Arbitrum Tech/Best Infrastructure 1st place

Arbitrum - Qualifying Arbitrum Submissions

Prize Pool

Project Description

This is a hand written and optimized machine learning library written in Rust using Arbitrum's Stylus SDK. This library implements the following: ->K Nearest Neighbours ->Logistic Regression ->Digit Recognizer ML Model ->Machine Learning Math library For avoiding the loss of precision in weights and biases, scaling has been implemented. Minimal use of std library is employed. The k-nearest neighbors (KNN) algorithm is a non-parametric, supervised learning classifier, which uses proximity to make classifications or predictions about the grouping of an individual data point. Logistic regression estimates the probability of an event occurring, such as voted or didn’t vote, based on a given data set of independent variables. This type of statistical model (also known as logit model) is often used for classification and predictive analytics. This is a library for mathematical functions required within the different implementations of machine learning models. Digit Recognition is a computer vision technique to predict the correct digits from pixel values of images. We have employed MNIST dataset for training. All these have been implemented in rust using the arbitrum stylus SDK and have been checked using ```cargo stylus check` command and their exported abi has also been mentioned in README.md.

How it's Made

We utilized Arbitrum's stylus SDK for Rust to develop the various components of our project. This project comprises four primary components: ml_math, knn, logistic regression, and digit recognizer.

ml_math serves as a library containing essential mathematical functions commonly utilized in machine learning models. It's specifically employed in implementing the digit recognizer, which is responsible for recognizing handwritten digit images. Additionally, we've crafted two other machine learning algorithms, namely knn and logistic regression, to enhance the effectiveness of our project.

Each of these components has been organized into separate stylus projects, each deployed to distinct addresses on the stylus testnet. Within these projects, we've designated a sol_storage component as an entry point, marking the starting point of the contract. From there, the WASM code is generated.

To maintain precision and avoid loss of accuracy, we've implemented scaling for the weights and biases. Furthermore, we've strived for optimization by minimizing the usage of Rust's standard library. Given the upper limit of 24KB for compressed WASM code, we've focused on optimizing various functions such as sqrt.

background image mobile

Join the mailing list

Get the latest news and updates