npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

xgboost_node

v0.4.2

Published

Node.js bindings for XGBoost (Linux only)

Readme

██╗  ██╗ ██████╗ ██████╗  ██████╗  ██████╗ ███████╗████████╗    ███╗   ██╗ ██████╗ ██████╗ ███████╗
╚██╗██╔╝██╔════╝ ██╔══██╗██╔═══██╗██╔═══██╗██╔════╝╚══██╔══╝    ████╗  ██║██╔═══██╗██╔══██╗██╔════╝
 ╚███╔╝ ██║  ███╗██████╔╝██║   ██║██║   ██║███████╗   ██║       ██╔██╗ ██║██║   ██║██║  ██║█████╗  
 ██╔██╗ ██║   ██║██╔══██╗██║   ██║██║   ██║╚════██║   ██║       ██║╚██╗██║██║   ██║██║  ██║██╔══╝  
██╔╝ ██╗╚██████╔╝██████╔╝╚██████╔╝╚██████╔╝███████║   ██║       ██║ ╚████║╚██████╔╝██████╔╝███████╗
╚═╝  ╚═╝ ╚═════╝ ╚═════╝  ╚═════╝  ╚═════╝ ╚══════╝   ╚═╝       ╚═╝  ╚═══╝ ╚═════╝ ╚═════╝ ╚══════╝

XGBoost Node

Fast, native Node.js bindings for XGBoost (Linux & MAC)

Features

  • 🚀 Native C++ bindings for maximum performance
  • 🧵 Multi-threaded prediction support
  • 🔄 Async/Promise-based API
  • 💪 Type definitions included
  • 🐧 Linux support (more platforms coming soon)

Prerequisites

  • Linux OS or Mac OS
  • Node.js >= 14.0.0
  • python 3
  • GCC/G++ compiler

Sometimes you will need to install these python packages if not present on you system.

  • setuptools -- Builds/install Python packages, especially ones with C extensions
  • distutils -- Legacy build helper, still assumed by some packages
  • libomp -- Enables OpenMP support for multithreaded C++ libraries like XGBoost

Installation

npm install xgboost_node

Quick Start

import xgboost from 'xgboost_node';

// Training example
const features = [
[1200, 8, 10, 0, 1, 1], // example data could be housing or flight
[800, 14, 15, 1, 2, 0],
[950, 10, 12, 1, 1, 0],
[1000, 9, 11, 0, 0, 1],
[1100, 13, 14, 0, 2, 1],
];
const labels = [250, 180];  // Prices

const params = {
    max_depth: 3,
    eta: 0.1,
    objective: 'reg:squarederror',
    eval_metric: 'rmse'
};

async function main() {
    // Train model
    await xgboost.train(features, labels, params);
    
    // Save the trained model
    await xgboost.saveModel('model.xgb');
    
    // Load model for predictions
    await xgboost.loadModel('model.xgb');
    
    // Make predictions
    const predictions = await xgboost.predict([[1300, 9, 11, 0, 1, 1]]);
    console.log('Predicted price:', predictions[0]);
}

main().catch(console.error);

API Reference

train(features: number[][], labels: number[], params: object): Promise

Trains an XGBoost model with the provided features and labels.

Parameters:

  • features: 2D array of training features
  • labels: Array of training labels
  • params: XGBoost parameters object

predict(features: number[][]): Promise<number[]>

Makes predictions using the trained model.

Parameters:

  • features: 2D array of features to predict

Returns:

  • Array of predictions

saveModel(path: string): Promise

Saves the trained model to disk.

Parameters:

  • path: File path to save the model

loadModel(path: string): Promise

Loads a trained model from disk.

Parameters:

  • path: Path to the saved model file

Building from Source

  1. Clone the repository:
git clone https://github.com/yourusername/xgboost-node.git
  1. Install dependencies:
npm install
  1. Build the native module:
npm run build

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT

Disclaimer

This software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software.

Acknowledgments

  • XGBoost team for the amazing gradient boosting library
  • N-API team for the native addon interface