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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ml-xgboost

v1.1.2

Published

[![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![David deps][david-image]][david-url] [![npm download][download-image]][download-url]

Downloads

50

Readme

xgboost

NPM version build status David deps npm download

Installation

$ npm install ml-xgboost

API Documentation

Example

import IrisDataset from 'ml-dataset-iris';

require('ml-xgboost').then(XGBoost => {
    var booster = new XGBoost({
        booster: 'gbtree',
        objective: 'multi:softmax',
        max_depth: 5,
        eta: 0.1,
        min_child_weight: 1,
        subsample: 0.5,
        colsample_bytree: 1,
        silent: 1,
        iterations: 200
    });

    var trainingSet = IrisDataset.getNumbers();
    var predictions = IrisDataset.getClasses().map(
        (elem) => IrisDataset.getDistinctClasses().indexOf(elem)
    );

    booster.train(dataset, trueLabels);
    var predictDataset = /* something to predict */
    var predictions = booster.predict(predictDataset);

    // don't forget to free your model
    booster.free()

    // you can save your model in this way
    var model = JSON.stringify(booster); // string
    // or
    var model = booster.toJSON(); // object

    // and load it
    var anotherBooster = XGBoost.load(model); // model is an object, not a string
});

Development

  • You should have emscripten sdk-1.37.22 installed on your computer and be able to use emcc and em++.
  • Download the repo: git clone --recursive https://github.com/mljs/xgboost
  • Run npm run build or make at the root directory.

XGBoost library files changed

  • dmlc-core/include/dmlc/base.h line 45 here

  • rabit/include/dmlc/base.h line 45 here

    #if (!defined(DMLC_LOG_STACK_TRACE) && defined(__GNUC__) && !defined(__MINGW32__))
    #define DMLC_LOG_STACK_TRACE 1
    #undef DMLC_LOG_STACK_TRACE
    #endif

    Note: this is to avoid compilation issues with the execinfo.h library that is not needed in the JS library

  • in case that you get the following error:

    ./xgboost/include/xgboost/c_api.h:29:9: error: unknown type name 'uint64_t'

    just add this import at the beginning of this file after the first define:

    #include <stdint.h>

License

© Contributors, 2016. Licensed under an Apache-2 license.