All Projects → komiya-atsushi → Xgboost Predictor Java

komiya-atsushi / Xgboost Predictor Java

Licence: apache-2.0
Pure Java implementation of XGBoost predictor for online prediction tasks.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Xgboost Predictor Java

Tencent2017 Final Rank28 code
2017第一届腾讯社交广告高校算法大赛Rank28_code
Stars: ✭ 85 (-71.85%)
Mutual labels:  xgboost
Calibrated-Boosting-Forest
Original implementation of Calibrated Boosting-Forest
Stars: ✭ 18 (-94.04%)
Mutual labels:  xgboost
HousePrice
住房月租金预测大数据赛TOP1
Stars: ✭ 17 (-94.37%)
Mutual labels:  xgboost
featurewiz
Use advanced feature engineering strategies and select best features from your data set with a single line of code.
Stars: ✭ 229 (-24.17%)
Mutual labels:  xgboost
ai-deployment
关注AI模型上线、模型部署
Stars: ✭ 149 (-50.66%)
Mutual labels:  xgboost
XGBoostLSS
An extension of XGBoost to probabilistic forecasting
Stars: ✭ 182 (-39.74%)
Mutual labels:  xgboost
kaggle getting started
Kaggle getting started competition examples
Stars: ✭ 18 (-94.04%)
Mutual labels:  xgboost
My Data Competition Experience
本人多次机器学习与大数据竞赛Top5的经验总结,满满的干货,拿好不谢
Stars: ✭ 271 (-10.26%)
Mutual labels:  xgboost
Arch-Data-Science
Archlinux PKGBUILDs for Data Science, Machine Learning, Deep Learning, NLP and Computer Vision
Stars: ✭ 92 (-69.54%)
Mutual labels:  xgboost
diabetes use case
Sample use case for Xavier AI in Healthcare conference: https://www.xavierhealth.org/ai-summit-day2/
Stars: ✭ 22 (-92.72%)
Mutual labels:  xgboost
tensorflow kaggle house price
[Done] Master version: developed the stacked regression (score 0.11, top 5%) based on (xgboost, sklearn). Branch v1.0: developed linear regression (score 0.45) based on Tensorflow
Stars: ✭ 25 (-91.72%)
Mutual labels:  xgboost
target-and-market
A data-driven tool to identify the best candidates for a marketing campaign and optimize it.
Stars: ✭ 19 (-93.71%)
Mutual labels:  xgboost
aws-lambda-docker-serverless-inference
Serve scikit-learn, XGBoost, TensorFlow, and PyTorch models with AWS Lambda container images support.
Stars: ✭ 56 (-81.46%)
Mutual labels:  xgboost
xgboost-lightgbm-hyperparameter-tuning
Bayesian Optimization and Grid Search for xgboost/lightgbm
Stars: ✭ 40 (-86.75%)
Mutual labels:  xgboost
Time Series Machine Learning
Machine learning models for time series analysis
Stars: ✭ 261 (-13.58%)
Mutual labels:  xgboost
Kaggle-Competition-Sberbank
Top 1% rankings (22/3270) code sharing for Kaggle competition Sberbank Russian Housing Market: https://www.kaggle.com/c/sberbank-russian-housing-market
Stars: ✭ 31 (-89.74%)
Mutual labels:  xgboost
HumanOrRobot
a solution for competition of kaggle `Human or Robot`
Stars: ✭ 16 (-94.7%)
Mutual labels:  xgboost
Tgboost
Tiny Gradient Boosting Tree
Stars: ✭ 302 (+0%)
Mutual labels:  xgboost
Leaves
pure Go implementation of prediction part for GBRT (Gradient Boosting Regression Trees) models from popular frameworks
Stars: ✭ 261 (-13.58%)
Mutual labels:  xgboost
HyperGBM
A full pipeline AutoML tool for tabular data
Stars: ✭ 172 (-43.05%)
Mutual labels:  xgboost

xgboost-predictor-java

Build Status Download

Pure Java implementation of XGBoost predictor for online prediction tasks.

Getting started

Adding to dependencies

If you use Maven:

<repositories>
  <repository>
    <id>bintray-komiya-atsushi-maven</id>
    <url>http://dl.bintray.com/komiya-atsushi/maven</url>
  </repository>
</repositories>

<dependencies>
  <dependency>
    <groupId>biz.k11i</groupId>
    <artifactId>xgboost-predictor</artifactId>
    <version>0.3.0</version>
  </dependency>
</dependencies>

Or Gradle:

repositories {
    // Use jcenter instead of mavenCentral
    jcenter()
}

dependencies {
    compile group: 'biz.k11i', name: 'xgboost-predictor', version: '0.3.0'
}

Or sbt:

resolvers += Resolver.jcenterRepo

libraryDependencies ++= Seq(
  "biz.k11i" % "xgboost-predictor" % "0.3.0"
)

Using Predictor in Java

package biz.k11i.xgboost.demo;

import biz.k11i.xgboost.Predictor;
import biz.k11i.xgboost.util.FVec;

public class HowToUseXgboostPredictor {
    public static void main(String[] args) throws java.io.IOException {
        // If you want to use faster exp() calculation, uncomment the line below
        // ObjFunction.useFastMathExp(true);

        // Load model and create Predictor
        Predictor predictor = new Predictor(
                new java.io.FileInputStream("/path/to/xgboost-model-file"));

        // Create feature vector from dense representation by array
        double[] denseArray = {0, 0, 32, 0, 0, 16, -8, 0, 0, 0};
        FVec fVecDense = FVec.Transformer.fromArray(
                denseArray,
                true /* treat zero element as N/A */);

        // Create feature vector from sparse representation by map
        FVec fVecSparse = FVec.Transformer.fromMap(
                new java.util.HashMap<Integer, Double>() {{
                    put(2, 32.);
                    put(5, 16.);
                    put(6, -8.);
                }});

        // Predict probability or classification
        double[] prediction = predictor.predict(fVecDense);

        // prediction[0] has
        //    - probability ("binary:logistic")
        //    - class label ("multi:softmax")

        // Predict leaf index of each tree
        int[] leafIndexes = predictor.predictLeaf(fVecDense);

        // leafIndexes[i] has a leaf index of i-th tree
    }
}

Apache Spark integration

See detail xgboost-predictor-spark.

Benchmark

Throughput comparison to xgboost4j 1.1 by xgboost-predictor-benchmark.

Feature xgboost-predictor xgboost4j
Model loading 49017.60 ops/s 39669.36 ops/s
Single prediction 6016955.46 ops/s 1018.01 ops/s
Batch prediction 44985.71 ops/s 5.04 ops/s
Leaf prediction 11115853.34 ops/s 1076.54 ops/s

Xgboost-predictor-java is about 6,000 to 10,000 times faster than xgboost4j on prediction tasks.

Supported models, objective functions and API

  • Models
    • "gblinear"
    • "gbtree"
    • "dart"
  • Objective functions
    • "binary:logistic"
    • "binary:logitraw"
    • "multi:softmax"
    • "multi:softprob"
    • "reg:linear"
    • "reg:squarederror"
    • "rank:pairwise"
  • API
    • Predicts probability or classification
      • Predictor#predict(FVec)
    • Outputs margin
      • Predictor#predict(FVec, true /* output margin */)
    • Predicts leaf index
      • Predictor#predictLeaf(FVec)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].