LightGBM Rust binding

Related tags

GUI lightgbm-rs
Overview

lightgbm-rs

LightGBM Rust binding

Require

You need an environment that can build LightGBM.

# linux
apt install -y cmake libclang-dev libc++-dev gcc-multilib

# OS X
brew install cmake libomp

On Windows

  1. Install CMake and VS Build Tools.
  2. Install LLVM and set an environment variable LIBCLANG_PATH to PATH_TO_LLVM_BINARY (example: C:\Program Files\LLVM\bin)

Please see below for details.

Usage

Example LightGBM train.

extern crate serde_json;
use lightgbm::{Dataset, Booster};
use serde_json::json;

let data = vec![vec![1.0, 0.1, 0.2, 0.1],
               vec![0.7, 0.4, 0.5, 0.1],
               vec![0.9, 0.8, 0.5, 0.1],
               vec![0.2, 0.2, 0.8, 0.7],
               vec![0.1, 0.7, 1.0, 0.9]];
let label = vec![0.0, 0.0, 0.0, 1.0, 1.0];
let dataset = Dataset::from_mat(data, label).unwrap();
let params = json!{
   {
        "num_iterations": 3,
        "objective": "binary",
        "metric": "auc"
    }
};
let bst = Booster::train(dataset, &params).unwrap();

Please see the ./examples for details.

example link
binary classification link
multiclass classification link
regression link

Develop

git clone --recursive https://github.com/vaaaaanquish/lightgbm-rs
docker build -t lgbmrs .
docker run -it -v $PWD:/app lgbmrs bash

# cargo build

Thanks

Much reference was made to implementation and documentation. Thanks.

Comments
  • adding integration with polars

    adding integration with polars

    Hi,

    First off I've been playing around with the crate and I think it's really great.

    One thing that I thought might be useful is to have integration with polars (i.e. something like pandas integration with sklearn in python)

    I've added a new constructor method from_dataframe for the Dataset struct and packaged it under a new crate feature dataframe

    I'm not sure if you're accepting contributions and whether a contribution like this would be something you'd want. Feel free to close the pr if not.

    Let me know what you think!

    Thanks :)

    opened by benjaminjellis 4
  • Add linter CI and refactoring

    Add linter CI and refactoring

    • Add CI to run clippy and format checking.
    • Fixes all clippy warning.
      • Removes unused imports.
      • Removes primitive casting.
      • Removes unnecessary wrapping results and ?.
    • Format examples.
    • Shorten some if expressions.
    • Uses new to construct LGBMError.
    opened by paq 4
  • Support Windows

    Support Windows

    Fixes build script to support building on windows platform.

    With this change, I have confirmed that examples work at the minimum on Windows. But, my testing is seriously lacking, so it may not works perfectly.

    opened by paq 4
  • Avoid redundant prefixes

    Avoid redundant prefixes

    • Renames LGBMError to Error and LGBMResult to Result.
      • See details https://doc.rust-lang.org/1.0.0/style/style/naming/README.html#avoid-redundant-prefixes-[rfc-356]
    • Changes booster::save_file return value to Result for avoiding panic.
    opened by paq 1
  • We need to specify the c++11 version explicitly in our build

    We need to specify the c++11 version explicitly in our build

    It will be really helpful for us, if we could add a line in here:

    https://github.com/vaaaaanquish/lightgbm-rs/blob/main/lightgbm-sys/build.rs#L39-L43

        let dst = Config::new(&lgbm_root)
            .profile("Release")
            .uses_cxx11()
            .cxxflag("-std=c++11") // this is the line we need to add
            .define("BUILD_STATIC_LIB", "ON")
            .build();
    
    opened by Adam57 0
  • Added support for weights

    Added support for weights

    Hi there!

    I just added support to assign weights to observation since I needed it for a project. Just a wrapper for LGBM_DatasetSetField. Hope it is useful to someone else.

    Cheers.

    opened by geohardtke 0
  • add load_string and save_string apis.

    add load_string and save_string apis.

    The in-memory equivalents of load_file and save_file.

    Maybe loading from a &[u8] and saving to a Vec would be better to avoid the conversions between c-strings and rust-strings. Or maybe that could be a future api (load_vec, save_vec). Thoughts?

    opened by leofidus 0
  • GPU support

    GPU support

    Error { desc: "GPU Tree Learner was not enabled in this build.\nPlease recompile with CMake option -DUSE_GPU=1" }

    May I ask, is there any plan to support GPU, the current version does not support GPU, there will be the above error

    opened by momodi 0
Releases(v0.2.4)
Owner
vaaaaanquish
Darth Vader
vaaaaanquish
Qt5 binding for rust language. (stalled)

Qt5 binding for Rust language. qt.rs This project provides bindings that allow the QT Gui toolkit to be used from the Rust Programming language. Compi

