A recommender systems framework for Rust

Overview

Quackin

travis crates

Release the quackin! 🦆

Quackin is a recommender systems framework written in Rust. This is a young project, which means two things:

  • There will be a lot of breaking changes until version 1.0
  • Is a perfect project for your contributions ;)

Quackin was concieved as a framework for collaborative filtering recommender systems. But it is open to new ideas. If you want to contribute in some way open or start working on an issue or ping me at [email protected].

One of the difficulties for developing this crate is that the Rust's machine learning and data mining ecosystem is on an early stage, then there is no standard libraries for anything yet. Nevertheless, I believe that we should take advantage of the control and speed that Rust offers to provide a competitive alternative to frameworks written in languages with a more developed ecosystem like Python or Java.

Getting started

We will write a simple movie recommender engine using Quackin over one of the movielens dataset. Download ml-latest-small.zip from here, and then extract the ratings.csv file.

Loading data into Quackin

First we need to load the movielens dataset into Rust. This dataset has the following columns: userId, movieId, rating and timestamp. We must tell quackin that this file has this columns in this specific order. Also, we need to specify if this file has headers or not and which delimiter is separating the values`.

use quackin::data::{Record, ReadOptions, read_custom_records};
quackin::data::Field::*;

let options = ReadOptions::custom(vec![UserID, ItemID, Rating, Other], true, ',').unwrap();
//                                                             ^^^^^   ^^^^  ^^^
//                                                             |       |     |
//                             we don't care about the timestamp.      |     |
//                                                 this file has headers.    |
//                                                    use comma as a delimiter.

Whew, thats a lot of boilerplate for just loading the dataset. But this was the hardest part of the process. Now lets load the dataset:

let records = read_custom_records("/path/to/movielens", options);

Thats it! now let's build a recommender

Creating a recommender

We will use a traditional K-nearest neighbors algorithm to build a basic recommender. For each user we will take the 50 nearest users to him, using a cosine similarity

use quackin::recommender::{KnnUserRecommender, Recommender};
use quackin::metrics::similarity::cosine;

let recommender = KnnUserRecommender::from_records(&records, cosine, 50);

Now we can ask predictions from the recommender. For example, the user with user ID 1 gave a rating of 4 to the classic science fiction movie "Tron". What would our recommender predict about this?

println!("{:?}", recommender.predict("1", "2105"));
// Ok(3.504942020280084)

Not bad! we aren't that far from the real rating. Now you can start recommending movies to everyone!

You might also like...
Indeed, an ORM library, not a framework, written in Rust

Ormlib Indeed, an ORM library, not a framework, written in Rust Features The main idea that I put into my ORM library is a minimum of stupid code and

Manas project aims to create a modular framework and ecosystem to create robust storage servers adhering to Solid protocol in rust.

मनस् | Manas Solid is a web native protocol to enable interoperable, read-write, collaborative, and decentralized web, truer to web's original vision.

An RPC framework developing tutorial

Mini Lust 系列教程 好奇如何从零造出来一个 RPC 框架?本教程将带你一步一步写出来一个 Rust 版 Thrift RPC 框架。 教程说明 从第二章开始每章节都会附带代码。 这个代码是在上一章节的基础上写的,文档里一般会告诉你增加了哪些东西,但是如果你想详细地对比到底哪里变动了,可以自

Incremental Program Analysis Framework
Incremental Program Analysis Framework

IncA Overview IncA is a program analysis framework. It comes with a DSL for the definition of program analyses and the runtime system evaluates progra

A backend framework for building fast and flexible APIs rapidly.

Andromeda Andromeda is a backend framework for Rust, to simplify the development of the kinds of basic API services that we developers have to build s

🧪 The versatile and intuitive memory hacking framework.

🧪 hax 🤔 About hax is a Rust crate designed to make memory hacking, game hacking, cheat development, and any other low level memory based development

Grebuloff is an experimental addon framework for Final Fantasy XIV.

Grebuloff Grebuloff is an experimental addon framework for Final Fantasy XIV. It introduces a new concept of what plugins can be, focusing on enabling

Moving to the new Arbiter framework to test Portfolio.

Stable Pool Simulation The simulation in this repository is intended to demonstrate a basic simulation created with the Arbiter framework. To do so, w

Leetcode Solutions in Rust, Advent of Code Solutions in Rust and more

RUST GYM Rust Solutions Leetcode Solutions in Rust AdventOfCode Solutions in Rust This project demostrates how to create Data Structures and to implem

Owner
Christopher Vittal
Christopher Vittal
Mote is a systems-programming language designed to be practical, performant, and simple.

Mote NOTE: this following lists the goals for what Mote is supposed to be. It does not promise that any of the features here will be accomplished or a

The Mote Programming Language 14 Jul 28, 2021
Portable linked-list allocator designed for baremetal systems

Palloc Portable linked-list allocator for embedded / baremetal systems. Using the crate Include this in the [dependencies] section of Cargo.toml pallo

Pietro 3 Jan 11, 2022
A type-safe, high speed programming language for scalable systems

A type-safe, high speed programming language for scalable systems! (featuring a cheesy logo!) note: the compiler is unfinished and probably buggy. if

Hail 0 Sep 14, 2022
Key-value store for embedded systems, for raw NOR flash, using an LSM-Tree.

ekv Key-value store for embedded systems, for raw NOR flash, using an LSM-Tree. Features None yet TODO Everything Minimum supported Rust version (MSRV

Dario Nieuwenhuis 16 Nov 22, 2022
A collection of comparison-benchmarks for Nova & related Proving systems

Nova benchmarks Here's a list of some of the benchmarks we've been taking to better understand how Nova performs vs other proof systems. Live version:

Privacy & Scaling Explorations (formerly known as appliedzkp) 18 Apr 17, 2023
Integra8 rust integration test framework Rust with a focus on productivity, extensibility, and speed.

integra8 Integra8 rust integration test framework Rust with a focus on productivity, extensibility, and speed. | This repo is in a "work in progress"

exceptional 3 Sep 26, 2022
Safe Rust bindings to the DynamoRIO dynamic binary instrumentation framework.

Introduction The dynamorio-rs crate provides safe Rust bindings to the DynamoRIO dynamic binary instrumentation framework, essentially allowing you to

S.J.R. van Schaik 17 Nov 21, 2022
Rust bindings to the dos-like framework

dos-like for Rust   This project provides access to Mattias Gustavsson's dos-like framework, so as to write DOS-like applications in Rust. How to use

Eduardo Pinho 9 Aug 25, 2022
A developer-friendly framework for building user interfaces in Rust

Reading: "Fru" as in "fruit" and "i" as in "I" (I am). What is Frui? Frui is a developer-friendly UI framework that makes building user interfaces eas

Frui Framework 1.1k Jan 8, 2023
A minimal boilerplate for Astro / Vite with the Nannou creative framework (Rust → WASM). Supports multiple sketches + hot-reload.

Astro x Nannou Starter astro-nannou-demo-1c.mov ?? Try it online! # 0a. Rust language tools open https://www.rust-lang.org/tools/install # 0b. wasm-p

Julian Cataldo 4 Jan 4, 2023