Code Monkey home page Code Monkey logo

murilobsd / xgboost Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dmlc/xgboost

0.0 1.0 2.0 23.26 MB

Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library, for Python, R, Java, Scala, C++ and more. Runs on single machine, Hadoop, Spark, Dask, Flink and DataFlow

Home Page: https://xgboost.ai/

License: Apache License 2.0

R 7.34% C 0.50% Python 18.59% Shell 0.77% C++ 41.67% Makefile 0.30% Java 4.22% Scala 8.55% CMake 1.07% Cuda 16.74% M4 0.04% Groovy 0.14% Dockerfile 0.05% Batchfile 0.03%

xgboost's Introduction

Compilando

git clone --recursive https://github.com/murilobsd/xgboost
cd xgboost
mkdir build
cd build
cmake
make -j4

Testando ambientes

Será criado a biblioteca na pasta lib/, como essa biblioteca não tem nenhuma otimização como GPU, OPENSMP, faremos uma copia da mesma para simular a versão do xgboost em python e em cython, para isso digite os comandos abaixo:

# isso pode variar de acordo com o sistema operacional
# por exemplo no windows pode ser lib/xgboost.dll

cp lib/libxgboost.so lib/libcythonize_xgboost.so

# Abra outro terminal e crie um ambiente virtual
# fora da pasta do projeto (pasta clonada) isso porque
# iremos acessar uma outra branch o que pode destruir seu
# ambiente virtual.
mkdir -p ~/src/python
cd ~/src/python
python3 -m venv venv # criamos um ambiente virtual

Python puro

Acesse a pasta python-packages do projeto e ative ambiente virtual criado anteriormente

cd python-packages/
. ~/src/python/venv/bin/activate # isso pode variar de SO para SO
python setup.py install

Testando:

Quando passamos nenhum argumento a esse script ele usa a versão original do xgboost

./test_benchmark.py

Cython

Baixa as branches remotas, acesse a branch cythonize depois acesse a pasta python-packages do projeto e ative ambiente virtual criado anteriormente

git fetch -a
git checkout cythonize
cd python-packages/
. ~/src/python/venv/bin/activate # isso pode variar de SO para SO
python setup.py build_ext --inplace
python setup.py install

Agora iremos fazer o processo manualmente no futuro será feito um script para isso. Nós iremos copiar alguns arquivos para dentro de nosso ambiente virtual para criar o pacote final chamado cythonize_xgboost.

cp cythonize_xgboost/config.py ~/src/python/venv/lib/python3.9/site-packages/cythonize_xgboost/
cp cythonize_xgboost/VERSION ~/src/python/venv/lib/python3.9/site-packages/cythonize_xgboost/
mkdir ~/src/python/venv/lib/python3.9/site-packages/cythonize_xgboost/lib
cp ../lib/libcythonize_xgboost.so ~/src/python/venv/lib/python3.9/site-packages/cythonize_xgboost/lib

Testando:

Quando passamos nenhum argumento a esse script ele usa a versão original do xgboost

./test_benchmark.py "cythonize"

Eu recomendo o uso do hyperfine para gerar o benchmark, o software é específico para isso com inúmeras features. Por exemplo poderia ser usado da seguinte forma

hyperfine --warmup 5 "./test_bench.py" "./test_bench.py 'cythonize'"

xgboost's People

Contributors

tqchen avatar trivialfis avatar hcho3 avatar pommedeterresautee avatar hetong007 avatar codingcat avatar terrytangyuan avatar ramitchell avatar khotilov avatar nachocano avatar giuliohome avatar rongou avatar kalenhaha avatar cblsjtu avatar far0n avatar abdealiloko avatar jameslamb avatar superbobry avatar johanmanders avatar canonizer avatar jseabold avatar yanqingmen avatar shvetsks avatar antinucleon avatar phunterlau avatar ajkl avatar sinhrks avatar sriramch avatar chenqin avatar wbo4958 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.