yatsen1 37 Oct 12, 2021
A Rust binding of the wxWidgets cross platform toolkit.

wxRust master: / mac(0.10): This is a Rust binding for the wxWidgets cross platform toolkit. API wxRust API documentation How it works The wxRust libr

KENZ 129 Jan 4, 2023
A simple, cross-platform GUI automation module for Rust.

AutoPilot AutoPilot is a Rust port of the Python C extension AutoPy, a simple, cross-platform GUI automation library for Python. For more information,

null 271 Dec 27, 2022
A data-first Rust-native UI design toolkit.

Druid A data-first Rust-native UI toolkit. Druid is an experimental Rust-native UI toolkit. Its main goal is to offer a polished user experience. Ther

null 8.2k Dec 31, 2022
The Rust UI-Toolkit.

The Orbital Widget Toolkit is a cross-platform (G)UI toolkit for building scalable user interfaces with the programming language Rust. It's based on t

Redox OS 3.7k Jan 1, 2023
An easy-to-use, 2D GUI library written entirely in Rust.

Conrod An easy-to-use, 2D GUI library written entirely in Rust. Guide What is Conrod? A Brief Summary Screenshots and Videos Feature Overview Availabl

PistonDevelopers 3.3k Jan 1, 2023
Rust bindings to Core Foundation and other low level libraries on Mac OS X and iOS

core-foundation-rs Compatibility Targets macOS 10.7 by default. To enable features added in macOS 10.8, set Cargo feature mac_os_10_8_features. To hav

Servo 685 Jan 2, 2023
Rust bindings for the FLTK GUI library.

fltk-rs Rust bindings for the FLTK Graphical User Interface library. The FLTK crate is a crossplatform lightweight gui library which can be statically

Mohammed Alyousef 1.1k Jan 9, 2023
Build beautiful desktop apps with flutter and rust. 🌠 (wip)

flutter-rs Build flutter desktop app in dart & rust. Get Started Install requirements Rust flutter sdk Develop install the cargo flutter command cargo

null 2k Dec 26, 2022
Idiomatic, GTK+-based, GUI library, inspired by Elm, written in Rust

Relm Asynchronous, GTK+-based, GUI library, inspired by Elm, written in Rust. This library is in beta stage: it has not been thoroughly tested and its

null 2.2k Dec 31, 2022
Rust bindings for Dear ImGui

imgui-rs: Rust bindings for Dear ImGui (Recently under new maintenance, things subject to change) Window::new(im_str!("Hello world")) .size([300.0

null 2k Jan 7, 2023
Clear Coat is a Rust wrapper for the IUP GUI library.

Clear Coat Clear Coat is a Rust wrapper for the IUP GUI library. IUP uses native controls and has Windows and GTK backends. A macOS backend has been o

Jordan Miner 18 Feb 13, 2021
A simple UI framework for Rust built on top of IUP (http://webserver2.tecgraf.puc-rio.br/iup/)

KISS-UI A UI framework for Rust based on the KISS (Keep It Simple, Stupid!) philosophy. Powered by the IUP GUI library for C by Tecgraf, via the bindi

null 342 Jul 11, 2022
Rust bindings to the minimalist, native, cross-platform UI toolkit `libui`

Improved User Interface A cross-platform UI toolkit for Rust based on libui iui: ui-sys: iui is a simple (about 4 kLOC of Rust), small (about 800kb, i

Rust Native UI Group 865 Dec 27, 2022
Integrate Qml and Rust by building the QMetaObject at compile time.

QMetaObject crate for Rust The qmetaobject crate is a crate which is used to expose rust object to Qt and QML. Objectives Rust procedural macro (custo

Woboq GmbH 495 Jan 3, 2023
QtQuick interface for Rust

qmlrs - QtQuick bindings for Rust qmlrs allows the use of QML/QtQuick code from Rust, specifically Rust code can create a QtQuick engine (QQmlApplicat

Mikko Perttunen 432 Nov 24, 2022
QML (Qt Quick) bindings for Rust language

QML-rust - bindings for Qt Quick Bindings are based on DOtherSide C bindings for QML Library is mostly feature-compliant with other bindings based on

Oak 204 Dec 8, 2022
Rust bindings for Sciter

Rust bindings for Sciter Check this page for other language bindings (Delphi / D / Go / .NET / Python / Rust). Introduction Sciter is an embeddable mu

Terra Informatica Software, Inc 757 Dec 30, 2022
A cross-platform GUI library for Rust, inspired by Elm

Iced A cross-platform GUI library for Rust focused on simplicity and type-safety. Inspired by Elm. Features Simple, easy-to-use, batteries-included AP

Héctor Ramón 17.5k Jan 2, 2023